我一直在玩它。这是不完整的,只是处理纵向子视图缩放,但到目前为止工作正常。
if (self.view.bounds.size.width < self.view.bounds.size.height) {
NSLog(@"view is portrait");
if (_sview.frame.size.width < _sview.frame.size.height) {
NSLog(@"subview is portrait");
[UIView animateWithDuration:0.1
animations:^{
_sview.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);
}];
} else {
NSLog(@"subview is landscape");
}
} else {
NSLog(@"landscape");
if (_sview.frame.size.width < _sview.frame.size.height) {
[UIView animateWithDuration:0.1
animations:^{
_sview.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.65, 0.65);
}];
} else {
NSLog(@"subview is landscape");
}
}