Я загружаю табличное представление и хотел бы оторвать объект 2 и объект 4 и сделать их отключенными для взаимодействия с пользователем.Отключить ячейки в NSArray UITableView
В .h У меня есть
@property (nonatomic, strong) NSArray *list;
и .m:
- (void)viewDidLoad
{
[super viewDidLoad];
self.list = [[NSArray alloc] initWithObjects:@"Object 1", @"Object 2", @"Object 3", @"Object 4", @"Object 5", nil];
}
и
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [list objectAtIndex:[indexPath row]];
return cell;
}
Я пытался получать объект с помощью
объект = [ self.list objectAtIndex: 2], чтобы получить O bject 2, но ничего не делает.
Как мне это сделать?
совершенное спасибо –