Reputation: 45
I'm currently developing an app using UICollectionView
. I need to know the height of the contentSize, which I'm doing by
self.collectionView.collectionViewLayout.collectionViewContentSize.height
Now this is working, but the returned value is not correct for portrait mode always. What should I do to achieve what I need?
Upvotes: 2
Views: 4858
Reputation: 11005
Just get self.collectonView.contentSize in viewDidAppear and didRotateFromInterfaceOrientation
- (void)viewDidAppear:(BOOL)animated{
NSLog(@"%0.0f-%0.0f",self.collectionView.contentSize.width,self.collectionView.contentSize.height);
}
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
NSLog(@"%0.0f-%0.0f",self.collectionView.contentSize.width,self.collectionView.contentSize.height);
}
Upvotes: 3