gpt4 book ai didi

ios - 如何检索详细信息披露按钮的 View ?

转载 作者:行者123 更新时间:2023-11-29 03:45:33 24 4
gpt4 key购买 nike

我有一个 UITableView,其上的单元格带有详细信息披露指示器 (UITableViewCellAccessoryDe​​tailDisclosureButton)。

我需要详细信息披露按钮的 View (以显示其中的一些自定义弹出菜单),但它始终为空。为什么?

-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
[self showMenu: cell.accessoryView];
NSLog(@"%@",cell.accessoryView);}

如何将公开按钮的 View 检索为 UIVIew*?(注意,我有披露按钮并为其触发点击事件)

提前致谢!

最佳答案

您可以通过检查单元格 subview 找到附件按钮:

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
//[self showMenu: cell.accessoryView];
NSLog(@"%@",cell.accessoryView);

NSArray *subviews = [cell subviews];

for (UIView *subview in subviews) {
if ([subview isKindOfClass:[UIButton class]]) {
NSLog(@"This is that button");
}
}
NSLog(@"Subviews: %@", subviews);
}

关于ios - 如何检索详细信息披露按钮的 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17795651/

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