ios - How to set TabBar Image in UITabBarController -
i have used uitabbarcontroller
in application.
i confuse image size
should there uitabbar
. must support devices. iphone 4s,5,5s,5c,6,6 plus
.
sometimes it's create space between tabs. if change image size
looks blur.
i have put normal image,@2x
, @3x
.
@3x - 312*180 @2x - 160*120 normal - 80*56
so per understanding iphone 6 should take @2x
image it's not taking it. there space between tabs in iphone 6. programmatically set images iphone 6 , give it's size 93*56
. spaces between tabs has been removed , set properly. problem facing. images looks blur in iphone 6. don't know now.
can please me out here? how can manage images of tabs supports devices. in advance!
here code,
- (bool)application:(uiapplication )application didfinishlaunchingwithoptions:(nsdictionary )launchoptions { // override point customization after application launch. uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; uitabbarcontroller *tabcontroller = [[uitabbarcontroller alloc]init]; uinavigationcontroller *navcontroller1 = [[uinavigationcontroller alloc]initwithrootviewcontroller:[storyboard instantiateviewcontrollerwithidentifier:@"viewcontroller1"]]; uinavigationcontroller *navcontroller2 = [[uinavigationcontroller alloc]initwithrootviewcontroller:[storyboard instantiateviewcontrollerwithidentifier:@"viewcontroller2"]]; uinavigationcontroller *navcontroller3 = [[uinavigationcontroller alloc]initwithrootviewcontroller:[storyboard instantiateviewcontrollerwithidentifier:@"viewcontroller3"]]; uinavigationcontroller *navcontroller4 = [[uinavigationcontroller alloc]initwithrootviewcontroller:[storyboard instantiateviewcontrollerwithidentifier:@"viewcontroller4"]]; tabcontroller.viewcontrollers = [nsarray arraywithobjects:navcontroller1, navcontroller2, navcontroller3, navcontroller4, nil]; [[[tabcontroller.viewcontrollers objectatindex:0] tabbaritem]setfinishedselectedimage:[uiimage imagenamed:@"chords-active1.png"] withfinishedunselectedimage:[uiimage imagenamed:@"chords1.png"]]; [[[tabcontroller.viewcontrollers objectatindex:2] tabbaritem]setfinishedselectedimage:[uiimage imagenamed:@"progression-active1.png"] withfinishedunselectedimage:[uiimage imagenamed:@"progression1.png"]]; [[[tabcontroller.viewcontrollers objectatindex:1] tabbaritem]setfinishedselectedimage:[uiimage imagenamed:@"practice-selected.png"] withfinishedunselectedimage:[uiimage imagenamed:@"practice.png"]]; [[[tabcontroller.viewcontrollers objectatindex:3] tabbaritem]setfinishedselectedimage:[uiimage imagenamed:@"settings-active1.png"] withfinishedunselectedimage:[uiimage imagenamed:@"settings1.png"]]; self.window.rootviewcontroller = tabcontroller; return yes; }
follow iconmatrix guide provided apple. everything..
Comments
Post a Comment