简体   繁体   中英

UITabBarController and UITabbar with background images for UIBarButon

Hello, please forgive me for asking very common question, I created uitoolbarcontroller in app delegate, and assign title for tabbar in view did load of view controller.

Code is here:

   [[self.tabBarController.tabBar.items objectAtIndex:0] setTitle:@"Exercise Dict."];

Please tell me how to set the image as background insted of title.

I added this in same method for background image:

 [[self.tabBarController.tabBar.items objectAtIndex:0] setBackgroundImage:[UIImage imageNamed:@"Beginner-1"]];

But its giving an error='NSInvalidArgumentException', reason: '-[UITabBarItem setBackgroundImage:]: unrecognized selector sent to instance 0xa25e9a0'.

尝试这个:

self.tabBarController.tabBarItem.image=[UIImage imageNamed:@"yourimage.png"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM