Using SB to AutoLayout the content of Uicollectionviewcell, found a Xcode6.01 bug, that is, when you are bound to the Uicollectioncell, the real label on the simulator is centered, But the real machine is really not the center, then Google a bit, and found the problem, this is because using the iOS8 SDK compiled projects run in iOS 7 caused the Contentview size has not changed, one of the solutions: is to re-layoutsubviews the method in your definition of the Uicollectionviewcell subclass, each time the cell layout is condemned, See if Self.contentView.frame.size and self.frame.size are consistent as Contentview are automatically laid out, and then re-modify the Uicollectionviewcell frame.
-(void) layoutsubviews{ [Super Layoutsubviews]; = cgsizeequaltosize (self.frame.size, self.contentView.frame.size); if ( ! contentviewisautoresized) { = self.contentView.frame; = self.frame.size; = contentviewframe; } NSLog (@ "%@", Nsstringfromcgrect (Self.contentView.frame));}
If you do not have a custom cell class, you can also
-(Uicollectionviewcell *) CollectionView: (Uicollectionview *) CV Cellforitematindexpath: (Nsindexpath *) Indexpath Add the following code
[Cell.contentview setFrame:cell.bounds]; [Cell.contentview setautoresizingmask:uiviewautoresizingflexibleheight| Uiviewautoresizingflexiblewidth];
Another way is to Xcode6.1.1 select Storyboard and then select Show in file Inspecter to change ios8.0 and later to ios7.1 can also be resolved;
Also attached stackoverflow the original solution: http://stackoverflow.com/questions/24750158/ Autoresizing-issue-of-uicollectionviewcell-contentviews-frame-in-storyboard-pro
Xcode6.01 Bug encountered in storyboard to Uicollectionviewcell AutoLayout