zoukankan      html  css  js  c++  java
  • 类似于Facebook客户端的半侧滑菜单栏的实现

        在网上找了很久,终于找到了一个好的实现方法,用到了开源类(在附件上),下面详细说一下使用开源类的配置与实现:

         

        在首页的viewController的viewDidload方法中

        1.把开源类控制器设置成根视图控制器:

        AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;

        SWRevealViewController *revealController = (SWRevealViewController *)delegate.window.rootViewController;

       2.设置视图左上角的菜单按钮:

        UIImage *img_menu = [UIImage imageNamed:first_icon];

        UIButton *btn_menu = [UIButtonbuttonWithType:UIButtonTypeCustom];

        btn_menu.frame = CGRectMake(frame.origin.x + 10, frame.origin.y+20, 40, 40);

        [btn_menu setImage:img_menu forState:UIControlStateNormal];

        [self.view addSubview:btn_menu];

        3.设置菜单按钮点击事件,即打开隐藏菜单:

        [btn_menu addTarget:revealController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchUpInside];

        4.添加页面滑动事件,即打开隐藏菜单:

        [self.view addGestureRecognizer:revealController.panGestureRecognizer];

        5.在开源类库中的实现文件- (void)_initDefaultProperties方法中可以修改相关参数,比如半侧滑栏的宽度。

        6.效果图如下

    开源类库和我做的简单的demo实现在网盘:http://yun.baidu.com/share/link?shareid=4254976037&uk=3793932076

  • 相关阅读:
    non-blocking I/O
    jetty netty
    Azkaban_Oozie_action
    权限过大 ssh协议通过pem文件登陆
    交易准实时预警 kafka topic 主题 异常交易主题 低延迟 event topic alert topic 内存 算法测试
    flink_action
    netty
    1970 ted codd
    Data dictionary
    mina
  • 原文地址:https://www.cnblogs.com/xiaoyouzi/p/3428827.html
Copyright © 2011-2022 走看看