CADrawerController(抽屉控制器)

类说明

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

基类

CAViewController

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

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

创建与初始

bool RootWindow::init()
{
    if (!CAWindow::init())
    {
        return false;
    }
     
    //创建左边的ViewController
    LeftViewController* left = LeftViewController::create();
     
    //创建右边边的ViewController
    RightViewController* right = RightViewController::create();
    CADrawerController* drawerController = new CADrawerController();
     
    //最后参数是左边ViewController露出的尺寸
    drawerController->initWithController(left, right, _px(500));
     
    //必须加上背景,不然只能滑动一次
    drawerController->setBackgroundView(CAView::create());
    this->setRootViewController(drawerController);
     
    //释放内存
    drawerController->autorelease();
    return true;
}


管理

显示与隐藏

   /*
    *显示左边的viewController
    *animated:是否显示动画
    */
    void showLeftViewController(bool animated);
     
    /*
    *隐藏左边的viewController
    *animated:是否显示动画
    */

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

参数:

解释:左边是否在显示

作者:andy,如若转载,请注明出处:https://www.web176.com/crossapp/10171.html

(0)
打赏 支付宝 支付宝 微信 微信
andy的头像andy
上一篇 2023年2月21日
下一篇 2023年2月21日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注