Search code examples
iosobjective-ciphoneuitableviewpopover

Not called didSelectRowAtIndexPath of UITableview in popupView


I am Opening popupView having Tableview inside it on textField onEditing event.

I am setting DataSource & Delegate both for tableview. I have set this much property for Tableview

1) AllowSelection = Yes

2) userInterectionEnabled = Yes

3) tableview.layer.zposition = 1

4) [self.view bringSubViewToFront: tableview]

Here's the code..

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];

My Problem

I have many controls like buttons & labels in my viewController. When i edit to my textfield the popup opens over the buttons.

When i try to click on the cell of tableView, it does not called didSelectRowAtIndexPath but i clicks to the button behind it.

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.

I think there is some problem with layer so i apply zPosition also , but doen't work..

Edit I am just making popOver view.hidden = true or false on textField Editing..

is there any solution?


Solution

  • Check if your tableview is in the front while running the app.

    enter image description here