现在的位置: 首页 > 综合 > 正文

获取UITableView 的cell 及其cell上的controll

2017年12月09日 ⁄ 综合 ⁄ 共 325字 ⁄ 字号 评论关闭

假设定义了一个UITableView *myTableView;

sectionIndex为row所在的Section,rowIndex及row所在行

UITableViewCell *cell = [myTableView  cellForRowAtIndexPath:[NSIndexParh indexPathForRow:rowIndex inSection:sectionIndex];

那么对于获取cell上的controller;

则可以采用 id controller = [cell viewWithTag:tag];

可以先设置好controller 的tag即可;

当然如果controller为cell 的 property,直接采用点操作了

eg:cell.title;

抱歉!评论已关闭.