zoukankan      html  css  js  c++  java
  • IIViewDeckController的使用,左右拖拉菜单效果实现

    博客园

     

    IIViewDeckController的使用,左右拖拉菜单效果实现

     
    很多应用里面都实现了对应的侧拉 显示隐藏的效果,看起来很符合用户体验的类似于这种
     
    看起来很好看,今天去晚上搜下开源库,还是挺好用的,分享下
     
    1.首先创建一个空工程,这里不在细说了...
    1. 导入这两个类
    .
    1.  在appdalegate里面,:

       self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

        MainViewController* main = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];

        LeftViewController* left = [[LeftViewController alloc] initWithNibName:@"LeftViewController" bundle:nil];

        RightViewController* right = [[RightViewController alloc] initWithNibName:@"RightViewController" bundle:nil];

        self.deckView = [[IIViewDeckController alloc] initWithCenterViewController:main leftViewController:left rightViewController:right];

       

        deckView.centerhiddenInteractivity = IIViewDeckCenterHiddenNotUserInteractiveWithTapToClose;

        deckView.leftLedge = 60;

        deckView.rightLedge = 60;

        self.window.rootViewController = deckView;

    这样就能把中间视图,左右视图加载成功了
     
    1. 比如说在主视图里面或许你想整个按钮,点击的时间也实现左右滚动效果,这里有个小技巧
    2. 比如我们想在MainViewController里面增加一个点击按钮
     
     
    这样的效果,
    这个地方,首先我要在AppDelegate 里面声明

    @property (strong,nonatomic) IIViewDeckController* deckView;

    然后在MainViewController的对应的button事件下面这样写
     

    - (IBAction)left:(id)sender {

        AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;

        [appDelegate.deckView toggleLeftViewAnimated:YES];

    }

    OK 调用成功,QQ 音乐,什么里面都是这样的效果,看起来很好看的样子,分享下
     
     
     
  • 相关阅读:
    死锁程序示例
    用Intellij打可执行jar包
    Semaphore tryAcquire release 正确的使用方法
    计算对象占用空间工具类
    mysql高效分页方案及原理
    乐视秒杀:每秒十万笔交易的数据架构解读
    mysql 联合索引(转)
    mysql中in和exists二者的区别和性能影响
    怎样避免 i f 判断过多,全复杂度较高,代码不美观的问题?
    Java中Enum类型的序列化(转)
  • 原文地址:https://www.cnblogs.com/ccguo/p/3393028.html
Copyright © 2011-2022 走看看