当 ipad 的方向发生变化时,我想要 View 的 x、y、宽度、高度值自动调整大小。我怎样才能得到它?
最佳答案
View 旋转后,您应该能够获得 View 的新尺寸。
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
CGRect myFrame = [self.view frame];
NSLog(@"height = %f", myFrame.size.height);
NSLog(@"width = %f", myFrame.size.width);
NSLog(@"x = %f", myFrame.origin.x);
NSLog(@"y = %f", myFrame.origin.y);
}
关于iphone - 在自动调整 View 大小后,如何获取 CGRect 值 x、y、宽度、高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9665395/