Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView last row didSelect not working properly?

I'm facing a very strange problem. I'm using a tableView for menu purpose. It is working fine. But the problem is that in last row of that table ,only top half area fires did select event. When I click on mid of the last row did select does not work. And clicking on top half of the cell didSelect is working fine. Can anyone elaborate it?

Here is screenshot I'm using tableView as:-

enter image description here

here is the code I am setting table's y position on didSelect of backTableView.

        UITableView *menuTable=(UITableView*)[self.view viewWithTag:5];
    CGRect rect=[menuTable frame];
    rect.origin.y-=rect.size.height;

    [UIView animateWithDuration:0.3 animations:^{
        [menuTable setFrame:rect];
    } completion:^(BOOL finished) {

        [tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
        isMenuOpen=YES;
        [bgView setFrame:self.view.frame];
        [self.view insertSubview:bgView belowSubview:menuTable];
        for (UIView *view in self.view.subviews) {
            if (view!=menuTable && view.tag!=44) {
                [view setUserInteractionEnabled:NO];
            }
        }
        NSLog(@"animation completed");
    }];

Setted rowHeight to 40
bringSubViewtoFront
TableHeight to 80 

What can I do now?

like image 306
Prince Kumar Sharma Avatar asked Dec 20 '22 04:12

Prince Kumar Sharma


1 Answers

Any one will be causing the problem

  • some view above that is overlapping the tableview
  • Height of tablecell not properly set
  • Delegate not set properly
  • Make sure the tableview frame and its superview frame is set properly[if the superview is having lesser height this problem occours]
  • If having footer or header and more than one section, check delegate methods to filter wich table view should show header/footer and also check height.

You could also use the visual debugging tools added to Xcode to see views order in a 3d fashion, and check which one is over the other.

like image 195
Lithu T.V Avatar answered Jan 10 '23 23:01

Lithu T.V