Skip to content

CANavigationController

9miao edited this page Sep 29, 2014 · 2 revisions

CANavigationController

Class Description

Same with CATabBarController, CANavigationController is also in charge of coordinating the management among multi CAViewControllers, but their difference is that viewControllers are at the same level in the management of tabBarController, and they are in a stack relationship in the management of navigationController. What the stack relationship means is that every time you add view system will run a push operation, and run a pop operation for every time return.

Base Class

CAViewController,CANavigationBarDelegate

Attribute

Access Modifier

Attribute name

Description

protected

NavigationBarHidden

Whether to hide navigationBar

protected

NavigationBar

Obtain navigationBar that is created in navigationController

protected

NavigationBarVerticalAlignment

NavigationBar’s vertical position

 

Method

Access Modifier

Method Name

Description

public

initWithRootViewController

Use a viewController to build CANavigationController

public

 

replaceViewController

Replace viewController

public

pushViewController

Push the new viewController into stack top

public

popViewControllerAnimated

Remove ViewController from stack top

public

getViewControllerAtIndex

Obtain viewController via index value

public

getBackViewController

Obtain the last viewController

 

public

getViewControllerCount

Obtain viewController count

 

public

updateItem

 

Update navigationBarItem

Attribute Description

NavigationBarHidden
Type: bool
Description: Return a bool value to judge navigationBar is hidden or not, get/set{}.

NavigationBar
Type: CANavigationBar*
Description: read-only attribute, used to identify navigationBar of current CANavigationContrller.

NavigationBarVerticalAlignment
Type: CABarVerticalAlignment
Description: read-only attribute and enumeration type, obtain the navigtionBar’s position of navigationController, the top of screen is the default position.

typedef enum
{
CABarVerticalAlignmentTop = 0,
CABarVerticalAlignmentBottom
}CABarVerticalAlignment;

Method Description

bool initWithRootViewController(CAViewController viewController,CABarVerticalAlignment var = CABarVerticalAlignmentTop)*
Return value: bool
Parameter:

Type

Parameter name

Description

CAViewController*

viewController

Use to build viewController of navigationController

CABarVerticalAlignment

var

Selectable parameter and navigationBar’s position

Description: if system does not transfer var parameter, then navigationBar’s position is at the top of screen by default.

void replaceViewController(CAViewController viewController, bool animated)*
Return value: void
Description: push the new viewController into stack as current displayed viewController, and judge to play switching animation or not according to the animated value that we set before.

CAViewController popViewControllerAnimated(bool animated)*
Return value: CAViewController*
Parameter:

Type

Parameter Name

Description

bool

animated

Play hided animation or not

Description: remove CAViewController from stack top and display the former one

CAViewController getViewControllerAtIndex(int index)*
Return value: CAViewController*
Parameter:

Type

Parameter Name

Decription

int

index

viewController’s index value

CAViewController getBackViewController()*
Return value: CAViewController*
Description: return the last viewController of current viewController array

inline unsigned long getViewControllerCount()
Return value: unsigned long
Description: return viewController counts that were pushed in navigationController.

void updateItem(CAViewController viewController)*
Return value: void
Parameter:

Type

Parameter Name

Description

CAViewController*

viewController

viewController that needs to be updated

Clone this wiki locally