天天看點

ios tableview didSelectRowAtIndexPath方法中,擷取某個cell的執行個體

選中tableView的某一行,觸發如下方法:

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

{

}

若此時需要對tableview的cell做處理,就需要先得到改行cell對應的執行個體,可運用如下方法: 

UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

或者某個自定義cell

MyCustomCell *cell = ( MyCustomCell  *)[tableView  cellForRowAtIndexPath :indexPath];