searched already some possible fixes but all did not solve mine.
i keep clicking the cell in the uitableview rather than the buttons inside it.
here is my code:
Create a custom UITableViewCell. Refer this link.
Say you have a UIButton
by the name of displayButton, you can do something like this:
Inside your - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
, after you create your cell,
[cell.dislayButton addTarget: self
action: @selector(replyButtonPressed:withEvent:)
forControlEvents: UIControlEventTouchUpInside];
And the create the method like so in your ViewController:
- (void) replyButtonPressed: (id) sender withEvent: (UIEvent *) event
{
UITouch * touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView: self.tableView];
NSIndexPath * indexPath = [self.tableView indexPathForRowAtPoint: location];
}