iphone - Custom NavigationItem's TouchUpInside Event is outside boundaries -


i'm using custom uibarbuttonitem replace leftbarbuttonitem, when press outside of button, within around 20 pixels of button, detects button being pressed.

here's code:

- (void)changenavbarbuttons {     uibutton *backbutton = [[uibutton alloc] initwithframe:cgrectmake(0, 0, 44, 44)];     [backbutton setbackgroundimage:[uiimage imagenamed:@"navbarback.png"] forstate:uicontrolstatenormal];     [backbutton addtarget:self action:@selector(popviewcontroller) forcontrolevents:uicontroleventtouchupinside];      uibarbuttonitem *backitem = [[uibarbuttonitem alloc] initwithcustomview:backbutton];      uibarbuttonitem *negativespacer = [[uibarbuttonitem alloc]                                        initwithbarbuttonsystemitem:uibarbuttonsystemitemfixedspace                                        target:nil action:nil];     negativespacer.width = -5;      self.navigationitem.leftbarbuttonitems = [nsarray                                               arraywithobjects:negativespacer, backitem, nil];    self.navigationitem.hidesbackbutton = yes; } 

the negativespacer move button 5 pixels left.

what causing this?

it default behaviour of uinavigationbarbutton item. it's ease of use. navigation bar @ top tends mean people tap lower may expect. leave gap there, or have sufficiently large hit area user stabbing finger towards middle of "below nav bar" item avoid dead area.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -