Друзья, пытаюсь сделать кастомный заголовок для таблицы, однако столкнулся с проблемой: лэйбл добавляется с легкостью, а вот кнопка как бы есть (вызывается метод при нажатии) но ее не видно. Максимум чего я смог добиться это изменить цвет при помощи
[checkButton setBackgroundColor:[UIColor lightGrayColor]];
В этом случае видно, где кнопка, но пикчи не ставятся на фон, не ставятся заголовки... Может кто может что подсказать, был бы очень благодарен
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *titleView = [[UIView alloc] init];
[titleView setBackgroundColor:[UIColor whiteColor]];
UILabel *titleName = [[UILabel alloc] initWithFrame:CGRectMake(20, 14, 280, 21)];
titleName.text = @"someName";
UIImage *img = [UIImage imageWithContentsOfFile:@"textbutton_medium.png"];
UIButton *checkButton = [UIButton buttonWithType:UIButtonTypeCustom];
[checkButton setFrame:CGRectMake(20, 43, 144, 47)];
[checkButton setBackgroundImage:img forState:UIControlStateNormal];
checkButton.titleLabel.text = @"someText";
[checkButton addTarget:self action:@selector(checkInterestsInSectionAction:)
forControlEvents:UIControlEventTouchUpInside];
[titleView addSubview:titleName];
[titleView addSubview:checkButton];
return titleView;
}