Original blog, please indicate the source for reprinting
http://blog.csdn.net/hello_hwc?viewmode=contents
Welcome to follow my iOS SDK detailed interpretation column
http://blog.csdn.net/column/details/huangwenchen-ios-sdk.html
Foreword: UITABBARController and UinaVIGATIONTROLler are navigation mode for most apps. The UITABBAR of UITABBARController is the UI part of its presentation to users, so it is important to understand its attributes and how to customize it. This article imitatesSina WeiboWrite a simple tabbar. Interested students can download it to see. I will briefly mention the realization of DEMO in the end of this article.
demo effect (icon text is written casually)
static map
The specific code of
Demo will not be explained. If you are interested, you will know what’s going on after downloading it. Moreover, my resources can be lowered without points.
download link
http://download.csdn.net/detail/hello_hwc/9068705
UITABBAR commonly used attributes
tintColor// Define the color selection color of tabbaritems
For example, set to red
How related attributes related to Image
backgroundImage
Set the background picture of UITABBAR, for example, set the background picture of the initial DEMO at the beginning of the above
shadowImage // Shadow Picture
selectionIndicatorImage // Tabbar after Select Planting, then pictures below Baritem.
translucent // Whether transparent
Uibaritem several common properties
image/selectedImage // Picture, and the selected picture
For example, in my demo, the Item in the middle sets the following settings
Guaranteed how to click and use the pictures I want
item.image = [midImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
item.selectedImage = [midImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
adjustment of the position of Title and icon
titlePositionAdjustment/imageInsets
For example, in my demo, there is a big picture in the middle. If there is no title, you need to adjust the position of the icon
item.imageInsets = UIEdgeInsetsMake(5.0, 0, -5.0, 0);
Before adjustment
Set font style
setTitleTextAttributes:forState:
For example, use the following code to set the font to blue
[item setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blueColor]} forState:UIControlStateNormal];
Comparison before and after setting
demo explanation
- 糊 糊 糊 Using UIVISUALEFFECTVIEW
- Animation I tried Keyframe, UISNAPBEHAVIOUR, and the code in Demo, and found that it was a clearer in demo.
- Use tag to pass the number of icons to be clicked