本文介绍了如何检索详细信息披露按钮的视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有单元格的 UITableView,带有详细信息披露指示符 (UITableViewCellAccessoryDetailDisclosureButton).
I have a UITableView with cells on it with detail disclosure indicator (UITableViewCellAccessoryDetailDisclosureButton).
我需要详细信息披露按钮的视图(以从中显示一些自定义弹出菜单),但它始终为空.为什么?
I need the detail disclosure button's view (to show some custom popup menu from it), but it is always null. Why?
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
[self showMenu: cell.accessoryView];
NSLog(@"%@",cell.accessoryView);}
如何将公开按钮的视图检索为 UIVIew*?(注意,我有披露按钮,并为它触发了点击事件)
How an I retrieve disclosure button's view as UIVIew*?(note, i have the disclosure buttons and tap event is fired for it)
提前致谢!
推荐答案
您可以通过检查单元格子视图找到附件按钮:
You can find the accessory button by checking the cells subviews:
- (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);
}
这篇关于如何检索详细信息披露按钮的视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!