如何在按钮触摸上更改UICollectionView框架

时间:2014-03-31 10:22:45

标签: ios ipad ios7 uicollectionview cgrect

我正在尝试关注代码但没有任何作用:

CGRect frame  = collectionview.frame;  
collectionview.frame = CGRectMake (frame.origin.x, frame.origin.y+100, frame.size, frame.size-100);

项目的AutoLayout设置为true。

2 个答案:

答案 0 :(得分:2)

尝试以下代码:

CGRect frame  = collectionview.frame;  
collectionview.frame = CGRectMake (frame.origin.x, frame.origin.y+100, frame.size.width, frame.size.height-100);

答案 1 :(得分:0)

试试这个:

CGRect frame = collectionview.frame;
frame = CGRectMake (frame.origin.x, frame.origin.y+100, frame.size, frame.size-100);
collectionview.frame=frame;