ios - UIButton responds to event outside of frame -
this question has answer here:
- uinavigationitem button touch area large 2 answers
i have navigation controller i've added uibutton navigation bar, there's wrong it. if tap way outside of button, still calls it's action.
this how create , add button:
uibutton *backbtn = [uibutton buttonwithtype:uibuttontypecustom]; [backbtn setimage:[uiimage imagenamed:@"btn_back.png"] forstate:uicontrolstatenormal]; [backbtn addtarget:self action:@selector(backpressed:) forcontrolevents:uicontroleventtouchupinside]; [backbtn setframe:cgrectmake(0, 0, 70, 30)]; //[backbtn setframe:cgrectmake(20, 7, 70, 30)]; self.navigationitem.leftbarbuttonitem = [[[uibarbuttonitem alloc] initwithcustomview:backbtn] autorelease]; here's tap range of button:
it default size of left button , right button . can nothing left , right button. because area of left , right button. if wanna custom button in case show given frame it'll work in left button's whole area.
Comments
Post a Comment