0
我已經在每個部分的UITableView的頭部中插入UIButton,我想知道是否可以按下時檢索部分編號,我以這種方式添加按鈕:從UIButton的UITableview部分中的UIButton檢索部分
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 309, 70)];
UIButton *markAllYes = [UIButton buttonWithType:UIButtonTypeCustom];
[markAllYes setImage:[UIImage imageNamed:@"mini_seen.png"] forState:UIControlStateNormal];
[markAllYes setFrame:CGRectMake(95, 35, 31, 31)];
[markAllYes addTarget:self action:@selector(markAllYesPressed:) forControlEvents:UIControlEventTouchUpInside];
[headerView addSubview:markAllYes];
return headerView;
}
使用像這樣的標籤markAllYes.tag =使用markAllYes.tag按鈕標籤的部分和訪問。 –