gpt4 book ai didi

ios - 从 UITableview 部分的标题 View 中的 UIButton 检索部分

转载 作者:行者123 更新时间:2023-11-28 22:29:01 25 4
gpt4 key购买 nike

我在每个部分的 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;
}

最佳答案

您可以使用 UIButton 的 tag 属性。

markAllYes.tag = section

关于ios - 从 UITableview 部分的标题 View 中的 UIButton 检索部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18032498/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com