Magic Studio

专心做有逼格的APP!

autolayout之后获取uiview的frame

这个只要一行代码就搞定了。详细请看:

In order to get the right frame/bounds of your UIImageView after resizing, you need first ask auto-layout to update that layout using [yourImageView layoutIfNeeded]. that will solve your constraints and update your yourImage.bounds.

[myImageView layoutIfNeeded];

NSLog(@"w: %f, h: %f", myImageView.bounds.size.width, myImageView.bounds.size.height);

就一行代码啊!

 

或者在这个方法中获取frame:

- (void)viewDidLayoutSubviews {
// VC just laid off its views
}

 

posted on 2015-02-25 17:41  Mr 布鲁斯  阅读(1185)  评论(0编辑  收藏  举报

导航