Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIModalPresentationFormSheet的圆角_Ios_Objective C_Uiview_Rounded Corners_Uimodalpresentationstyle - Fatal编程技术网

Ios UIModalPresentationFormSheet的圆角

Ios UIModalPresentationFormSheet的圆角,ios,objective-c,uiview,rounded-corners,uimodalpresentationstyle,Ios,Objective C,Uiview,Rounded Corners,Uimodalpresentationstyle,如果这是一个明显的问题,请原谅我,我是一个比较新的人 我使用自定义尺寸和圆角设置了一个模态视图: - (void)viewWillLayoutSubviews{ [super viewWillLayoutSubviews]; self.view.superview.bounds = CGRectMake(0, 0, 600, 450); self.view.layer.cornerRadius = 60.0; } 然而,我发现当我绕过视图的拐角时,它的边缘会出现

如果这是一个明显的问题,请原谅我,我是一个比较新的人

我使用自定义尺寸和圆角设置了一个模态视图:

- (void)viewWillLayoutSubviews{

    [super viewWillLayoutSubviews];
    self.view.superview.bounds = CGRectMake(0, 0, 600, 450);
    self.view.layer.cornerRadius  = 60.0;  
}
然而,我发现当我绕过视图的拐角时,它的边缘会出现这种灰色(好像后面还有什么东西):(见图)

如何删除这些灰色边缘,使其像正常情况一样显示背景内容?我试着加上

self.view.layer.masksToBounds = YES;
self.view.layer.masksToBounds = YES;
然而,这仍然会产生与上述相同的效果

谢谢,

像这样使用



使用此选项,它将移除阴影


我认为你应该设置超级视图的角半径。

事实证明你需要使超级视图变圆并遮罩超级视图

[self.view superview].layer.cornerRadius = 30.0f;
[self.view superview].layer.masksToBounds = YES;
所以最后它看起来是这样的:)


谢谢你的帮助,姗

嗨,很遗憾,这似乎不起作用,上面显示了相同的结果。是的,我也在姗回答的同一时间回答,几秒钟后就不同了。我没有注意到他嗨,不幸的是,这似乎不起作用,同样的结果如上图所示。对于iOS8,请尝试:self.view.layer。这对我来说是成功的。诀窍是在“viewWillLayoutSubviews”中设置这些内容
- (void)viewWillLayoutSubviews
{
    [super viewWillLayoutSubviews];
    self.view.superview.bounds = CGRectMake(0, 0, 600, 450);
    self.view.superview.layer.cornerRadius  = 60.0;   
    self.view.superview.layer.masksToBounds = YES;  
}
[self.view superview].layer.cornerRadius = 30.0f;
[self.view superview].layer.masksToBounds = YES;
- (void)viewWillLayoutSubviews{
    //setup custom size modal view
    [super viewWillLayoutSubviews];
    self.view.superview.bounds = CGRectMake(0, 0, 600, 450);
    [self.view superview].layer.cornerRadius = 30.0f;
    [self.view superview].layer.masksToBounds = YES;
}