<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-193  評(píng)論-715  文章-1  trackbacks-0
    原文地址: http://blog.sina.com.cn/s/blog_7e3132ca0100wyls.html
    在XCode對(duì)應(yīng)頭文件中修改該類所繼承的父類:
    @interface TableViewController:UIViewController <UITableViewDataSource, UITableViewDelegate>
    {
    }
    在對(duì)應(yīng)的.m文件中添加如下代碼:
    @implementation TableViewController
    {
    UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,0,320,460) style:UITableViewStylePlain];
    tableView.dataSource = self;
    tableView.delegate = self;
    [self.view addSubview:tableView];
    }
    這樣就在view上添加了一個(gè)tableView,但其樣式是默認(rèn)的,其中的內(nèi)容也是空白的,而且此時(shí)是無(wú)法運(yùn)行的,因?yàn)樵陬^文件中添加了UITableViewDataSource和UITableViewDelegate兩個(gè)類,所以必須設(shè)置一些自定義tableView樣式的方法,下面列舉了一些相關(guān)的方法:
    設(shè)置Cell高度:
    -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    設(shè)置SectionHeader高度:
    -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    設(shè)置SectionFooter高度:
    -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
    設(shè)置Section數(shù)目:
    -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
     
    設(shè)置SectionHeader內(nèi)容:
    -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    設(shè)置各個(gè)Section中的Cell個(gè)數(shù): 
    -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    設(shè)置Cell內(nèi)容: 
    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
     
    設(shè)置Cell行縮進(jìn)量:
    -(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
    設(shè)置Cell被選中響應(yīng)前動(dòng)作(例如:可用以判斷選中的Cell,來(lái)阻止其響應(yīng))
    -(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
    設(shè)置Cell選中觸發(fā)響應(yīng):
    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    posted on 2011-12-29 09:12 Robin's Programming World 閱讀(2333) 評(píng)論(1)  編輯  收藏 所屬分類: 其它

    評(píng)論:
    # re: [轉(zhuǎn)]自定義UITableView 2012-11-01 22:58 | superchen
    博主把最核心,最常用的函數(shù)都羅列出來(lái)了!博主可以進(jìn)IOS中高級(jí)開(kāi)發(fā)群:118623167和大家討論,大家一定能收獲很多  回復(fù)  更多評(píng)論
      
    主站蜘蛛池模板: 久久亚洲国产精品一区二区| 精品熟女少妇av免费久久| 好吊妞788免费视频播放| 亚洲欧洲第一a在线观看| 免费成人在线视频观看| 亚洲Av无码专区国产乱码DVD | 亚洲av日韩av无码av| 国产精品免费观看| 亚洲 暴爽 AV人人爽日日碰| 成年女人免费视频播放77777 | 中文字幕无码成人免费视频| 岛国岛国免费V片在线观看| 免费一级毛片不卡不收费| 羞羞视频免费观看| 国产成人A亚洲精V品无码| 免费黄色电影在线观看| 亚洲日韩乱码中文无码蜜桃| 永久免费av无码不卡在线观看| 亚洲Av永久无码精品黑人| 亚洲成AⅤ人影院在线观看| 免费看成人AA片无码视频吃奶| 亚洲综合久久综合激情久久| 久久精品网站免费观看| 老妇激情毛片免费| 国产偷v国产偷v亚洲高清| 精品无码免费专区毛片| 亚洲成a∧人片在线观看无码| 亚洲午夜av影院| 四虎最新永久免费视频| 豆国产96在线|亚洲| 亚洲国产精品无码专区| 免费一本色道久久一区| fc2成年免费共享视频18| 亚洲综合色一区二区三区小说| 我要看WWW免费看插插视频| 国产vA免费精品高清在线观看| 免费国产黄线在线观看| 免费精品99久久国产综合精品| 亚洲视频免费观看| 国产特级淫片免费看| 久久国产乱子伦精品免费看|