UIModalPresentationFormSheet的四舍五入 [英] Rounding corners of UIModalPresentationFormSheet

查看:214
本文介绍了UIModalPresentationFormSheet的四舍五入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请原谅我,如果这是一个显而易见的问题,我相对较新。

forgive me if this is an obvious question i am relatively new.

我有一个模态视图,我设置了自定义大小和圆角:

I have a modal view which i set up with a custom size and rounded corners:

- (void)viewWillLayoutSubviews{

    [super viewWillLayoutSubviews];
    self.view.superview.bounds = CGRectMake(0, 0, 600, 450);
    self.view.layer.cornerRadius  = 60.0;  
}

然而我发现当我绕过视角时,我会得到这种灰色出现在它的边缘(就好像它背后的其他东西):(见图)。

However i find that when i round the view corners, i get this greyish colour appear on the edges of it (as if theres something else behind it) : (see picture).

如何删除这些灰色边缘,使其显示正常的背景内容?我已经尝试添加

How do i remove these greyish edges so it shows the background content like normal? I've tried adding

self.view.layer.masksToBounds = YES;

然而这仍然具有与上述相同的效果。

however this still gives the same effect as above.

谢谢,

推荐答案

- (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;  
}

我认为你应该设置superView的角半径。

I think you should set corner radius of the superView.

这篇关于UIModalPresentationFormSheet的四舍五入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆