ios - Container View bounds issue in Swift -


i'm writing function can height , width of container view:

// container view's uiviewcontroller class selectionview: uiviewcontroller {      override func viewdidload() {         super.viewdidload()     }      func getbounds -> (cgfloat,cgfloat){         let x = self.view.bounds.width / 5         let y = self.view.bounds.height / 15         return x,y     }  } 

i write button call getbounds() , works well, when put in viewdidload() function

override func viewdidload() {     super.viewdidload()     getbounds() } 

getbounds() returns me different height , width , not bounds of container view.

i'm pretty sure i've linked class container view!

view layout not setup in viewdidload. therefore resizing not done yet , size wrong(probably same declared in storyboard/xib).

move getbounds in viewwilllayoutsubviews or viewwillappear , work correctly. please mind method won't called 1 time ;)


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -