iphone - Why don't my TabBar buttons autoresize on the iPad? -


i'm building universal ios app , ipad version uses splitviewcontroller. in popover view, have uitabbarcontroller 2 buttons. when runs on iphone, tabbar buttons correctly stretch fill entire width of view...

enter image description here

...but on ipad, in popover view, buttons don't stretch fill entire width...

enter image description here

i'm creating uitabbarcontroller programmatically...

inspectiontabbarviewcontroller *inspectiontabbarvc;     inspectionlistviewcontroller *inspectionlistvc;     self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];   if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) {          inspectionlistvc = [[inspectionlistviewcontroller alloc] initwithsunday:no];         inspectionlistvc.managedobjectcontext = self.managedobjectcontext;         uinavigationcontroller *calendarnavvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:inspectionlistvc];         calendarnavvc.title = @"calendar";          inspectionmapviewcontroller *mapviewvc = [[inspectionmapviewcontroller alloc] initwithnibname:@"inspectionmapview_iphone" bundle:nil];         uinavigationcontroller *mapdnavvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:mapviewvc];         mapdnavvc.title = @"map";          inspectiontabbarvc = [[inspectiontabbarviewcontroller alloc] init];         [inspectiontabbarvc addchildviewcontroller:calendarnavvc];         [inspectiontabbarvc addchildviewcontroller:mapdnavvc];         self.window.rootviewcontroller = inspectiontabbarvc;     }      else      {         inspectionlistvc = [[inspectionlistviewcontroller alloc] initwithsunday:no];         uinavigationcontroller *calendarnavvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:inspectionlistvc];         calendarnavvc.title = @"calendar";          inspectionmapviewcontroller *mapviewvc = [[inspectionmapviewcontroller alloc] initwithnibname:@"inspectionmapview_ipad" bundle:nil];         uinavigationcontroller *mapdnavvc = [[uinavigationcontroller alloc] initwithrootviewcontroller:mapviewvc];         mapdnavvc.title = @"map";          inspectiontabbarvc = [[inspectiontabbarviewcontroller alloc] init];         [inspectiontabbarvc addchildviewcontroller:calendarnavvc];         [inspectiontabbarvc addchildviewcontroller:mapdnavvc];          detailviewcontroller *detailviewcontroller = [[detailviewcontroller alloc] initwithnibname:@"detailviewcontroller_ipad" bundle:nil];         uinavigationcontroller *detailnavigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:detailviewcontroller];          self.splitviewcontroller = [[uisplitviewcontroller alloc] init];         self.splitviewcontroller.delegate = detailviewcontroller;         self.splitviewcontroller.viewcontrollers = [nsarray arraywithobjects:inspectiontabbarvc, detailnavigationcontroller, nil];          self.window.rootviewcontroller = self.splitviewcontroller;         inspectionlistvc.detailviewcontroller = detailviewcontroller;         inspectionlistvc.managedobjectcontext = self.managedobjectcontext;          detailviewcontroller.detailviewcontrollerdelegate = inspectionlistvc;     }      [self.window makekeyandvisible]; 

i tried setting autoresizemask inside inspectiontabbarviewcontroller's loadview method using following statement...

self.tabbar.autoresizingmask = uiviewautoresizingflexibleleftmargin | uiviewautoresizingflexiblerightmargin | uiviewautoresizingflexiblebottommargin | uiviewautoresizingflexiblewidth; 

...but didn't work either. how can uitabbar buttons fill entire width of of view?

thanks in advance help!

change uitabbar property itempositioning uitabbaritempositioningfill:

self.tabbar.itempositioning = uitabbaritempositioningfill; 

swift version:

tabbar.itempositioning = .fill 

uitabbar itempositioning reference


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -