я добавляю кнопку в мои заголовки разделов, но работает только первая кнопка.
Другие кнопки не отображают анимацию при касании и не отправляют действие.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
//Headerview
UIView *myView = [[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 300.0, 20.0)] autorelease];
//HeaderLabel
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 5.0, 300.0, 30.0)] ;
label.textColor = [UIColor colorWithRed:0.286 green:0.341 blue:0.424 alpha:1.];
label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0, 1);
label.font = [UIFont boldSystemFontOfSize:18];
label.backgroundColor = [UIColor clearColor];
//AddParameterButton
UIButton *button = [UIButton buttonWithType:UIButtonTypeContactAdd];
[button setFrame:CGRectMake(275.0, 5.0, 30.0, 30.0)];
button.tag = section;
button.hidden = NO;
[button setBackgroundColor:[UIColor clearColor]];
[button addTarget:self action:@selector(insertParameter:) forControlEvents:UIControlEventTouchDown];
label.text = @"Parameter";
[myView addSubview:label];
[myView addSubview:button];
[myView bringSubviewToFront:button];
[label release];
return myView;
}
Есть предложения по решению?СПАСИБО
// edit:
Я немного отладил, и viewForHeaderInSection:
вызывается шесть раз, но есть только два раздела.надеюсь, что смогу помочь
// edit2
попытался добавить кнопки как свойство и сделать это нединамическим способом, но тоже не помогает