您的位置:首页 > 产品设计 > UI/UE

autolayout之后获取uiview的frame

2015-09-23 15:03 423 查看
转载自:http://www.nikest.com/web/jswd/2015/0225/122190.html

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

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 youryourImage.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
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: