-

类说明

CADrawerController是易用的侧边抽屉式导航控制器。


基类

CAViewController


CADrawerController 方法(点击查看方法介绍)

方法说明
initWithController初始化
getLeftViewController获得左边的ViewController
getRightViewController获得右边的ViewController
showLeftViewController显示左边的viewController
hideLeftViewController隐藏左边的viewController
isShowLeftViewController左边是否在显示


创建与初始

  1. bool RootWindow::init()
  2. {
  3. if (!CAWindow::init())
  4. {
  5. return false;
  6. }
  7. //创建左边的ViewController
  8. LeftViewController* left = LeftViewController::create();
  9. //创建右边边的ViewController
  10. RightViewController* right = RightViewController::create();
  11. CADrawerController* drawerController = new CADrawerController();
  12. //最后参数是左边ViewController露出的尺寸
  13. drawerController->initWithController(left, right, _px(500));
  14. //必须加上背景,不然只能滑动一次
  15. drawerController->setBackgroundView(CAView::create());
  16. this->setRootViewController(drawerController);
  17. //释放内存
  18. drawerController->autorelease();
  19. return true;
  20. }


管理

显示与隐藏

  1. /*
  2. *显示左边的viewController
  3. *animated:是否显示动画
  4. */
  5. void showLeftViewController(bool animated);
  6. /*
  7. *隐藏左边的viewController
  8. *animated:是否显示动画
  9. */


CADrawerController 方法

virtual bool initWithController(CAViewController* leftViewController,CAViewController* rightViewController,float division);

返回值:bool

参数:

类型参数名说明
CAViewController*leftViewController左边
CAViewControllerrightViewController右边
floatdivision左边露出的尺寸

解释:初始化


CAViewController* getLeftViewController();

返回值:CAViewController*

参数:

解释:获得左边的ViewController


CAViewController* getRightViewController();

返回值:CAViewController*

参数:

解释:获得右边的ViewController


void showLeftViewController(bool animated);

返回值:void

参数:

类型参数名说明
boolanimated是否显示动画

解释:显示左边的viewController


       

void hideLeftViewController(bool animated);

返回值:void

参数:

类型参数名说明
boolanimated是否显示动画

解释:隐藏左边的viewController


bool isShowLeftViewController();

返回值:bool

参数:

解释:左边是否在显示