iosobjective-cuiviewrounded-cornersuimodalpresentationstyle

Rounding corners of 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).

enter image description here

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.

Thanks,


Solution

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

    I think you should set corner radius of the superView.