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)];
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
Post a Comment