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];

    …….未完待续....

    我不负责生产代码,我是博客园搬运工~
  • 相关阅读:
    简单poi创建execl
    Orcale 存储过程实践总结
    PLSQL 创建自定义函数注意事项
    字符串算法模板整理
    多项式FFT/NTT模板(含乘法/逆元/log/exp/求导/积分/快速幂)
    UVALive
    Gym
    Gym
    Kattis
    Kattis
  • 原文地址:https://www.cnblogs.com/masami521/p/4726137.html
Copyright © 2011-2022 走看看