【发布时间】:2011-04-03 07:16:46
【问题描述】:
【问题讨论】:
-
在此处查看我在此相关问题中的回答:stackoverflow.com/questions/12965560/…
标签: cocoa-touch ios ipad
【问题讨论】:
标签: cocoa-touch ios ipad
首先导入“QuartzCore/QuartzCore.h”,其中 ViewController 将显示为 UIModalPresentationFormSheet,然后覆盖 viewWillAppear
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.view.superview.layer.cornerRadius = 10;
self.view.superview.layer.borderColor = [UIColor darkGrayColor].CGColor;
self.view.superview.layer.borderWidth = 1;
self.view.superview.clipsToBounds = YES;
}
【讨论】:
如果你想要阴影,你不应该剪辑到超级视图的边界。
此解决方案将保持阴影可见。
self.view.superview.layer.cornerRadius = 7.f;
for (CALayer *layer in self.view.superview.layer.sublayers)
if (layer != self.view.layer)
layer.cornerRadius = 8.f;
【讨论】:
SpecPopover *ctrl = [[SpecPopover alloc] initWithNibName:@"SpecPopover" bundle:nil];
// Create a Navigation controller
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:ctrl];
[self.navigationController pushViewController:ctrl animated:YES];
navController.modalPresentationStyle = UIModalPresentationFormSheet;
navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
navController.view.backgroundColor = [UIColor clearColor];
// show the navigation controller modally
[self presentModalViewController:navController animated:YES];
navController.view.superview.frame = CGRectMake (200,200,400,400);
// Following removes the white round edges from the corner. <<<<<<<<-------------
navController.view.superview.layer.cornerRadius = 8;
navController.view.superview.layer.borderColor = [UIColor clearColor].CGColor;
navController.view.superview.layer.borderWidth = 2;
navController.view.superview.clipsToBounds = YES;
[navController release];
[ctrl release];
【讨论】: