I would like to add a new cell when user taps or presses below the last cell in the UITableView
, but only when the view height is greater than all cell's heights in all.
I do not want separators and I use:
myTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
As a blank view instead.
I try to change and add a UITapGestureRecognizer
to myTableView.tableFooterView
. He also left at the end when there are enough cells to fill the screen. What I want is, that it works on the partly empty screen.
I do not think the UITableViewDelegate
message is sent in this case.
EDIT
After @LeoNatan answer, I try with that (in viewDidLoad
):
UIView *backView = [[UIView alloc] initWithFrame:self.myTableView.frame];
singleTapBack = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBack:)];
//singleTapBack.delegate = self; // the problem...
singleTapBack.numberOfTapsRequired = 1;
singleTapBack.numberOfTouchesRequired = 1;
[backView addGestureRecognizer:singleTapBack];
self.myTableView.backgroundView = backView;
When I touch the background:
-[UIView indexPathForRowAtPoint:]: unrecognized selector sent to instance 0x7fff0bc16a20
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView indexPathForRowAtPoint:]: unrecognized selector sent to instance 0x7fff0bc16a20'
0x7fff0bc16a20
is UIView *backView
and @selector(handleTapBack:)
is not called