uinavigationcontroller - iOS UIBarButtonItem CustomView -


i made custom view leftbarbuttonitem, not left justified, find uinavigationbarbackindicatorview on debugger not visible, want alignment left uinavigationbarbackindicatorview.

uiview *view = [[uiview alloc] initwithframe:cgrectmake(0, 0, 50, 30)]; view.backgroundcolor = [uicolor redcolor]; uibarbuttonitem *leftitem = [[uibarbuttonitem alloc] initwithcustomview:view]; self.navigationitem.leftbarbuttonitem = leftitem; self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@"close"                                                                           style:uibarbuttonitemstyleplain                                                                          target:self                                                                          action:@selector(cancel)]; 

debuger view:

i wish

i hope might achieve looking for.

uibutton *abtn = [[uibutton alloc]initwithframe:cgrectmake(0, 0, 50, 30)]; abtn.backgroundcolor = [uicolor redcolor]; uibarbuttonitem *spacer = [[uibarbuttonitem alloc]initwithbarbuttonsystemitem:uibarbuttonsystemitemfixedspace target:nil action:nil]; spacer.width = -13.0; self.navigationitem.leftbarbuttonitems = [nsarray arraywithobjects:spacer, abtn, nil]; self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@"close"                                                                       style:uibarbuttonitemstyleplain                                                                      target:self                                                                      action:@selector(cancel)]; 

do not forget add action button.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -