swift - How to add a custom border to viewcontroller (ios) -
i have view (uipopoverpresentation) functionality works fine, need add custom border. i'm using borderwidth , bordercolor cannot seem find way make customized border, seen in photo below. how go creating customized border? make cgrect?
what need:
what have:
i've attempted add image background of popover , resulted in this:
edit: //popoverview (presented using uipopoverpresentation)
override func viewdidload() { super.viewdidload() self.view.layer.cornerradius = 10.0 self.view.layer.borderwidth = 1.5 self.view.layer.bordercolor = uicolor.whitecolor().cgcolor self.navigationcontroller?.navigationbarhidden = true self.popviewtableview.delegate = self self.popviewtableview.datasource = self self.popviewtableview.alwaysbouncevertical = false self.popviewtableview.backgroundcolor = uicolor(red: 151.0/255.0, green: 87.0/255.0, blue: 172.0/255.0, alpha: 1.0) } //base view controller. when button pressed, function called presents popover func presentpopover() { let contentview = uistoryboard(name: "main", bundle: nil).instantiateviewcontrollerwithidentifier("popviewcontroller") as! deckpopviewcontroller contentview.modalpresentationstyle = uimodalpresentationstyle.popover contentview.preferredcontentsize = cgsizemake(deckselectioncgrect.width, 160) let popovermenuviewcontroller = contentview.popoverpresentationcontroller! popovermenuviewcontroller.delegate = self popovermenuviewcontroller.sourceview = view popovermenuviewcontroller.permittedarrowdirections = uipopoverarrowdirection(rawvalue:0) popovermenuviewcontroller.sourcerect = cgrectmake((self.view.bounds.width/2) - (deckselectioncgrect.width/2), 120, deckselectioncgrect.width, deckselectioncgrect.height) presentviewcontroller(contentview, animated: true, completion: nil) } func adaptivepresentationstyleforpresentationcontroller(controller: uipresentationcontroller) -> uimodalpresentationstyle { return uimodalpresentationstyle.none } //also: on third image, placed border imageview on entire view controller in storyboard, set padding 0 on sides (autolayout). doesn't good, though.
Comments
Post a Comment