iOS Development--ui advanced article (13) uitabbarcontroller simple use, QQ Mainstream framework

Source: Internet
Author: User
<span id="Label3"></p><p><p>first, Uitabbarcontroller Simple Use</p></p><pre><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Program Loading Complete</span></span>-(BOOL) application: (uiapplication *) application didfinishlaunchingwithoptions: (nsdictionary *<span style="color: #000000;"><span style="color: #000000;">) launchoptions {</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Create Window</span></span>Self.window =<span style="color: #000000;"><span style="color: #000000;">[[uiwindow alloc] Initwithframe:[uiscreen mainscreen].bounds]; </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">setting the root controller of a window</span></span>Uitabbarcontroller *TABBARVC =<span style="color: #000000;"><span style="color: #000000;">[[uitabbarcontroller alloc] init]; Self.window.rootViewController</span></span>=<span style="color: #000000;"><span style="color: #000000;">tabbarvc; </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">1. Add a 1th sub-controller</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">The default TABBARVC shows the view of the No. 0 Sub-controller</span></span>Uiviewcontroller *VC =<span style="color: #000000;"><span style="color: #000000;">[[uiviewcontroller alloc] init]; Vc.view.backgroundColor</span></span>=<span style="color: #000000;"><span style="color: #000000;">[uicolor redcolor]; </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">set the caption of the corresponding button for this controller</span></span>Vc.tabBarItem.title =<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">message</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">; </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;">the <span style="color: #008000;">No. 0 button is selected by default on the Tabbar controller</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">by default, The selected button image on Uitabbar is rendered blue after iOS7</span> .</span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">set the picture of the Controller's corresponding button</span></span>Vc.tabBarItem.image = [UIImage imagenamed:<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">Tab_recent_nor</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">]; </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Set Reminder Numbers</span></span>Vc.tabBarItem.badgeValue =<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;"></span> +</span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">; [TABBARVC addchildviewcontroller:vc]; </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">2. Add a 2nd Sub-controller</span></span>Uiviewcontroller *VC1 =<span style="color: #000000;"><span style="color: #000000;">[[uiviewcontroller alloc] init]; Vc1.view.backgroundColor</span></span>=<span style="color: #000000;"><span style="color: #000000;">[uicolor bluecolor]; Vc1.tabBarItem.title</span></span>=<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">Contact Person</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">; Vc1.tabBarItem.image</span></span>= [UIImage Imagenamed:<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">Tab_buddy_nor</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">]; [TABBARVC addchildviewcontroller:vc1]; </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">3. Add a 3rd Sub-controller</span></span>Uiviewcontroller *VC2 =<span style="color: #000000;"><span style="color: #000000;">[[uiviewcontroller alloc] init]; Vc2.view.backgroundColor</span></span>=<span style="color: #000000;"><span style="color: #000000;">[uicolor greencolor]; Vc2.tabBarItem.badgeValue</span></span>=<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">Ten</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">; [TABBARVC addchildviewcontroller:vc2]; </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">Display window</span></span><span style="color: #000000;"><span style="color: #000000;">[self.window makekeyandvisible]; </span></span><span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;"><span style="color: #000000;">YES;}</span></span></pre><p><p></p></p><p><p>second, QQ Mainstream Framework<br>To make each of the Uitabbarcontroller's Sub-controller navigation bars appear different<br>To set the Window's root controller to Uitabbarcontroller</p></p><p><p></p></p><p><p></p></p><p><p>Storyboard</p></p><p><p></p></p><p><p>iOS Development--ui advanced article (13) uitabbarcontroller simple use, QQ Mainstream framework</p></p></span>

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.