Skip to content
9miao edited this page Sep 30, 2014 · 2 revisions

CANavigationBar

Class Description

NavigationBar control that is subordinated to CANavigationController. Generally CANavigationBar does not work alone but controlled by navigationController to implement App hierarchical structure.

Effect Picture


Base Class

CAView

Attribute

Access modifier

Attribute name

Description

protected

BackGroundImage

background image

protected

TitleColor

title color

protected

ButtonColor

button color

protected

Delegate

Delegate

protected

Items

sub item array

Method

Access modifier

Method name

Description

public

create

create a navigationBar

 

public

pushItem

Push navigationBarItem into stack

 

public

popitem

Act pop stack operation on navigationBarItem

public

init

initialization

 

public

 

replaceItemAtIndex

replace navigationBarItem according to index value

Attribute Description

BackGroundImage
Type: CAImage*
Descripiton: set navigationBar’s background image
Example:
navigationController->getNavigationBar()->setBackGroundImage(CAImage: : create("ex1. png"));

TitleColor
Type: CAColor4B
Descripiton: title color

ButtonColor
Type: CAColor4B
Descripiton: button color on navigation bar

Delegate
Type: CANavigationBarDelegate*
Descripiton: navigationBar’s delegate

Items
Type: vector<CANavigationBarItem*>
Descripiton: array that stores navigationBarItem

Method Description

static CANavigationBar create()*
Return value: CANavigation*

void pushItem(CANavigationBarItem item)*
Return value: void
Parameter:

Type

Parameter name

Description

CANavigationBarItem*

item

navigationBar’s sub item

Descripiton: navigationBar use a stack to save its subitem, and system will run a push stack operation for every time subitem adding. When stack element number is greater than 1, system will auto create a back button and call popItem method to return upper layer for every time push stack.

void popItem()
Return value: void
Descripiton: remove navigationBarItem from stack top via push stack operation.

virtual bool init()
Return value: bool
Descripiton: Internal calls by default in create method and initialize navigationBar.

void replaceItemAtIndex(size_t index, CANavigationBarItem item)*
Return value: void
Parameter:

Type

Parameter name

Description

size_t

index

frame index

CANavigationBarItem*

item

sub item

Clone this wiki locally