【发布时间】:2015-12-25 18:19:38
【问题描述】:
我已经通过故事板创建了集合视图单元格,对于 4 和 5 英寸的屏幕,我已将 UIEdgeInsetsMake 设置为编程方式,如果设备不是 4 和 5,那么我的故事板 UIEdgeInsetsMake 必须为此设置。
怎么做?
这是我的代码
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout*)collectionViewLayout
insetForSectionAtIndex:(NSInteger)section {
CGRect screenBound = [[UIScreen mainScreen] bounds];
CGSize screenSize = screenBound.size;
CGFloat screenWidth = screenSize.width;
UIEdgeInsets insets= UIEdgeInsetsMake(?,?,?,?);//how to get the current edge insets.
if(screenWidth==320)
{
UIEdgeInsets insets = UIEdgeInsetsMake(0,12,20,2);
return insets;
}
return insets;
}
【问题讨论】:
标签: ios objective-c ios7 uicollectionviewcell uiedgeinsets