Discussion Forums  >  Status Bar, Navigation Bar

Replies: 3    Views: 284

Shorewalk
Lost but trying
Profile
Posts: 54
Reg: Nov 06, 2012
location unknow...
10,040
04/23/14 12:11 PM (5 years ago)

Tab bar icon selected

How to add a custom tab bar icon, one for the unselected appearance and one for the selected appearance for iOS7?

If i have to images (outline and filled) where to put them? Do i need to make changes in the code. If so where and how?



Is this the place to make changes?

Arround line 625 BT.application.m

UIImage *tabBackgroundImg = [[UIImage imageNamed:@"tab-background.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
UIImage *tabSelectedImage = [UIImage imageNamed:@"tab-background.png"];
[[rootTabBarController tabBar] setBackgroundImage:tabBackgroundImg];
[[rootTabBarController tabBar] setSelectionIndicatorImage:tabSelectedImage];
[[rootTabBarController tabBar] setSelectedImageTintColor:[UIColor whiteColor]];
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
04/23/14 09:49 PM (5 years ago)
Welcome to Buzztouch!

You might want to talk to Chris1 about customizing the tab bar. The 'default' iOS tab bar doesn't have 'on/off' icons. The same icon is tinted differently depending on if it's active or not.

You can change them though; there are millions on the net, and if you want to create your own, that's not 'too' hard either; there are a couple of tutorials in the 'how to' section of the BT Website.

Take a look there and see if that answers your questions. If not, drop back by the forum and let us know!

Cheers!

-- Smug
 
Shorewalk
Lost but trying
Profile
Posts: 54
Reg: Nov 06, 2012
location unknow...
10,040
like
04/24/14 12:53 AM (5 years ago)
Hi Smug
Thanks for your reply

I'm trying to create a similar appearance described on Appels HIGuidlines:
If you’re designing a custom tab bar icon, you should provide two versions—one for the unselected appearance and one for the selected appearance. The selected appearance is often a filled-in version of the unselected appearance...

I have no problem creating icons, but if I need to write code it gets worse. As it is now on my app the visible icon only shows exterior lines and I want an icon that is filled when selected.

You write.. The 'default' iOS tab bar doesn't have 'on/off' icons. The same icon is tinted differently depending on if it's active or not...
So, can I accomplish a filled-in version with BT code without writing code? (= put the icons in the right place in the existing code).
I have seen that there I a plugin “Tabbar Utilities” . Is this a option for my goal or exists there already a possibility that I have not discovered yet?

Shorewalk
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
04/24/14 01:36 AM (5 years ago)
With respect to Apple Guidelines, whatever they say is usually correct. And it would stand to reason that a 'custom' tab bar could have additional properties not available in the default stuff.

I'd say check out Chris1's 'Tabbar Utilities' and see if it does what you want it to do.

It's a pretty clever way around coding the core of the system.

https://www.buzztouch.com/plugins/plugin.php?pid=59E81CC887CE049B7C62D8C

With respect to using custom icons in the default BT Tab Bar, all you have to do is specify the icons in your control panel (under layout -> tabs) and tell it which icon you want to use.

The trick there, is it can't be just 'any' icon, but a special kind of icon with an alpha channel that renders it some funky way. The bottom line is, a 'regular' jpg or png might not work.

If you have pixelmator, I wrote a little tutorial on how to create tab bar icons:

https://www.buzztouch.com/files/howtos/pixelTabIcons.pdf

and I wrote that basically so I could take advantage of the cool stuff done before me by MGoBlue:

https://dl.dropboxusercontent.com/u/115208762/Tab_Bar_With_Custom_Center_Tab.pdf

(warning: that document is a little out of date, but the overall idea still applies. Just slightly updated code in a slightly renamed class)

Hope this helps a little bit. Don't be shy if something went unanswered.

Cheers!

-- Smug
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.