我想从我的UITableViewController与变化的IndexPath得到一个子类UITableViewCell(类称为'MasterCell')。比方说,我会在第一行获取单元格:从UITableView与cellForRowAtIndexPath从UITableViewController获取UITableViewCell
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
MasterCell *cell = (MasterCell *)[self.tableView cellForRowAtIndexPath:indexPath];
这发生在我的viewWillAppear方法中。不幸的是,调试时单元不存在。
我有不同的单元格/行,我必须在viewWillAppear方法中更改一些值。你有什么提示吗?
你的意思是你试图从故事板中获得一个单元格吗? – Darren
是的,它是一个带有TableViewController的故事板。 'self.tableView'是连接到TableView的属性(IBOutlet UITableView)。 – Fonsi
你不使用indexPath获取单元格。在故事板中给它一个重用标识符,并使用MasterCell * cell =(MasterCell *)[tableView dequeueReusableCellWithIdentifier:@“masterCell”]; – Darren