Custom button with style of NavigationBar back button - uibutton

Is it possible to make a custom button that looks like a back button in NavigationBar? I mean the shape of the left side that is like an arrow.

No, there isn't. You will have to draw it yourself to an image file and set it as a background to your custom button.

Related

UIButton with custom shadow image

I need to achieve effect of my button like this:
My questions are:
How can I add this custom shadow to button, so only 'BUTTON' surface reacts for touches?
When I have the next button in the bottom, close to previous one, how can I be sure that it will not be covered by upper's button shadow?
I need to have all the buttons in front and all the shadows in the back.
If you want to add the shadow without having it clickable, you need to add an imageView to as a subview to the button. (make sure clip subviews is disabled).
If you want the shadow of one button not appearing on top of the other, then you need to have the shadow(s) added separately to the main parent view. The solution in option 1 will not work. Its not neat, but its the only way i can think off.

Xcode Interface Builder set highlighted image for button

I'm making an cocoa application from Mac OS X, not for iphone.
I am able to set the background image of a button and uncheck bordered in the attribute inspector. However, I do not know how I set the image for when you click on it (highlighted/on click, whatever you want to call it). I want to do this because
I have found guides on google to do this with UIbutton but this isn't helpful since I'm making this for Mac.
I am using InAppStoreWindow and the button is in the Title bar. When I click on the button with the custom image, the background goes white:
Thank you very much!
You are getting white background when button is clicked because You're using incorrect type. You need to change button's type to Momentary Change. You can change it in Attributes inspector:
Or change programatically:
[buttonOutlet setButtonType:NSMomentaryChangeButton];
And for highlighting: just add another image as alternate image in Attributes Inspector and it will be shown when button pressed.

custom navigation bar?

I have a custom navigation bar that looks like this:
I set it as the background image of the navigation bar. But how do I implement the buttons? I want to be able to click on the individual text and have an action happen
Could I possibly add a gesture recognizer over each word on the image?
Put an invisible button on the toolbar for each place you want to have a button. If you want this to look and behave exactly like a normal toolbar, however, you can't have the buttons be part of the background image. It's very easy to make a toolbar that looks like what you have in IB.
It took longer to upload this to imgur than it did to make it!

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

iphone app navigation bar multiple items

how can I have a back button and another button both on the left side of the nav bar?
Do you also need the title? If not, you can simply place the button in the center area. Otherwise, if you also need the title, you will need to create a UIView with a label and a button in it and set that as the center view. You will have to set the label's text manually if the title of the view ever changes.
Or, if you don't care too much about the back button, you can create a button that looks like the back button and put your other button next to it in a parent view that you use as the left view. You would have to manually handle going back when pressing the back button, and unless you got an image that looks like the back button, your button would not have the arrow shape.