Setting TabBarItem title - interface-builder

I'm using the TabBar for the very first time. I see that I can easily add tabbar items to it. And I see that I can set a icon to it (choosing the identifier). I do so, but when I try to change the title, the identifier -and the icon- go away...
why? Can't I keep predefined icons with custom title text?
Thanks!

The title replaces any image, you can't have image and title on a UIBarButtonItem

Related

Set global tint in Cocoa applications

I noticed that many apps uses a custom global tint color like Pages (Yellow) or Music (Red). NSAlert default buttons respect this tint, as NSOpenPanel and others do (for example drop-down arrow as show in picture).
I alos noticed that NSAlert brings a delete button that shows text in red. Do you know how to get it to appear?
Thanks
How could I specify a specific global color. I create UI using code and not Storyboard.
Searching in Apple's app folders, such as Pages, I found what we need to do to change the app's overall tint.
Create a color object in the Asset;
In the info.plist add the key NSAccentColorName that is a string assigned to the color name created at step 1;
This colors NSAlert default buttons and all control's accent elements.

How to display image and text in NSPopupButton's items

I am working on an application and I am using NSPopupButton to have drop-down list.
I would like to know how could I display image + text in every item when I expand the list. I have seen that in the interface there is addItemWithTitle: but it takes NSString.
How could I achieve that?
Thanks
[popUpButton addItemWithTitle:#"item title here"];
[[popUpButton lastItem] setImage:[NSImage imageNamed:#"noname01"]];
You don't need to consider a custom view.
The items in an NSPopUpButton are NSMenuItems which allow you to set an image for them in addition to text.
Add the image and set the position on each menu item, like shown in the image below:

How do I add a title to a button which has a custom image?

I made a button with IB then added custom images for different states but my title never appears on my button. How can I fix it? In fact, I just want to add my text over the image.
You can set your button images as background images in interface builder, then the text will appear.
It will not appear because the image is on top of it, you can either:
1) Use backgroundImage instead of image
2) Create an image with the text already on it
3) Create a button with a transparent part where the text will go
4) Have your image and your text in the button, but say one on the left and one on the right, you can do this with this properties: titleEdgeInsets and imageEdgeInsets
5) Add the label and uiimage as subviews of uilabel.
start with a regular button type in the title and switch it to a custom button, if you want the background to be changed import and use the command yourButton.backgroundColor = [UIColor grayColor];
Try to change the Button type to "Custom" and then add the image as Background Image. Now u will be able to see the desired look.

Cocoa: Accessibility (VoiceOver) for buttons with image only

I use NSButton with empty title and image on it, and it cannot be accessed with VoiceOver.
But when I'm setting title (VoiceOver seems to use title), NSButton tries to show it.
I think there should be an easy way to not display title, or to set button text, used by VoiceOver, however quick search didn't give any results yet.
P.S. I'm creating button programmatically.
you must assign the accessibilityLabel to the image object directly, It works this way.
Solved issue - added subclass for NSButtonCell, which does nothing in drawTitle: method and returns NSZeroRect. Seems to work ok.

NSWindow shows an icon with the window path; how can I remove it?

The title explains my problem.
Here there are two images:
Icon
http://cl.ly/ACYq/icon.png
The path when I click the icon
http://cl.ly/ABMM/icon2.png
What have I done to set this?
How can I delete this icon?
If there's an icon, it means your window has a represented URL.
You can use the setRepresentedURL: method to change or disable it (passing nil).

Resources