【发布时间】:2012-01-19 07:46:58
【问题描述】:
我有 UIViewController,有 2 个 UIView。第一个 UIView 是主视图。在某个按钮操作点,我将第二个 UIView 的子视图添加到第一个 UIVIew。
所以我想如果只有第一个 UIView 可以旋转,但如果我添加其他 UIView 的子视图,它不会让旋转。所以我必须识别主视图是否有第二个视图的子视图并且不要让旋转。像这样的:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (_secondView) {
return NO;
}
// Return YES for supported orientations
return YES;
}
【问题讨论】:
标签: iphone objective-c ios