我正在以编程方式创建一个 UIView,它最终将成为我的通用应用程序的帮助气泡,但我很难让 UIView 支持设备旋转。创建我的视图时,它看起来很棒,正是我想要的,但是当我旋转设备时,我的 UIView 弹出框会扩展以填充整个屏幕,这不是我想要的。
如果有帮助,我将使用带有自动布局的 iOS 6 来处理其他情节提要控件。
有人可以解释为什么 iOS 在设备旋转时将我的弹出框调整为全屏吗?
我还考虑为其添加一些约束,但认为这更多的是用于子层而不是弹出视图本身。
我正在使用的代码是:
customView = [[UIView alloc] initWithFrame:CGRectMake(20, 20, 200, 200)];
customView.layer.cornerRadius = 15;
customView.layer.borderWidth = 1.5f;
customView.backgroundColor = [UIColor blackColor];
[customView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];
[self.tableView.superview addSubview:customView];