In development, a module that needs to be reused is often used, such as the display of each user in a buddy list or each dynamic, which is the same template, so that we can extract this part and put it in a separate. Xib. So how does the extracted. Xib work in other. Xib?
Now let's talk about how to load other. xib. Xib in. The approximate structure is this:
Create the project, the project name is called Compositexib
The creation of Mainview and Childview,childview will be included as child view into Mainview.
This is done after the creation:
Set the size of the Childview to be customizable, removing the status bar:
set Size:
Add a control: A ImageView, a label, and a button, and after adding it, your view should look like this:
Add the childview.xib corresponding cocoa class file:
. m add Setup Method:
. H Add View property:
Connect this cocoa class and childview.xib:
In this way, a child view is ready.
In Main. Xib Add a View control and set its class to the Childview that is prepared for the top:
Run:
IOS Interface Builder: Load another. xib file in the. xib file