4

I would like to create an Modal in iOS without rounded corners - the Modal represents an UIViewController in an UINavigationController.

When ill try with:

override func viewWillAppear(animated: Bool) {
    self.navigationController?.view.layer.cornerRadius = 0
}

It is not working. Is there a solution for that?

Edit: I mean that rounded corners here:

enter image description here

That code is only an example (removed all other useless code here)

derdida
  • 14,784
  • 16
  • 90
  • 139
  • Where are the rounded corners coming from? Usually, you should not have them. Could you maybe provide more details about you app. BTW, in the `viewWillAppear` method you should always call `super. viewWillAppear(animated)` – Catalina T. Jan 21 '16 at 11:01

2 Answers2

8

Already found a solution. Assign a class to your modal view and add:

override func viewWillLayoutSubviews() {
   super.viewWillLayoutSubviews()
   view.superview?.layer.cornerRadius  = 0.0
}

This will remove the rounded corners.

Daniel
  • 20,420
  • 10
  • 92
  • 149
derdida
  • 14,784
  • 16
  • 90
  • 139
-1

Try this:

navController?.modalPresentationStyle = .FormSheet
apinho
  • 2,235
  • 3
  • 25
  • 39