iOS Development--ui Article Swift &uitabbarcontroller

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.