1
我已經通過storyBoard創建了收藏視圖單元格,對於4英寸和5英寸的屏幕,我已經以編程方式設置了UIEdgeInsetsMake,如果設備不是4和5,那麼我的故事板UIEdgeInsetsMake必須爲此設置。如何獲取UIEdgeInsets實現?
怎麼辦?
這是我的代碼
- (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;
}
你絕對正確 –
@ STONE2如何通過編程獲得的寬度和高度的兄弟... \ –
@KishoreKumar寬度和什麼高度? – Stonz2