uiview - Howto Size the Modal View programmatically (SWIFT) -
i want present small option dialog on existing main uiviewcontroller/uiview , on ipad see small dialog , in background see main view.
i managed show uiviewcontroller/uiview in modal view style follow:
func showoptions(){ let storyboard = uistoryboard(name: "main", bundle: nil) let controller = storyboard.instantiateviewcontrollerwithidentifier("options") as! uiviewcontroller controller.modalpresentationstyle = uimodalpresentationstyle.popover let popoverpresentationcontroller = controller.popoverpresentationcontroller // result optional (but should not nil if modalpresentationstyle popover) if let _popoverpresentationcontroller = popoverpresentationcontroller { // set view pop _popoverpresentationcontroller.sourceview = self.view; //_popoverpresentationcontroller.sourcerect = cgrectmake(60, 100, 500, 500) //_popoverpresentationcontroller. .setpopovercontentsize(cgsizemake(550, 600), animated: true) //_popoverpresentationcontroller.sourceview.sizetofit(); // present (id iphone modal automatic full screen) self.presentviewcontroller(controller, animated: true, completion: nil) } }
but have still issues: 1. howto rid of arrow shown @ border. 2. howto size modal view. shown small , fit largest controls in uicontrollerview/uiview.
any ?
- try changing
_popoverpresentationcontroller.permittedarrowdirections
empty option set - change
controller.preferredcontentsize
match desired size
Comments
Post a Comment