У меня есть вопрос ...
У меня есть пользовательский класс TableViewCell:
// Class for Custom Table View Cell.
@interface CustomTableViewCell : UITableViewCell {
// Title of the cell.
UILabel* cellTitle;
// Switch of the cell.
UISwitch* cellSwitch;
}
Как вы можете видеть в моем пользовательском UITableViewCell у меня есть контроллер меток и переключателей.
- (id)initWithStyle: (UITableViewCellStyle)style reuseIdentifier: (NSString *)reuseIdentifier tableType:(TableTypeEnumeration)tabletypeEnum {
// Get Self.
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Create and initialize Title of Custom Cell.
cellTitle = [[UILabel alloc] initWithFrame:CGRectMake(10, (44 - TAGS_TITLE_SIZE)/2, 260, 21)];
cellTitle.backgroundColor = [UIColor clearColor];
cellTitle.opaque = NO;
cellTitle.textColor = [UIColor blackColor];
cellTitle.highlightedTextColor = [UIColor whiteColor];
cellTitle.font = [UIFont boldSystemFontOfSize:TAGS_TITLE_SIZE];
cellTitle.textAlignment = UITextAlignmentLeft;
// Create and Initialize Switch of Custom Cell.
cellSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(185, 10, 10, 10 )];
[self.contentView addSubview:cellTitle];
[self.contentView addSubview:cellSwitch];
[cellTitle release];
[cellSwitch release];
}
return self;
}
Теперь, когда я использую свою пользовательскую ячейку в TableView, я хочу отлавливать событие, когда пользователь меняет состояние switch .Как я могу это сделать?