iOS: Why do I have white, rounded corners on my modal view?

前端 未结 9 748
悲哀的现实
悲哀的现实 2021-01-02 00:37

I have a modal view popping up in my iPad app and for some reason it has white, rounded corners.

It might be worth noting I built this model view in my storyboard, n

相关标签:
9条回答
  • 2021-01-02 01:03

    I'm my case the white stuff are hidden in the drop shadow's view at layer background color. Solved by changing the background to clear color:

    //Monotouch code
    View.Superview.Layer.BackgroundColor = UIColor.Red.CGColor;
    

    If it's doesn't get rid of the white corner keep searching, remember to check out some properties of the View, SuperView and BackgroundViews:

    • Background color
    • Layer's background color
    • Layer's Border width and color
    • Heading
    • Clip to bounds

    Note: DropShadow is visible as View's SuperView at ViewWillApper

    0 讨论(0)
  • 2021-01-02 01:04

    That's weird. Try self.view.layer.masksToBounds = YES; too if that works. You'll probably lose your view's shadows though.

    Come to think of it, that white thing probably comes from the view below your navigation bar.

    0 讨论(0)
  • 2021-01-02 01:06

    In order to make the modal view transparent and make the transparency happen before the view appeared was to move self.view.superview.backgroundColor = [UIColor clearColor] from viewDidAppear to the following:

    • (void)viewWillLayoutSubviews{ [super viewWillLayoutSubviews];

      self.view.superview.backgroundColor = [UIColor clearColor]; }

    0 讨论(0)
提交回复
热议问题