Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing UIViews within UICollectionViewCell in iOS7 using iOS8 SDK

I have an UICollectionView with subviews in the cells. They don't resize in iOS7 using the iOS8 SDK. When running the app on iOS8 seems to be ok

It seems that in the drawForRect of the subviews the frame is not resized as it's all the time returning the same value.

I am using auto layout attaching the the subviews to the edge of the cells.

Any clue?

Thanks a lot.

EDIT

This is the solution. I will keep this in case it's easier to find for you with my question.

https://stackoverflow.com/a/25768887/1523444

like image 666
Manuel M. Avatar asked Sep 15 '14 12:09

Manuel M.


1 Answers

I have same problem with iOS7. Its work for me. Put this method in custom cell class.

-(void)awakeFromNib
{
    self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
}
like image 174
Pradip Vanparia Avatar answered Nov 05 '22 03:11

Pradip Vanparia