iOS development-use storyboard, Tabbar small icons and text color settings

Source: Internet
Author: User

In the development of the project, if the use of the story version of the design of the architecture, then set the Tabbar small icon, there may be a small problem,

The successful setup methods are as follows:

1. Set Seleectedimage and image, in fact, is a non-selected picture, set the selected is the picture, you can also set the code, as follows:

    Self.tabBarController.tabBar.selectedItem.selectedImage = [UIImage imagenamed:@ "home_selected "];  

2. At this time, you will find that no matter how you do it, only the colors will not display the picture properly, because the Renderingmode property of the picture is not set:

This is an enumeration in which the property values are:

    Uiimagerenderingmodeautomatic  //  adjusts the rendering mode automatically based on the environment in which the picture is used and the drawing context in which it is located.      Uiimagerenderingmodealwaysoriginal   //  always draws the original state of the picture without using tint Color.      Uiimagerenderingmodealwaystemplate   //  always draws a picture based on tint color, ignoring the color information of the picture.  

Set the Renderingmode property of the selected picture and unselected picture to:

 for inch self.tabBar.items) {        = [item.selectedimage imagewithrenderingmode: Uiimagerenderingmodealwaysoriginal];                 = [Item.image imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];         // item.title    }

This will show up properly!

3. Change the color of the text: Click the selected location first

Then in the change, bar tint is set the background color of this tabbar, the following tint can set the color of the desired font

iOS development-use storyboard, Tabbar small icons and text color settings

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.