<span id="Label3"></p><p><p>See the iOS9 will be Out. The uitabbarcontroller of the system that was recently used for the project is the problem that Mark has Encountered.</p></p><p><p>The default Uitabbarcontroller of the system can be set using Storyboard.</p></p><p><p>The following is mainly about the code settings Tabbar pictures and Colors.</p></p><p><p>1.tabbar background color or background image (gray Effect)</p></p><p><p></p></p><pre><pre> TabBarController.tabBar.backgroundImage = [UIImage imagenamed:<span style="color: #800000;">@ "</span><span style="color: #800000;">tabbar_unselected</span><span style="color: #800000;">"</span>];</pre></pre><p><p>This image can be a thin line with a width of 2 pixels and a height of 98.</p></p><p><p>2. Set the background color or background image of the selected item (, blue Effect)</p></p><p><p></p></p><pre><pre> uiimage* selectedimage = [UIImage imagenamed:<span style="color: #800000;">@ "</span><span style="color: #800000;">tabbar_select</span><span style="color: #800000;">"</span><span style="color: #000000;">]; </span> =<span style="color: #000000;"> [selectedimage resizableimagewithcapinsets:uiedgeinsetszero]; </span> = selectedimage;</pre></pre><p><p>The picture here can also be the same as the background image above, can be a width of 2 pixels, a high 98 of a thin LINE.</p></p><p><p><span style="color: #ff0000;">SelectedImage = [selectedimage resizableimagewithcapinsets:uiedgeinsetszero];</span></p></p><p><p><span style="color: #ff0000;">To fill the image you want to set with a thin line chart</span></p></p><p><p>3. Set picture color and font color and size</p></p><pre><pre> Nsmutabledictionary *textattrs=<span style="color: #000000;">[nsmutabledictionary dictionary]; textattrs[nsforegroundcolorattributename]</span>=<span style="color: #000000;">[uicolor whitecolor]; </span> = [uifont systemfontofsize:<span style="color: #800080;"></span>. f];<br><br>Mlnavigationcontroller * Onecontroller = [[mlnavigationcontroller alloc] initwithrootviewcontroller:vc1];<br>OneController.tabBarItem.title = @ "home";<br>OneController.tabBarItem.image = [[UIImage imagenamed:@ "tabbar_home"] imagewithrenderingmode: uiimagerenderingmodealwaysoriginal];<br>OneController.tabBarItem.selectedImage = [[UIImage imagenamed:@ "tabbar_home"] imagewithrenderingmode: uiimagerenderingmodealwaysoriginal];<br>[onecontroller.tabbaritem Settitletextattributes:textattrs forstate:uicontrolstatenormal];</pre></pre><p><p>My requirement is to set the picture and color to be white in both selected and unchecked States.</p></p><p><p>3.1 Font Color settings</p></p><p><p>The key value of the dictionary <span style="color: #000000;">textattrs</span> can be set by double-clicking to view the options you want to set, note here</p></p><p><p><span style="color: #ff0000;">-(void) settitletextattributes: (nsdictionary *) attributes forstate: (uicontrolstate) State Ns_available_ios (5_0) UI_ appearance_selector;</span></p></p><p><p>This method state can only be set uicontrolstatenormal,uicontrolstateselected,uicontrolstatedisabled three type</p></p><p><p>3.2 Picture Color settings</p></p><p><p>Picture you'll find a way to use an image</p></p><p><p><span style="color: #ff0000;">-(UIImage *) imagewithrenderingmode: (uiimagerenderingmode) renderingmode ns_available_ios (7_0);</span></p></p><p><p>This method is to tell the system to cancel rendering, using the original image Color.</p></p><p><p>This allows you to set the SelectedImage and image you Provided.</p></p><pre><pre><span style="color: #000000;">OneController.tabBarItem.image = [[UIImage imagenamed:@ "tabbar_home"] imagewithrenderingmode: uiimagerenderingmodealwaysoriginal];</span><br><span style="color: #000000;">OneController.tabBarItem.selectedImage = [[UIImage imagenamed:@ "tabbar_home"] imagewithrenderingmode: uiimagerenderingmodealwaysoriginal];</span></pre></pre><p><p>About the ios7-8 system Uitabbarcontroller</p></p></span>
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