У меня есть подкласс UITableViewCell
по имени ReminderCell
.Возврат пользовательской ячейки UITableViewCell
ReminderCell
имеет метод, называемый backToPlaceAnimation
, который я написал.
Проблема заключается в том, например, если я хочу, чтобы позвонить backToPlaceAnimation
на первом ReminderCell
из RemindersVC
с помощью tableView: cellForRowAtIndexPath:
он не возвращает правильный объект (это UITableViewCell
объект и не ReminderCell
вообще).
Как я могу получить правильный объект?
Код:
журналNSIndexPath *cellIndexPath=[NSIndexPath indexPathWithIndex:0];
ReminderCell *cell=(ReminderCell*)[self tableView:self.AroundersTableView cellForRowAtIndexPath:cellIndexPath];
[cell cancelDeletion];
Крушения:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid index path for use with UITableView. Index paths passed to table view must contain exactly two indices specifying the section and row. Please use the category on NSIndexPath in UITableView.h if possible.
cellForRowAtIndexPath: переопределение:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//Creating a default cell using "cellIdentifier"(NSString)
ReminderCell *cell=[tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (cell==nil) {
cell=[[ReminderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
//Changing "cell"'s "index" to indexPath.row
cell.index=(int)indexPath.row; //Crashes here
[email protected]"Hello";
//Returning cell
return cell;
}
Спасибо!
Показать код, как вы получаете клетки от 'cellForRowAtIndexPath' –
Вы. создавая ваш UITableView программно? –
@ DantePuglisi Обновлено сообщение, пожалуйста, посмотрите –