没有在 popupView 中调用 UITableview 的 didSelectRowAtIndexPath

Not called didSelectRowAtIndexPath of UITableview in popupView

我在 textField onEditing 事件中打开其中包含 Tableview 的 popupView。

我正在为 tableview 设置 DataSource 和 Delegate。 我为 Tableview

设置了这么多 属性

1) 允许选择 = 是

2) userInterectionEnabled = 是

3) tableview.layer.zposition = 1

4) [self.view bringSubViewToFront: tableview]

这是代码..

UITableView *tblCompany = [[UITableView alloc] initWithFrame:CGRectMake(0, 0,  [UtilClass getScreenWidth]-[UtilClass getScreenWidth]/4, 200)];
tblCompany.dataSource = self;
tblCompany.delegate = self;
tblCompany.userInteractionEnabled=YES;
tblCompany.allowsSelection=YES;
tblCompany.separatorStyle=UITableViewCellSeparatorStyleNone;
[self.popOver addSubView:tblCompany];

我的问题

我的 viewController 中有很多控件,例如按钮和标签。 当我编辑我的文本字段时,弹出窗口会在按钮上方打开。

当我尝试点击 tableView 的单元格时,它没有调用 didSelectRowAtIndexPath 但我点击了它后面的按钮。

Note: cellForRowAtIndexPath,numberOfRowsInSection, heightForRowAtIndexPath these all are working fine, so there is no problem with DataSource or Delegate

Note: Not used any Gesture in my viewController.

我认为层有一些问题所以我也应用了 zPosition,但是没有用..

编辑 我只是让 popOver view.hidden = true 或 false on textField Editing..

有什么解决办法吗?

在 运行 应用程序时检查您的 tableview 是否在前面。