Cocoa touch UIModalPresentationFormSheet白色角
我尝试使用背景为深色的UIModalPresentationFormSheet,但视图的各个角落总是有一点白色显示 你可以看到一幅画 我以前从未见过这种情况。您知道是什么导致了这种情况吗?首先导入“QuartzCore/QuartzCore.h”,其中ViewController将显示为UIModalPresentationFormSheet,然后覆盖视图Cocoa touch UIModalPresentationFormSheet白色角,cocoa-touch,ios,ipad,Cocoa Touch,Ios,Ipad,我尝试使用背景为深色的UIModalPresentationFormSheet,但视图的各个角落总是有一点白色显示 你可以看到一幅画 我以前从未见过这种情况。您知道是什么导致了这种情况吗?首先导入“QuartzCore/QuartzCore.h”,其中ViewController将显示为UIModalPresentationFormSheet,然后覆盖视图 - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:ani
- (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;
}
如果需要阴影,则不应剪裁到superview的边界 此解决方案将使阴影保持可见
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;
specpoover*ctrl=[[specpoover alloc]initWithNibName:@“specpoover”bundle:nil];
//创建导航控制器
UINavigationController*导航控制器=[[UINavigationController alloc]
initWithRootViewController:ctrl];
[self.navigationController-pushViewController:ctrl-animated:YES];
navController.modalPresentationStyle=UIModalPresentationFormSheet;
navController.modalTransitionStyle=UIModalTransitionStyleCross溶解;
navController.view.backgroundColor=[UIColor clearColor];
//以模式显示导航控制器
[自我呈现ModalViewController:navController动画:是];
navController.view.superview.frame=CGRectMake(200400400);
//以下操作将删除拐角处的白色圆边。欢迎来到堆栈溢出!请解释你的代码片段是如何工作的,以及它是如何解决问题的。有人能解释一下发生了什么事吗???@Kunal,重新绘制角半径请参见我在这个相关问题中的答案:
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];