TableViewController
呢個controller 好常用 可以做黎例曬data 更可以select一個之後push 下一個controller
有兩個protocoal 要conform
UITableViewDelegate
-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
設定每一row 既indentation . 如果每個row 多一個indentation return [indexPath row];
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
設定每一個row 可唔可以被selected 例如第一個row 唔可以select
NSUInteger row = [indexPath row]
if(row== 0)
return nil;
return row;
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
設定每一個row既高度 return 70;
UITableViewDataSource
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
一個section 入面有幾個row
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
每一個TableViewCell既setup

沒有留言:
張貼留言