阅读背景:

当按下后退按钮返回rootViewController时,UILabel sizeToFit不会保留

来源:互联网 

So my rootViewController contains a UICollectionView with a Custom UICollectionViewCell. I have a label on the cell for a header which shouldn't ever change and I have a multi-line Label making up the body of the rest of the cell. When I launch the app it calls the sizeToFit correctly and top aligns everything so it isn't centered. I click on one of the cells and go to the next view, then if I click the back button to go back to the rootViewController it does run the viewWillAppear method and reloads the data but the sizeToFit does not work and everything on the multi-line label becomes center aligned. It is still multiple lines but if there is only a couple of lines it sits in the center of the label and it doesn't look good. How can I keep this so it is consistant. I have a left menu that will reload the rootViewController which will position the label correctly again but once I hit the back button from the secondViewController it is no longer aligned. Is there a way to make it clear all of the cells and reload them. I have tried the [collectionView reloadData]; in the viewWillAppear and it doesn't work, it is currently called at the end of the connectionDidFinish which the network connection is called from the viewWillAppear method. Any assistance is appreciated.So my rootViewController contains a UICollectio




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: