码迷,mamicode.com
首页 > 其他好文 > 详细

autolayout之后获取uiview的frame

时间:2015-02-25 18:29:22      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:

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

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
}

 

autolayout之后获取uiview的frame

标签:

原文地址:http://www.cnblogs.com/sunshine-anycall/p/4299896.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!