Question

I am creating a custom view in Interface Builder. The view has a UITabBar at the bottom. I want to set the icon of each "button" to one of the system provided icons that are in Apple's UITabBarItem Class Reference.

I tried to do this by typing in 'UITabBarSystemItemRecents' in the 'Image' field found at Inspector -> Attributes inspector -> Bar Item -> Image. Before this, I first selected the UITabBar and then the UITabBarItem I wanted the image for.

This did not work however, I just get a square instead. I did some searching and found that you can set the icon programmatically, but I want to do as much as possible of the view in Interface Builder.

I use Xcode 5.0.2 and develop for iOS 7.

Was it helpful?

Solution 2

Note: The full credit should go to null and akash. They contributed by answering half of the question each.

You can't have one of the icons from Apple that are avaible directly in Interface Builder and have a custom title. Instead, you must download the icon you want to use (Apple-looking icons are avaible at icons8), add it to the project resources and then pick it from the dropdown menu at Inspector -> Attributes inspector -> Bar Item -> Image.

OTHER TIPS

You can easily set it in Attributes inspector on right panel..Set image as shown below

enter image description here

If you drag and drop images in you file.access it from media library:

enter image description here

If you want to use Apple's Recent image then you need to select it from inspector -> Tab Bar Item -> Identifier.

Alternatively you can add the image you want to your app and pick it from inspector -> Bar Item -> Image.

Note that if you choose the identifier you cannot set the title and vise versa.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top