tableView常用方法

#pragma mark - < UITableViewDelegate>

//點擊Cell時調用函數

- (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath

{

NSLog(@"第%zd行",indexPath.row);

}

/**

*取消選中某一行時候調用

*@param indexPath被取消選中那一行《當另一行被選中,前面選中對的行被取消》

*/

- (void)tableView:(UITableView*)tableView didDeselectRowAtIndexPath:(NSIndexPath*)indexPath

{NSLog(@"被取消的第%zd行",indexPath.row);}

*告訴第indexpath行高

- (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath

{if(indexPath.row%2==0) {return20;}

return100;}


在頭部分區高度設置

- (CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section

{

return60;

}

分區的頭部返回一個UIView

- (UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section

{

return[UIButtonbuttonWithType:UIButtonTypeContactAdd];

}


- (void)scrollViewDidScroll:(UIScrollView*)scrollView

{

NSLog(@"---*********----%@",scrollView);

}

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容