zoukankan      html  css  js  c++  java
  • 模态

    //模态—block

    #pragma mark - 添加联系人页面跳转

    - (void)cancelBarButtonItemAction:(UIBarButtonItem *)sender

    {

        // 推出的模态视图添加导航控制器

        AddContactViewController *addcontacVC = [[[AddContactViewController alloc] init ] autorelease];

        // 实现block的赋值

        addcontacVC.senderBlock = ^(Contact *c){

            // 当block被调用时候, 内部才会执行

            NSString *key  = [c.name substringToIndex:1];

            // 将数据添加到数组的第一个元素的位置

            [_allDataMutableDict[key] insertObject:c atIndex:0];

            // 获取key的下标 也就是分区的下标

            NSInteger index = [_allKeysMutableArray indexOfObject:key];

            // 创建表示位置的NSIndexPath对象

            NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:index];

           // 更新页面 

            [self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

        };

        UINavigationController *addcontacNC = [[[UINavigationController alloc]initWithRootViewController:addcontacVC]autorelease];

        [self.navigationController presentViewController:addcontacNC animated:YES completion:nil];

    }

    //按钮

    self.loginButton = [UIButton buttonWithType:UIButtonTypeSystem];

        _loginButton.frame = CGRectMake(50, 300, 100, 30);

        [_loginButton setTitle:@"登录" forState:UIControlStateNormal];

        _loginButton.backgroundColor = [UIColor cyanColor];

        [self addSubview:_loginButton];

     // 创建子视图控制器

        ActivityListViewController *activityTVC = [[[ActivityListViewController alloc] initWithStyle:UITableViewStylePlain] autorelease];

     // 设置tabBarItem

        activityTVC.tabBarItem = [[[UITabBarItem alloc] initWithTitle:@"活动" image:[UIImage imageNamed:@"iconfont-hanbao"] selectedImage:nil] autorelease];

     // 使用导航控制器进行包裹

        UINavigationController *activityNC = [[[UINavigationController alloc] initWithRootViewController:activityTVC] autorelease];

     // 添加到标签控制器汇总

        self.viewControllers = @[activityNC];

    …….未完待续....

    我不负责生产代码,我是博客园搬运工~
  • 相关阅读:
    BZOJ2199[Usaco2011 Jan]奶牛议会——2-SAT+tarjan缩点
    BZOJ3862Little Devil I——树链剖分+线段树
    BZOJ2325[ZJOI2011]道馆之战——树链剖分+线段树
    BZOJ1018[SHOI2008]堵塞的交通——线段树
    BZOJ2733[HNOI2012]永无乡——线段树合并+并查集+启发式合并
    BZOJ4127Abs——树链剖分+线段树
    bzoj 4753 最佳团体
    bzoj 4472 salesman
    bzoj 5369 最大前缀和
    bzoj 1226 学校食堂Dining
  • 原文地址:https://www.cnblogs.com/masami521/p/4726137.html
Copyright © 2011-2022 走看看