I know some have already asked the question but so far, the answers are not really specific.
Apparently apple have made the click area of the NavigationBar larger than it really is, but I don't think it's supposed to be that large.
In my app, there is a TableView right underneath the NavBar and you can click all the way down to half of the first cell to trigger the event of the rightBarButtonItem. the button is instanced like this:
UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editTable)];
[[self navigationItem] setRightBarButtonItem:editButton];
"self" is the root ViewController of a NavigationController.
As you could imagine, it's a problem since the cells are selectable to push another ViewController.
I managed to go around the problem by making the cells' height bigger but I'd rather have them at the regular size.
I'm sure I'm not the only one with this case of scenario. Thanks in advance.
UIButton *menuButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
[menuButton addTarget:self action:@selector(revealMenu:) forControlEvents:UIControlEventTouchUpInside];
[menuButton setImage:[UIImage imageNamed:@"menuIcon"] forState:UIControlStateNormal];
UIView *menuButtonContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
[menuButtonContainer addSubview:menuButton];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:menuButtonContainer];
This perfectly worked for me....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With