Uitabbarcontroller
1 classUitabbarcontrollercontroller:uiviewcontroller {2 3var titlestring:string!4 5@IBOutlet var titlelabel:uilabel!6 7@IBOutlet var tabbarctl:uitabbarcontroller!8 9 Ten //return button Events One @IBAction func backbuttonclick () A { -Self.navigationcontroller?. Popviewcontrolleranimated (true) - } the - - Overridefunc viewdidload () { - super.viewdidload () + -Titlelabel.text =titlestring + A at //Do any additional setup after loading the view. - } - - Overridefunc didreceivememorywarning () { - super.didreceivememorywarning () - //Dispose of any resources the can be recreated. in } - to + /* - //MARK:-Navigation the * //In a storyboard-based application, you'll often want to do a little preparation before navigation $ override func Prepareforsegue (segue:uistoryboardsegue!, sender:anyobject!) {Panax Notoginseng //Get The new view controller using Segue.destinationviewcontroller. - //Pass The selected object to the new view controller. the } + */ A the + //opens a new view controller, created by Uitabbarcontroller - @IBAction func creattabbarcontroller () $ { $Self.presentviewcontroller (Self.tabbarctl, animated:true, completion: { - - }) the } - Wuyi //Create code Uitabbarcontroller the @IBAction func usedcodecreattabbarcontroller () - { Wu //defining the 1th View Controller -var itemCtl1 =ItemController1 () About $ //defining the 2nd View Controller -var itemCtl2 =ItemController2 () - - //defining the 3rd View Controller Avar itemCtl3 =ItemController3 () + the //Defining the 4th View Controller -var itemCtl4 =ItemController4 () $ the the //define Uitabbarcontroller the thevar newtabbarctl =Uitabbarcontroller () - in //Add a view to manage 4 the Newtabbarctl.addchildviewcontroller (ITEMCTL1) the Newtabbarctl.addchildviewcontroller (ITEMCTL2) About Newtabbarctl.addchildviewcontroller (ITEMCTL3) the Newtabbarctl.addchildviewcontroller (ITEMCTL4) the the //Alternatively, you can set it together by using the Setviewcontrollers method +Newtabbarctl.setviewcontrollers ([Itemctl1,itemctl2,itemctl3,itemctl4], animated:true) - the Bayi //Create 4 instances of Uitabbaritem thevar barItem1 = Uitabbaritem (title:"Red", Image:nil, Tag: One) thevar barItem2 = Uitabbaritem (title:"Green", Image:nil, Tag: A) -var barItem3 = Uitabbaritem (title:"Blue", Image:nil, Tag: -) -var barItem4 = Uitabbaritem (title:"Orange Color", Image:nil, Tag: -) the the //Reset the Tabbaritem of 4 controls theItemctl1.tabbaritem =barItem1 theItemctl2.tabbaritem =barItem2 -Itemctl3.tabbaritem =barItem3 theItemctl4.tabbaritem =BARITEM4 the the 94 //launched Uitabbarcontroller theSelf.presentviewcontroller (Newtabbarctl, animated:true, completion: { the the })98 } About}
iOS Development--ui Article Swift &uitabbarcontroller