IOS UI 第十一篇: UITABLEVIEW
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
UIView *testView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 140, 42)];
testView.backgroundColor = [UIColor redColor];
[self.contentView addSubview:testView];
mylabel = [[UILabel alloc] initWithFrame:CGRectMake(200, 10, 100, 30)];
mylabel.text = @"cell";
mylabel.backgroundColor = [UIColor blueColor];
[testView addSubview:mylabel];
//self view
UIView *sView = [[UIView alloc] initWithFrame:self.frame];
sView.backgroundColor = [UIColor orangeColor];
self.selectedBackgroundView = sView;
//Highlight 's view
}
return self;
}
{
[super viewDidLoad];
mytableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 20, 320, 480) style:UITableViewStylePlain];
dataArray = [NSMutableArray array];
for (int i=0; i<10; ++i) {
NSMutableArray *groupArray = [NSMutableArray array];
for (int j=0; j<10; ++j) {
NSString *str = [NSString stringWithFormat:@"%d group %d row", i, j];
[groupArray addObject:str];
}
[dataArray addObject:groupArray];
}
mytableView.delegate = self;
mytableView.dataSource = self;
[self.view addSubview:mytableView];
[mytableView registerNib:[UINib nibWithNibName:@"cell" bundle:nil] forCellReuseIdentifier:@"xibCell"];
// Do any additional setup after loading the view from its nib.
}
/*
static NSString *reuse = @"reuseid";
TableViewCell *cell = [tableView dequeueReusableHeaderFooterViewWithIdentifier:reuse];
if (cell == nil) {
cell = [[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuse];
}
NSString *str = dataArray[indexPath.section][indexPath.row];
cell.textLabel.text = str;
[cell changeMyLabel:[NSString stringWithFormat:@"%d", indexPath.row]];
*/
UITableViewCell *cell = [mytableView dequeueReusableCellWithIdentifier:@"xibCell"];
return cell;
}
M model 数据模型 储存数据
V view 视图模型 用来显示界面
C controller 控制器 用来联系 M 和 V
数据模型,就是用于储存数据,你将项储存的数据传入,数据模型,负责解析,并按照自己的数据结构储存。
视图模型,就是用于显示并刷新界面,你仅需要将想要显示的数据传入即可,视图模型在内部将你的数据,按照自己的格式显示。
控制器,就是负责逻辑,既不要干涉数据模型的内容,要不要干涉视图模型的显示。


NSLog(@"date1 : %@", date1);
NSDate *date2 = [NSDate dateWithTimeIntervalSinceNow:600];
NSLog(@"date2 : %@", date2);
//print apple time.
time_t nowTime;
time(&nowTime);
NSLog(@"seconds from 1970 : %ld", nowTime);
NSDate *date3 = [NSDate dateWithTimeIntervalSince1970:nowTime];
NSLog(@"date3:%@", date3);
//格式化输出
/*
yyyy 年
MM 月
dd 日
mm 分钟
HH 小时24小时制 hh 12小时制
a 上午或者下午 am pm
ss 秒
e 星期
*/
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"y/MM/dd HH:mm eeee a x ";
NSLog(@"format : %@", [dateFormatter stringFromDate:date3]);
NSString *dateStr = @"2014/04/11 14:43";
NSDateFormatter *dateFormatter2 = [[NSDateFormatter alloc] init];
dateFormatter2.dateFormat = @"yyyy/MM/dd HH:mm";
NSLog(@"date::%@", [dateFormatter2 dateFromString:dateStr]);
return 74;
}
IOS UI 第十一篇: UITABLEVIEW的更多相关文章
- IOS UI 第十篇: UITABLEVIEW
uitableView review yesterday’s knowledge : folding group : ------------------------------- ...
- IOS UI 第八篇:基本UI
实现图片的滚动,并且自动停止在每张图片上 - (void)viewDidLoad{ [super viewDidLoad]; UIScrollView *scrollView = [[U ...
- iOS UI基础-9.0 UITableView基础
在iOS中,要实现表格数据展示,最常用的做法就是使用UITableView.UITableView继承自UIScrollView,因此支持垂直滚动,而且性能极佳. UITableView有两种样式: ...
- IOS UI 第六篇:基本UI
加两个UI模块 - (void)viewDidLoad{ [self begin1]; [self begin2]; [super viewDidLoad]; // Do ...
- IOS UI 第五篇:基本UI
添加个导航栏: Xib1 *xib1 = [[Xib1 alloc] initWithNibName:@"Xib1" bundle:nil]; UINavig ...
- iOS UI基础-9.2 UITableView 简单微博列表
概述 我们要实现的效果: 这个界面布局也是UITableView实现的,其中的内容就是UITableViewCell,只是这个UITableViewCell是用户自定义实现的.虽然系统自带的UITab ...
- iOS UI基础-9.1 UITableView 团购
概述 接下来,我们要做的是团购界面的设计,最张要实现的效果图及项目结构图 团购数据的展示 思路: 系统自带的tableCell不能展示三个文本,不能满足条件,自定义tableCell 每一个 ...
- IOS UI 第四篇:基本UI
ViewController 应用 再第一个XIB页面创建另一个XIB页面,并且通过按钮调用它 - (IBAction)GoSecond:(id)sender { secondVie ...
- IOS UI 第三篇:基本UI
工厂模式: .h文件: #import <Foundation/Foundation.h>typedef enum{ QFRed, QFYellow, QFBlu ...
随机推荐
- Swift_3_功能
import Foundation println("Hello, World!") //声明函数 不带参数 无返回值 func func1(){ } //一个函数 传入两个Str ...
- Same binary weight (位运算)
题目描述 The binary weight of a positive integer is the number of 1's in its binary representation.for ...
- linux_之sed用法
sed是一个很好的文件处理工具,本身是一个管道命令,主要是以行为单位进行处理,可以 将数据行进行替换.删除.新增.选取等特定工作,下面先了解一下sed的用法sed命令行格式为: sed ...
- elasticsearch的rest搜索--- 查询
目录: 一.针对这次装B 的解释 二.下载,安装插件elasticsearch-1.7.0 三.索引的mapping 四. 查询 五.对于相关度的大牛的文档 四. 查询 1. 查询的官网的文档 ...
- BIZTALK项目中WEB引用WEBSERVICES服务时候报错
近期工作中须要完毕通过BIZTALK完毕调用WEBLOGIC公布的WebServices服务,环境搭建好后,打开VS开发工具新建一个BIZTALK项目,加入WEB引用将对方公布的地址拷贝上去,能够正常 ...
- app后端设计(0)--总文件夹
原文:http://blog.csdn.net/newjueqi/article/details/19003775 做了接近两年app相关的系统架构,api设计,先后在两个创业公司中工作,经历过手机网 ...
- 关于Java的对象、数组、String类的具体用法
对象的行为: 1.内存分配(栈和堆的区别) 栈:保存局部变量的值(用来保存基本数据类型的值:保存类的实例的引用) 对:用来存放动态产生的数据,比如new出来的对象 2.调用方法 方法返回一个值.方法不 ...
- 数据库 基于索引的SQL语句优化之降龙十八掌(转)
一篇挺不错的关于SQL语句优化的文章,因不知原始出处,故未作引用说明! 1 前言 客服业务受到SQL语句的影响非常大,在规模比较大的局点,往往因为一个小的SQL语句不够优化,导致数据库性能急 ...
- crm创建和编辑全局选项集
一个选项集就是可包含在一个实体中的某种类型的字段.它定义一组选项.当一个选项集显示在窗口中时,将使用下拉列表控件.当在 Advanced Find 中显示时,则使用选择列表控件.有时,开发者将选项集称 ...
- python解析命令行
可以解析这样的命令 ./cron_ctrl jobname1 --stop ;./cron_ctrl jobname1 --start;./cron_ctrl jobname1 --list #!/u ...