DIY a tableviewcell :
 
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    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;
}
 
 
add a Xib of tableViewCell:
 
- (void)viewDidLoad
{
    [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.
}
 
 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    /*
    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;
}
 
 
 
About MVC :
 
     MVC 模式
     M model        数据模型 储存数据
     V view         视图模型 用来显示界面
     C controller   控制器  用来联系 M 和 V
     
     数据模型,就是用于储存数据,你将项储存的数据传入,数据模型,负责解析,并按照自己的数据结构储存。
     视图模型,就是用于显示并刷新界面,你仅需要将想要显示的数据传入即可,视图模型在内部将你的数据,按照自己的格式显示。
     控制器,就是负责逻辑,既不要干涉数据模型的内容,要不要干涉视图模型的显示。
 
 
 
 
 
 
 
NSdate example :
 
 
        NSDate *date1 = [NSDate date];
        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 Cell hight :
 
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 74;
}
 
 
 

IOS UI 第十一篇: UITABLEVIEW的更多相关文章

  1. IOS UI 第十篇: UITABLEVIEW

    uitableView review yesterday’s knowledge :         folding group :   ------------------------------- ...

  2. IOS UI 第八篇:基本UI

    实现图片的滚动,并且自动停止在每张图片上     - (void)viewDidLoad{    [super viewDidLoad]; UIScrollView *scrollView = [[U ...

  3. iOS UI基础-9.0 UITableView基础

    在iOS中,要实现表格数据展示,最常用的做法就是使用UITableView.UITableView继承自UIScrollView,因此支持垂直滚动,而且性能极佳. UITableView有两种样式: ...

  4. IOS UI 第六篇:基本UI

    加两个UI模块   - (void)viewDidLoad{    [self begin1];    [self begin2];    [super viewDidLoad];    // Do ...

  5. IOS UI 第五篇:基本UI

    添加个导航栏:         Xib1 *xib1 = [[Xib1 alloc] initWithNibName:@"Xib1" bundle:nil];    UINavig ...

  6. iOS UI基础-9.2 UITableView 简单微博列表

    概述 我们要实现的效果: 这个界面布局也是UITableView实现的,其中的内容就是UITableViewCell,只是这个UITableViewCell是用户自定义实现的.虽然系统自带的UITab ...

  7. iOS UI基础-9.1 UITableView 团购

    概述 接下来,我们要做的是团购界面的设计,最张要实现的效果图及项目结构图      团购数据的展示 思路: 系统自带的tableCell不能展示三个文本,不能满足条件,自定义tableCell 每一个 ...

  8. IOS UI 第四篇:基本UI

    ViewController 应用   再第一个XIB页面创建另一个XIB页面,并且通过按钮调用它     - (IBAction)GoSecond:(id)sender {    secondVie ...

  9. IOS UI 第三篇:基本UI

    工厂模式:   .h文件:   #import <Foundation/Foundation.h>typedef enum{    QFRed,    QFYellow,    QFBlu ...

随机推荐

  1. ruby简单的基本 6

    模 像类似的模块,那里 class method 和 instance method.module 没有new不能生成对象的例子其中 class method 所谓的模块在模块化的方法,它能够直接调用 ...

  2. Hybrid----U采用IWebView演出PDF和其他文件

    App如果你需要显示pdf.word档,在这个时候有没有其他控制,比UIWebView更适合,这是高度抽象的技术细节,可以非常easy采用 UIWebView打开文件类型列表 watermark/2/ ...

  3. react学习笔记1--基础知识

    什么是react A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES[React是一个用于构建用户界面的JavaScript库.] React之所以快, ...

  4. C语言优化实例:为了消除嵌套switch-case聪明的做法

    我们有可能会写出或者遇到类似这种代码: C/C++ switch (expr1) { case label11: switch (expr2) { case label21: // do someth ...

  5. VC中MessageBox的常见用法

    一.关于MessageBox       消息框是个很常用的控件,属性比较多,本文列出了它的一些常用方法,及指出了它的一些应用场合.       1.MessageBox("这是一个最简单的 ...

  6. Java串口通信详细解释

    前言 说到开源.恐怕非常少有人不挑大指称赞. 学生通过开源码学到了知识,程序猿通过开源类库获得了别人的成功经验及可以按时完毕手头的project,商家通过开源软件赚到了钱……,总之是皆大欢喜. 然而开 ...

  7. [注意事项&amp;车轮]java源代码 产生局部javadoc api档

    随着Eclipse书写java码时间,有时候,因为我们不知道java函数返回.通过鼠标移动到java该功能,假设它javadoc相关内容将被显示. 但是,并非所有java代码javadoc:连装jav ...

  8. MacOS10.9平台配置Appium+Java环境

    1) 安装JDK 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html   ...

  9. UVa 10533 - Digit Primes

    题目:输出给定区间中,本身是素数,而且这个数的各位之和也是素数的数(称为位素数)的个数. 分析:数论.首先利用筛法,求出1000000内的全部的素数:然后在利用生成的素数表, 推断每一个数是不是各位之 ...

  10. Gaea是支持跨平台具有高并发、高性能、高可靠性,并提供异步、多协议、事件驱动的中间层服务框架

    Gaea是支持跨平台具有高并发.高性能.高可靠性,并提供异步.多协议.事件驱动的中间层服务框架 Gaea:58同城开源的中间层服务框架 https://github.com/58code/Gaea 中 ...