Kevin Albrecht
Kevin Albrecht

Reputation: 7014

Remove TabGroup tab title and show only icon on Appcelerator app for iOS

How can I hide the "title" text in the tabs in a TabGroup in an Appcelerator app for iOS?

By default, if I just leave the title attribute blank, it leaves extra space where the title would usually appear.

How it appears with "title" text:

enter image description here

How it appears without "title" text:

enter image description here

How I want it to appear:

enter image description here

Upvotes: 0

Views: 630

Answers (1)

Kevin Albrecht
Kevin Albrecht

Reputation: 7014

This fix works, though it is a little hackish:

  1. Go to /Users/[yourname]/Library/Application Support/Titanium/mobilesdk/osx/4.1.0.GA/iphone/Classes/

  2. Open the file "TiUITabProxy.m" in Appcelerator Studio and make the following updates.

  3. In TiUITabProxy.m search for "(void)updateTabBarItem" and insert this line:

    [ourItem setImageInsets:UIEdgeInsetsMake(6, 0, -6, 0)];

    right before the following line at the very end of the function:

    [rootController setTabBarItem:ourItem];

  4. Clean your project and rebuild.

There is an opened JIRA ticket for this to add this to Titanium proper: https://jira.appcelerator.org/browse/TIMOB-18515

The solution was originally provided in the Appcelerator Community forums at https://community.appcelerator.com/topic/2878/remove-tabgroup-tab-title-and-show-only-icon-on-ios/7

Upvotes: 2

Related Questions