Created
January 21, 2016 02:09
-
-
Save thornpig/9d7152a6d91059c1c4b5 to your computer and use it in GitHub Desktop.
When using auto layout, retrieving subview frames should be done after frames are determined based on constraints
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In UIViewController subclasses | |
-(void)viewDidLayoutSubviews | |
{ | |
self.containerView.frame = self.view.bounds; | |
self.currentVC.view.frame = self.containerView.bounds; | |
} | |
In UIView subclasses | |
-(void)layoutSubviews | |
{ | |
[super layoutSubviews]; | |
//accessing frame should be done in layout Subviews | |
self.thumbnailButton.layer.cornerRadius = 0.5 * CGRectGetWidth(self.thumbnailButton.frame); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment