Storyboard, personally think is a good thing, but everything to do it always feel messy. Personal preference pulls complex local controls (such as custom Collectionviewcell) in the Xib file.
In the development process encountered a lot of pits, the memory is: Xib parts (such as button) the effect of setting rounded corners, the loaded xib cannot resize size.
First question: The setting code for the fillet:
View.layer.cornerRadius = VIEW.FRAME.SIZE.HEIGHT/2;
Using AutoLayout, you need to be aware of where the call is: (because AutoLayout will recalculate the frame, the frame where the child control is called is correct)
-(void) viewdidlayoutsubviews;
Well, what if xib? In the following function, write the effect of the child control you need to reach.
-layoutsubviews;
The following function is called by the owner of the Xib, and the following function departs Layoutsubviews
[Xib layoutifneeded]
-----------Gorgeous split-line----------------
The second question: you set the size of the xib, but the interface Xib still stubbornly shows the size of its xib. swollen.
-(void) awakefromnib { [super awakefromnib]; Solve Uicollectionviewcell subviews do not resize self.contentView.autoresizingMask = // Uiviewautoresizingflexibleleftmargin | Uiviewautoresizingflexiblewidth | Uiviewautoresizingflexiblerightmargin | Uiviewautoresizingflexibletopmargin | Uiviewautoresizingflexibleheight //uiviewautoresizingflexiblebottommargin ; self.contentView.translatesAutoresizingMaskIntoConstraints = YES;}
iOS loading xib encounters a pit