ios - Changing frame of UIView through IBOutlet from storyboard -
@iboutlet weak var outletview: uiview! //referencing outlet connected override func viewdidload() { super.viewdidload() //not working outletview.frame = cgrectmake(100, 100, 100, 100) //working var view = uiview(); view.frame = cgrectmake(0, 20, 100, 100); self.view.addsubview(view); }
how can edit frame of @iboutlet view normal uiview instance?
i solved remove use size classes
on storyboard inspector.
when set frame
in viewdidload
method , first assigns frame set inviewdidload
, storyboard
constraints
applied constraints
over-ridden.
in order alter constraints
apply constraints
in viewdidappear
method , reflected
override func viewdidappear(animated: bool) { outletview.frame = cgrect(x: 100, y: 100, width: 200, height: 400) }
ios swift
No comments:
Post a Comment