-
Notifications
You must be signed in to change notification settings - Fork 421
CANavigationController
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.
CAViewController,CANavigationBarDelegate
Access modifier |
Attribute name |
Description |
protected |
NavigationBarHidden |
Whether to hide navigationBar |
protected |
NavigationBar |
Current NavigationBar |
protected |
NavigationBarVerticalAlignment |
NavigationBar position |
Access modifier |
Method name |
Description |
public |
initWithRootViewController |
Use a viewController to build CANavigationController |
public |
pushViewController |
Push the new viewController into stack |
public |
popViewControllerAnimated |
Remove ViewController from stack top |
public |
replaceViewController |
Replace viewController |
public |
setNavigationBarHidden |
Set whether to hide navigationBar |
public |
updateItem |
Update navigationBarItem |
NavigationBarHidden
Type: bool
Description: read-only attribute, return a bool value to judge navigationBar is hidden or not.
NavigationBar
Type: VANavigationBar*
Description: read-only attribute, used to identify navigationBar of current CANavigationContrller, and obtain via getNavigationBar method.
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.
1 2 3 4 5 |
typedef enum { CABarVerticalAlignmentTop = 0, CABarVerticalAlignmentBottom }CABarVerticalAlignment; |
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 |
void pushViewController(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*
Description: remove CAViewController from stack top and display the former one, and play switching animation when animated is true and obtain the removed CAViewController.
void replaceViewController(CAViewController viewController, bool animated)*
Return value: void
Parameter:
Type |
Parameter name |
Description |
CAViewController* |
viewController |
viewController that needs to replace |
CABarVerticalAlignment |
Var |
Play switching animation or not |
void setNavigationBarHidden(bool hidden, bool animated)
Return value: void
Parameter:
Type |
Parameter name |
Description |
Bool |
Hidden |
Hide or not |
Bool |
Animated |
Whether to play hidden animation |
void updateItem(CAViewController viewController)*
Return value: void
Parameter:
Type |
Parameter name |
Description |
CAViewController* |
viewController |
View controller that need to update |