<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纯肉无码精品动漫| 亚洲人成网站18禁止一区| 四虎影视永久在线精品免费| 亚洲国产天堂在线观看| 无码国产精品一区二区免费vr| 亚洲AV无码成人专区| 亚洲视频在线一区二区| 特黄特色大片免费| 亚洲综合男人的天堂色婷婷| 最近中文字幕免费mv在线视频| 亚洲国产成人无码AV在线 | 免费永久在线观看黄网站| 久草视频在线免费看| 风间由美在线亚洲一区| 国产v片免费播放| 1区2区3区产品乱码免费| 亚洲成av人片在线看片| 成人免费AA片在线观看| 国产免费人成视频尤勿视频 | 色噜噜狠狠色综合免费视频| 亚洲香蕉免费有线视频| 亚洲中文字幕久久精品无码APP| 成年轻人网站色免费看| 久久国产乱子伦免费精品| 久久99精品免费一区二区| 国产精品亚洲av色欲三区| 亚洲一区二区三区在线播放| 人禽杂交18禁网站免费| 三年片在线观看免费大全电影| 又大又硬又粗又黄的视频免费看| 久久久久亚洲国产| 亚洲成av人片不卡无码| 色播亚洲视频在线观看| 亚洲精品成人网站在线观看| 亚洲国产电影av在线网址| 日本一道本高清免费| 成年美女黄网站色大免费视频| 免费成人激情视频|