popoverpresentviewcontroller with rectangle corner and without arrow
Using the concept above, you can also set the corner radius in the completion parameter.
Swift 3
let popoverViewController: UIViewController = // Some view controller to be presented in a popover
// Set popover properties here...
// i.e. popoverViewController.modalPresentationStyle = .popover
present(popoverViewController, animated: true, completion: {
popoverViewController.view.superview?.layer.cornerRadius = 0
// Additional code here
})
In iOS 11 its not possible to use @SHN solution for removing rounded corners. The corner radius is set to default value after viewWillAppear.
Radius must be set in viewDidAppear method
override func viewDidAppear(_ animated: Bool) {
view.superview?.layer.cornerRadius = 0
super.viewDidAppear(animated)
}
To get popover without arrow when you are initiating popover, use:
popover!.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0)
For popover without corner radius, in the popover content view controller use:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
// Do any additional setup after loading the view, typically from a nib.
self.view.superview?.layer.cornerRadius = 0.0;
}