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

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

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

    隨筆-193  評論-715  文章-1  trackbacks-0
    原文地址: http://blog.sina.com.cn/s/blog_7e3132ca0100wyls.html
    在XCode對應頭文件中修改該類所繼承的父類:
    @interface TableViewController:UIViewController <UITableViewDataSource, UITableViewDelegate>
    {
    }
    在對應的.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上添加了一個tableView,但其樣式是默認的,其中的內容也是空白的,而且此時是無法運行的,因為在頭文件中添加了UITableViewDataSource和UITableViewDelegate兩個類,所以必須設置一些自定義tableView樣式的方法,下面列舉了一些相關的方法:
    設置Cell高度:
    -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
    設置SectionHeader高度:
    -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
    設置SectionFooter高度:
    -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
    設置Section數目:
    -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
     
    設置SectionHeader內容:
    -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    設置各個Section中的Cell個數: 
    -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    設置Cell內容: 
    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
     
    設置Cell行縮進量:
    -(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
    設置Cell被選中響應前動作(例如:可用以判斷選中的Cell,來阻止其響應)
    -(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
    設置Cell選中觸發響應:
    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    posted on 2011-12-29 09:12 Robin's Programming World 閱讀(2335) 評論(1)  編輯  收藏 所屬分類: 其它

    評論:
    # re: [轉]自定義UITableView 2012-11-01 22:58 | superchen
    博主把最核心,最常用的函數都羅列出來了!博主可以進IOS中高級開發群:118623167和大家討論,大家一定能收獲很多  回復  更多評論
      
    主站蜘蛛池模板: 97久久精品亚洲中文字幕无码| 日本免费一二区在线电影| 丝袜熟女国偷自产中文字幕亚洲| 亚洲AV日韩AV无码污污网站| 两个人的视频高清在线观看免费 | 曰曰鲁夜夜免费播放视频| 亚洲成色在线影院| 国产成人精品无码免费看| 久久久久亚洲AV成人无码| 1000部拍拍拍18勿入免费视频下载 | 亚洲中文无码永久免| 最近中文字幕无吗免费高清| 国产精品高清视亚洲一区二区| 在线视频免费观看www动漫| 亚洲AV色无码乱码在线观看| 免费一级做a爰片久久毛片潮喷| 免费国产高清毛不卡片基地| 亚洲人成色77777在线观看大| 久久久免费观成人影院| 亚洲资源在线观看| 四虎在线免费播放| 久久精品成人免费国产片小草| 国产亚洲精品成人AA片新蒲金| 男人j进入女人j内部免费网站| 亚洲Aⅴ无码专区在线观看q| 无码A级毛片免费视频内谢| 亚洲成AV人片在线观看ww| a级毛片免费播放| 亚洲色图在线观看| 色妞WWW精品免费视频| 亚洲爆乳大丰满无码专区| 免费很黄很色裸乳在线观看| 中国好声音第二季免费播放| 久久国产精品亚洲一区二区| 4399影视免费观看高清直播| 亚洲成a∧人片在线观看无码| 亚洲AV无码国产在丝袜线观看| 在线看无码的免费网站| 亚洲一级免费毛片| 一级毛片直播亚洲| 国内少妇偷人精品视频免费|