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. .NET中使用Redis(二)

    很久以前写了一篇文章 .NET中使用Redis 介绍了如何安装Redis服务端,以及如何在.NET中调用Redis读取数据.本文简单介绍如何设计NoSQL数据库,以及如何使用Redis来存储对象. 和 ...

  2. CocoaPods停在Analyzing dependencies解决方案

    现在很多开源项目应用cocoapod.这使集成第三方库都非常方便,在没有花project里设置哪些参数.仗着. 只要运行pod update要么pod install时间,经常会卡在Analyzing ...

  3. hdu 亲和串(kmp)

    Problem Description 人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断了,但是发现 ...

  4. zoj 2402 - Lenny&#39;s Lucky Lotto Lists

    称号:序列,在前面的每个元件的至少两倍,最大值至n.问:长l船舶有许多这样的. 分析:dp,LIS类别似事. 状态:f(i,j)结束数字为j且长度为i的序列的个数.有转移方程: F[ i ][ j ] ...

  5. idea_intellij

    近期要研读和调试spark2,用eclispe据说各种问题,so还是切换到  intellij 1:下载 (官网自行下载最新版本) 2: 注册码 intellij idea 2016 activati ...

  6. Leetcode dfs Combination SumII

    Combination Sum II Total Accepted: 13710 Total Submissions: 55908My Submissions Given a collection o ...

  7. JavaScript之再谈回调与闭包

    前些阵子写了几篇关于回调和闭包的博文,感觉自己都是似懂非懂,最近在项目中又碰到了类似的情况,故在此咱们来重弹js中的回调与闭包. 先说说回调: 百度百科: 回调函数就是一个通过函数指针调用的函数.如果 ...

  8. php_json入库有关

    php入库json信息 有些字符需要特殊处理 //组装 $test=array(); $test["k1"]= urlencode($k1); $test["k2&quo ...

  9. [译文]c# /.Net 技巧: ToDictionary() and ToList()

    前言: 有两个简单好用的LINQ扩展方法 ToDictionary() 和ToList(),你可能知道或不知道,但是它的的确确可以简化查询转化为集合的任务: 简介: LINQ和延迟执行 据你所认识的L ...

  10. php_linux_ubuntu_安装mysql_apache_php

    用apt-get方法安装mysql5 + Apache2 + PHP5+Phpmyadmin [建议] http://www.sudu.cn/info/html/edu/20080102/283439 ...