Я использую следующие 2 метода для возврата пользовательской ячейки:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *key = [self keyForIndexPath:indexPath];
UITableViewCell *cell;
if ([key isEqualToString:DoneButtonCellKey]) {
cell = [self [self doneButtonCellForIndexPath:indexPath];
return cell;
} else {
//code to return default cell...
}
}
Тогда:
- (DoneButtonCell *)doneButtonCellForIndexPath: (NSIndexPath *)indexPath {
DoneButtonCell *cell = [self.tableView dequeueReusableCellWithIdentifier:DoneButtonCellIdentifier forIndexPath:indexPath];
return cell;
}
Каков правильный метод init для использования с ячейкой здесь, чтобы я мог изменить некоторые свойства ячейки при ее инициализации?
EDIT: Я нашел проблему, поскольку методы init/awakeFromNib не вызывались для меня. Я обнаружил ошибку, и я не изменил "Пользовательский класс" из UITableViewCell в свой собственный класс. Теперь awakeFromNib И initWithCoder работают, как описано ниже.