Я создал UITableViewCell в Интерфейсном Разработчике, к которому я добавил UIImageView и UIButton.Я дал UIButton выход и подключил его к IBAction с набором событий для подкраски.Я предполагал, что вызовет этот метод, так как все выглядит так, как будто он подключен:
- (IBAction)pressedCheckbox:(id)sender {
[sender setBackgroundImage:[UIImage imageNamed:@"checked.png"] forState:UIControlStateNormal];
NSLog(@"clicked check");
}
Проверяя вкладку соединений, у меня все настроено правильно, розетка и действие.И я не получаю ошибок, но при предварительном просмотре приложения нажатие на эту кнопку внутри UITableViewCell ничего не делает, и я ничего не вижу в журналах.
Идеи о том, почему он не позволяет мне нажимать на мойкнопка, которая находится в UITableViewCell?
РЕДАКТИРОВАТЬ:
Код для cellForRowAtIndexPath:
- (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] autorelease];
cell.editingAccessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (indexPath.section == 0) {
switch (indexPath.row) {
case 0:
cell = topCell;
break;
case 1:
cell = cell1;
break;
}//end switch
}//end if
return cell;
}