【发布时间】:2015-11-22 19:26:26
【问题描述】:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
当我选择 UITableView 中的单元格时,上面的函数没有被调用,该单元格已插入到另一个 UITableView 的 footerView
我在下面的函数中添加了 UITableView,我可以看到我插入的所有项目
但我无法点击单元格。
我还插入了一些 UIButton 来检查点击是否正常工作,工作正常
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
提前致谢。
- (UIView *)tableView:(UITableView * )tableView viewForFooterInSection:(NSInteger)section {
if(tableView==_ordersListTable)
{
//creating view to pass to footerview
UIView *footerView;
footerView.userInteractionEnabled=true;
if(footerView == nil) {
//allocate the view if it doesn't exist yet
footerView = [[UIView alloc] init];
}
//initializing table
_paymentInfoTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 40, 320, 80)];
_paymentInfoTable.backgroundColor = [UIColor whiteColor];
_paymentInfoTable.delegate = self;
_paymentInfoTable.dataSource = self;
//_paymentInfoTable.separatorStyle = UITableViewCellSeparatorStyleNone;
_paymentInfoTable.separatorInset = UIEdgeInsetsMake(0, 110, 0, 180);
[footerView addSubview:_paymentInfoTable];
}
//return the view for the footer
return footerView;
} else
{
return 0;
}
}
【问题讨论】:
-
您忘记设置委托了吗?
-
委托和数据源都设置好了..
-
你能再贴一些代码吗,这只是猜测:-)
标签: ios objective-c iphone uitableview