ios - Adding view controllers to stack view programmatically -


the goal have few views own controllers (for example can view pickerview, label , search text field) , main view controller create these controllers.

i tryed use stackview add these controllers main view. methods inside controllers invokes stack view empty.

code of child control:

class lookupcontrol: uiviewcontroller, uipickerviewdatasource, uipickerviewdelegate { @iboutlet weak var picker: uipickerview?  var pickerdatasource = ["t1", "t2", "t3"];  override func viewdidload() {     super.viewdidload()     picker?.datasource = self     picker?.delegate = self }  func numberofcomponentsinpickerview(pickerview: uipickerview) -> int {     return 1  }  func pickerview(pickerview: uipickerview, numberofrowsincomponent component: int) -> int {     return pickerdatasource.count  }  func pickerview(pickerview: uipickerview, titleforrow row: int, forcomponent component: int) -> string? {    return pickerdatasource[row] } 

}

code of parent control:

class contactdetailviewcontroller: uiviewcontroller, substitutabledetailviewcontroller {  @iboutlet var stackview: uistackview?  override func viewdidload() {     super.viewdidload()      let lc = lookupcontrol(nibname: "lookupview", bundle: nil)     self.stackview?.addarrangedsubview(lc.view) } 

}

is posable add uiviewcontrollers stackview? best practice in ios?

thanks in advance, sergey


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -