• 关于UITabView和UIAlertController,UIAlertAction以及UINavigation,值修改的传递
  • 集合嵌套集合的操作


  • 声明


  • 两个必须的的代理
  • 实现部分代码

- (void)viewDidLoad

{

[super viewDidLoad];

// 创建一个TabView

self.tabv = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];

self.tabv.separatorColor = [UIColor blackColor];

self.tabv.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"44W58PICRtX_1024.jpg"]];

// 获取数据源

self.arriOSclass = [NSMutableArray array];

self.arriOSclass = [NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"iOS_class" ofType:@"plist"]];

// 指定代理和数据源

self.tabv.delegate = self;

self.tabv.dataSource = self;

// 指定重用单元格的唯一标识:UITableView的唯一标识注册UITableViewCell

// - 重用cell而不是本身

[self.tabv registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];

// 添加到主视图

self.navigationItem.title = @"iOS_class";

[self.view addSubview:self.tabv];

}

// 实现协议方法

// 确定显示的数量(数据源必须实现_1)

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

// 选中集合

return [self.arriOSclass[section] count];

}

// 获取显示的内容(数据源必须实现_2)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

// 重用机制:单元格容量固定,仅仅是更换内容(队列)

// 存储一个唯一标识

static NSString *cellIdentity = @"cell";

// 根据tableView的唯一标识和数据分配UITableViewCell

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentity forIndexPath:indexPath];

// 在UITableViewCell内显示UITableView对应下标内容

// 使用简写

//    cell.textLabel.text = [[self.arriOSclass objectAtIndex:indexPath.section]objectAtIndex:indexPath.row];

// 选中部分是一个集合,它的row才是字符串

cell.textLabel.text = self.arriOSclass[indexPath.section][indexPath.row];

return cell;

}

// 代理方法:为数据分组(TabView的style为group)

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{

return self.arriOSclass.count;

}

// 为分组命名

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

{

return [NSString stringWithFormat:@"第%lu组", section+1];

}

// 为选中数据添加弹窗

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

// 先选择部分(下标)再选择个体(下标)

NSString *info = self.arriOSclass[indexPath.section][indexPath.row]

;

// 创建弹窗

UIAlertController *alertC = [UIAlertController alertControllerWithTitle:info message:@"确认修改吗" preferredStyle:UIAlertControllerStyleAlert];

// 添加确认动作

UIAlertAction *alercAOK = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action)

{

// 推送到下一页修改值

PPViewController *ppVc = [PPViewController new];

[self.navigationController pushViewController:ppVc animated:YES];

// 没有切换效果?(模态视图具有)

ppVc.modalTransitionStyle = UIModalTransitionStylePartialCurl;

// 传递数据源中需要修改的索引过去

ppVc.name = info;

// 修改后返回该值:选择block进行操作

ppVc.ppblock = ^(NSString *name)

{

// 方法的回调:这个方法实际是在第二页面修改后才会调用该block

// 修改数组的地址

self.arriOSclass[indexPath.section][indexPath.row] = name;

// 修改后刷新数据返回时才能正常显示

[self.tabv reloadData];

};

}];

// 添加取消动作

UIAlertAction *alertACancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDestructive handler:nil];

// 动作添加到UIAlertController

[alertC addAction:alercAOK];

[alertC addAction:alertACancel];

// UIAlertController添加到当前控制器:即self

[self presentViewController:alertC animated:YES completion:nil];

}


  • 传值详细解释


  • 传值页面的声明

  • 传值也面的实现

iOS关于UITabView和UIAlertController,UIAlertAction以及UINavigation,值修改的传递页面推送的更多相关文章

  1. IOS 在不打开电话服务的时候,可以响应服务器的推送消息,从而接收服务器的推送消息

    在做即时通讯(基于xmpp框架)的时候遇到这样一个问题,就是在真机测试的时候,你按Home键返回桌面,在你返回桌面的时候,这是你的程序的挂起状态的,在你挂起的时候, 相当于你的程序是死的,程序的所有进 ...

  2. IOS引导页拨动4张图片最后一张停三秒进入主页,页面推送

    // //  ViewController.m // // //  Created by 张艳锋 on 15/8/26. //  Copyright (c) 2015年 张艳锋. All rights ...

  3. iOS 推送全解析

    本文旨在对 iOS 推送(以下简称 推送)进行一个完整的剖析,如果你之前对推送一无所知,那么在你认真地阅读了全文后必将变成一个推送老手,你将会对其中的各种细节和原理有充分的理解.以下是 pikacod ...

  4. ThinkPHP 使用极光推送给ios推送消息

    HTML <div id="wrap"><a href="<{:U('Push/pushData')}>">推送</a ...

  5. (iOS)推送常见问题

    1.为什么启动的时候出现 Did Fail To Register For Remote Notifications With Error的错误程序运行的时候出现下面的错误信息: did Fail T ...

  6. 玩转 iOS 10 推送 —— UserNotifications Framework(合集)

    iOS 10 came 在今年 6月14号 苹果开发者大会 WWDC 2016 之后,笔者赶紧就去 apple 的开发者网站下载了最新的 Xcode 8 beta 和 iOS 10 beta,然后在自 ...

  7. ios 推送app badge 数字累加操作

    ios 推送app badge 数字累加操作: 一:此数字需要后台配合: 二:大致原理: 后台发推送时,第一次 传badge 为1,往后,依次累加操作即可: 当用户打开app时,app向后台发送请求, ...

  8. ios -- 极光推送《1》

    昨天公司项目要加入远程推送功能,自己做显然会很麻烦,所以用了极光的远程推送,下面我会讲如何制作推送证书并使用极光推送进行远程推送. 先讲讲怎么下载推送证书吧(前面的很简单要是知道的可以直接往下滑,简书 ...

  9. (转)OpenFire源码学习之十八:IOS离线推送

    转:http://blog.csdn.net/huwenfeng_2011/article/details/43458213 IOS离线推送 场景: 如果您有iOS端的APP,在会话聊天的时候,用户登 ...

随机推荐

  1. Inno Setup入门(十四)——替换安装程序和卸载程序的图标

    通常Inno生成的安装文件的图标是一个光盘和显示器,如下图.同时,程序安装好之后,在安装目录下的卸载程序的图标也是一样的,其实我们也可以自己修改. 首先生成的安装文件图标.这个比较简单,只需要在Set ...

  2. replication across two data centers

    http://andyhan.net/index.php/sys-adm/item/291-hbase-replication http://shitouer.cn/2013/04/hbase-mul ...

  3. zf-分页后台代码

    java : public ResultPage getDeptList(int page, int pageRows) throws Exception { String hql="fro ...

  4. Java中的设计模式

    1 单例模式和多例模式 一.单例模式和多例模式说明:1.         单例模式和多例模式属于对象模式.2.         单例模式的对象在整个系统中只有一份,多例模式可以有多个实例.(单例只会创 ...

  5. 1.1 整理的Linux 基础

    本文总参照:http://blog.csdn.net/xiaoguaihai/article/details/8705992/ 2.用户管理操作命令 (1)Su - XX 切换用户 3.文件管理操作命 ...

  6. CodeForces 429B Working out 动态规划

    Description Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to loo ...

  7. aX+bY+cZ=n(非负整数解存在性)

    题意: a*1234567+b*123456+c*1234=n 非负整数解得存在性. 题解: 看代码. #include<iostream> #include<cstdio> ...

  8. HDU2199,HDU2899,HDU1969,HDU2141--(简单二分)

    二分是一种很有效的减少时间开销的策略, 我觉得单列出二分专题有些不太合理, 二分应该作为一中优化方法来考虑 这几道题都是简单的使用了二分方法优化, 二分虽然看似很简单, 但一不注意就会犯错. 在写二分 ...

  9. java 对象的上转型对象(父类)

    Example5_10.java class 类人猿 { void crySpeak(String s) { System.out.println(s); } } class People exten ...

  10. C#实现http断点下载

    我们寄希望于万能的解决方案,但是现实的情况总是很糟糕.在软件编程的世界中,技术分散的情况尤为严重,且不说各种语言拥有的优势不能融合,单就一门语言而言,就拥有众多的技术和相关技术需要学习.网络编程就是这 ...