-
Notifications
You must be signed in to change notification settings - Fork 421
CATabBar
CATabBar is functionality selection view control, subordinates to tabBarController. Generally tabBar does not work alone but acts as a built-in control of CATabBarController and is controlled by it. We usually does not need to set tabBar’s frame, program will automatically adapt frame on different devices according to tabBar’s default value.
CAView
Access modifier |
Attribute name |
Description |
protected |
BackGroundImage |
tabBar’s background image |
protected |
BackGroundView |
tabBar’s background view |
protected |
SelectedBackGroundImage |
background image when sub item is selected |
protected |
SelectedBackGroundView |
background view when sub item is selected |
protected |
SelectedIndicatorImage |
indicator image when sub item is selected |
protected |
SelectedIndicatorView |
indicator view when sub item is selected |
protected |
MaxShowCount |
max display sub item count of tabBar |
protected |
Delegate |
Delegate |
protected |
TitleColorForNormal |
title color in normal status |
protected |
TitleColorForSelected |
title color in selected status |
protected |
Items |
sub item array |
protected |
SelectedIndex |
selected item’s index value |
Access modifier |
Method name |
Description |
public |
setItems |
build tabBar |
public |
setSelectedAtIndex |
set current displayed sub item |
public |
setForbidSelectedAtIndex |
a certain item selection disabled |
public |
showSelectedIndicator |
display indicator |
public |
replaceItemAtIndex |
replace a certain item |
BackGroundImage
Type: CAImage*
Descripiton: tabBar’s background image, get/set{}.
Example:
tabBarController->getTabBar()->setBackGroundImage(CAImage: : create("ex1. png"));
replace the default blue background of tabBar
BackGroundView
Type: CAView*
Descripiton: tabBar’s background view, it’s able to transfer any view as background, get/set{}.
SelectedBackGroundImage
Type: CAImage*
Descripiton: image when tabBar’s sub item is selected, get/set{}.
Example:
tabBarController->getTabBar()->setSelectedBackGroundImage(CAImage: : create("ex2. png"));
set selected status’s color
SelectedBackGroundView
Type: CAView*
Descripiton: background view when sub item is selected, it’s able to transfer any view as background, get/set{}.
SelectedIndicatorImage
Type: CAImage*
Type: it’s used to display indicator image of the selected sub item, get/set{}.
Example:
tabBarController->getTabBar()->setSelectedIndicatorImage(CAImage: : create("ex4. png"));
tabBarController->getTabBar()->showSelectedIndicator();
SelectedIndicatorView
Type: CAView*
Descripiton: indicator’s view of selected sub item, it’s able to transfer any view as background, get/set{}.
MaxShowCount
Type: unsigned int
Descripiton: max display sub item count of tabBar, get/set{}.
Delegate
Type: CATabBarDelegate*
Descripiton: tabBar delegate
TitleColorForNormal
Type: CAColor4B
Descripiton: tabBarItem title color in normal status, white by default.
Example:
tabBarController->getTabBar()->setTitleColorForNormal(CAColor_magenta);
TitleColorForSelected
Type: CAColor4B
Descripiton: tabBarItem title color in selected status, blue by default.
Items
Type: vector<CATabBarItem*>
Descripiton: read-only property, it’s used to build tabBar’s tabBarItem array.
SelectedIndex
Type: int
Descripiton: read-only property, index value when tabBarItem is selected.
void setItems(const std: : vector<CATabBarItem>& items)*
Return value: void
Parameter:
Type |
Parameter name |
Description |
vector<CATabBarItem*>& |
item |
it’s used to build tabBar’s array |
void setSelectedAtIndex(int index)
Return value: void
Parameter:
Type |
Parameter name |
Description |
int |
index |
current sub item that is displayed by index value, display item 0 by default. |
`tabBarController->getTabBar()->setSelectedAtIndex(3);`
![](http://www.9miao.com/ueditor/php/upload/image/20140930/1412046182522764.jpg)
void setForbidSelectedAtIndex(int index)
Return value: void
Parameter:
Type |
Parameter name |
Description |
int |
index |
sub item’s index value |
void showSelectedIndicator()
Return value: void
Descripiton: display indicator in selected status, display item 0 by default.
void replaceItemAtIndex(size_t index, CATabBarItem item)*
Return value: void
Parameter:
Type |
Parameter name |
Description |
size_t |
index |
sub item’s index value |
CATabBarItem* |
item |
sub item |