是否可以使用 presentModalViewController
显示不规则形状的模态视图?模式部分覆盖屏幕(呈现样式设置为 UIModalPresentationFormSheet
)
我尝试简单地将 super View clipsToBounds
设置为 NO,但没有成功。我似乎也无法摆脱圆角。
PS:我试图避免必须创建自定义 View 并手动执行此操作。
PPS:我从文档中注意到我们现在应该在 iOS 5 中使用 presentViewController
。不过它并没有完成任何不同的事情。
最佳答案
我有点让它工作了。这有点 hack,但它确实有效。
代码(这是生成模态的 Controller 内部):
// Present the modal
[self presentViewController:modalVC animated:YES completion:NULL];
// Let content overflow and shrink superview to a small dimension
modalVC.view.clipsToBounds = NO;
modalVC.view.superview.bounds = CGRectMake(modalVC.view.superview.bounds.origin.x, modalVC.view.superview.bounds.origin.y, 100, 100);
现在只要让模态的 View 比父 View 大,你就可以疯狂地改变形状。
请注意,触摸只会在 super View 区域注册。
关于objective-c - iPad 上不规则形状的模态视图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8289663/