gbesler gbesler - 4 months ago 18
Objective-C Question

Custom UITableViewCell sometimes not responding

I am facing a weird problem. I want to display a custom cell without highlighting it. My

in my table has 5 elements in it like UILabel, UIImage etc. The problem is when I tap on the cell sometimes alertview is not displayed. This is the code in my

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:LocalizedString(@"Please input") delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];

I was doing a wide research about it. Firsly, I changed:

cell.selectionStyle = UITableViewCellSelectionStyleNone


cell.selectionStyle = UITableViewCellSelectionStyleDefault
UIView *bgColorView = [[UIView alloc] init];
bgColorView.backgroundColor = [UIColor myCellColor];
[cell setSelectedBackgroundView:bgColorView];

Since I don't want highlighting, I set the highlight color of the cell to the cell background color but the problem with that, it is highlighting the separator as well. So when I tap the color of seperator changes and it looks not nice.

I was wondering how to solve this issue without highligthing the custom cell.

Edit note:

is always called but the AlertView is not always displayed.

Doesn't matter simple UIAlertController or UIAlertView. Both are sometimes not displayed.


Most probably you covered you entire cell with some UI components so you cant really touch the cell to execute didSelectRowAtIndexPath method see example image below.

The entire green portion of cell and is uibutton light blue:

enter image description here

So this wont detect your touch everytime over cell and execute didSelectRowAtIndexPath method properly ..

Hope this helps.