How to draw UIButton with tint color like UIToolbar - cocoa-touch

I want to customize my button like those UIBarButtonItems on a UIToolbar with tint color. Does any one know how to draw that tint effect?

I went nuts trying to figure this out once.
The best I could do was to do my own "custom" button, and use it as the button's "image".
The real hard part was getting the font right. The web said it was supposed to be "Helvetica" I believe - but it never looked right.

The thing you're trying to do isn't supported. You should just make your own button that looks the way you want it to and set it as the customView of the button item object.

Related

Add button to white background NSPopover, but the button has shadow area

all:
I have one customized NSPopover, and I set it's background color into white. Then I add one Button without border into the viewcontroller, and put the viewcontroller into the NSPopover. The question is that, there will be shadow area for the button in this NSPopover, could someone have any ideas about this?
The issus is also exist for Label.
The customized NSPopover code is as follow:
https://github.com/shergin/NSPopover-MISSINGBackgroundView
and the result is:The final result of adding button to NSPopover
This is a known bug.
Set the appearance property of the textfield to NSAppearanceNameAqua.

How to change background color of storyboard in Xcode?

I'm working with white text (labels) in Xcode, and currently I can't see them because the background of the storyboard is also white. How do I change the appearance of the storyboard?
To clarify, I do not want my text to change color, I only want to change the appearance of the storyboard so that I can develop more easily.
If you are referring to the white in your view controller:
Select the View
Go to inspector (right panel, 4th item)
Change the background color field (section view)
I'm not sure you can do what you're trying to achieve. My best advice to you would be to create a dark coloured UIView which you can place behind the UILabel. Once you're happy you've got the UILabel setup the way you want it you can then just delete the UIView.

How do you vertically centering an image on an NSButton

I'm build a Mac application in the style of the Lion Mail.app. As part of this I'm attempting to create a simular toolbar to the one in the Mail.app but I can't seem to get the image in my toolbar button centered vertically.
Looking at the Mail.app toolbar I see a nice series of buttons with centered icons:
but when I go interface builder I can't seem to recreate the same button. What I get is:
What I've tried doing is, in Interface Builder:
Create a new window
Add a NSToolbar to that window
Add an NSButton to the toolbar with Style - 'Push', Image - 'Envelope', Position - 'NSImageOnly', Scaling - 'Proportionally Down'
As you can see the icon is clearly not centered vertically on the button like those in the Mail.app toolbar.
Anybody have any ideas???
At the moment I'm using XCode 4.2 and laying out this button with Interface Builder. I'm trying to build the toolbar button by ONLY adding the image to the button and not painting the button for each item, ie drawing the border and icon.
Any help would be greatly appreciated as this has been driving me a little nuts.
Thanks in advance - AYAL
Turns out the answer to this problem was much simpler then I had expected. After a lot of teeth gnashing, hair pulling, and twiddling pixels I came across the solution.
Instead of using a 'Push' button I simply had to switch to a 'Round Textured' button. Once I did that any image I added to the button was nicely centered. Next I just had to manually scale my image to look right.
The recipe then for a Mail.app Toolbar is as follows:
Add a button to your Toolbar
Set the button style to 'Rounded Textured'
Set the image of the button
Set the position to 'NSImageOnly'
Set the button size to 40 x 25 as well as the min and max sizes of the ToolbarItem
The result is a toolbar that can look very simular to the Mail.app toolbar.
Thanks All - AYAL
One way to do it is to have your image actually be the button i.e. take up all of the button's canvas. You will have to use the button's setBordered: method so the button's border is not drawn.
you could make the button image in something like gimp or photoshop then use that as the background or image for the button.
i feel like your going to say "this is what im doing". and maybe you made the little mail icon but i mean for you to make the whole button, outline and everything, then use that for the button image. make sense?
like here, just use this as the background

adding an invisible button to the background in IB

I'm working with Xcode doing a Ipad app.
i simply want user to click anywhere on screen (not counting text fields) to perform some IBAction.I'm using an invisible button that covers my whole view.
Since I have some text fields in my view,i need to add this invisible button to the background of my user interface. I cant seem to find this option in the button attributes? any help?
Just set the button's type to custom.
Did you try setting the opacity of the button to zero?
I guess i got your point. You just want to put the UIButton(invisible) on the back of all the UITextField. The simple solution to this is open the Document Window in the IB. Now expand the view tree in the list view. Just drag your UIButton above the UITextFields and set the alpha value for the button in the property to be zero.
Hope this helps!!
iPad users don't "click". They "tap" or "touch".
In Interface Builder, I believe views are constructed with a z-index from top to bottom as they appear in the document window, so dragging your button so that it appears as the first subview of your main view should be a quick fix for this.
Have you considered other approaches? This doesn't sound like standard behaviour for an app and will probably cause havoc with anybody using Voice Over. What are you trying to accomplish?

Why and how do I change my buttons style, my the other compose button is fine?

I've changed my navigation bar style to black opaque but my done button remains blue, yet the compose button is fine / black.
Why is is happening and more importantanly how do I fix this ?
The buttons was added in IB and shows blue there, while the nav bar is black.
The best thing to do is to make sure you're using the UIBarButtonSystemItemDone system button item, unaltered. If you really want to change the appearance of your Done button, you will need to assign a custom view to the bar button item's customView property. Then you'll be able to control every aspect of its appearance.