I am currently trying to put a CollectionView inside a Today Extension. But there is some thing that bothers me.
I want to achieve that every cell fits inside one row of my collection-view. So calculate the cells width, depending on the items count.
Everything works fine on the iPhone but on the iPad it just doesn't look right. The cells width are way to big. So i debugged my code and it seems that self.view.frame.width or self.view.bounds.width returns the full width of the Screen and not the notification-centers width. No wonder why my cells are to big. I am calculating my item-size like so :
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat count = (CGFloat)[self.collectionView numberOfItemsInSection:0];
return CGSizeMake(self.collectionView.frame.size.width/count, 80.0);;
}
So my question now is, how can i get the "real" width of my notification center on the ipad ?