Storyboard with Custom Buttons - xcode

I have a storyboard setup properly with buttons leading to different scenes, however I'm not happy with how the buttons look. They all have a perfectly square border around the images... like the images are inside a box.
Is there any way I can remove that border and simply have my image in the view, but the image still serves as a button?

I guess what you want is to use an image as a "button".
Select the button in storyboard
In "attibutes inspector", select
Button, type to "Custom", set the "background" to the image you've added to the project.
Should work.

Related

How to add an image by pressing a button in JavaFX

I want to be able to press a button and an image appear on the page.
Additionally, I want to be able to place the button with Y and X coordinates, not through layouts.
Would I need to use an image view?
Your question isn't very precise, so I hope I answer what you need.
To show an Image generally you need an ImageView, that is correct. For less common image formats you might need an external library.
To only show the image when the button is clicked, you have to first set the ImageView to not managed and not visible. Then when the button is clicked make it visible and managed and it will show.
About the absolute positioning of your button, you can override the layout children of any Parent object and set exact positions. Take a look at this question.

Navigation Controller back button image manipulation

I am, no matter what I try, unable to change the back button colour and default image.
Here is what it looks like rite now:
The leftmost arrow is the default and the right most is my custom arrow.
This is how I set it up in storyboard:
How do I remove that pesky default image and replace it with my own?
The button you are adding is overriten by the default back button provided by the navBar. The only way you could do that is by adding it from within the code and by creating an UIButton inside the UIBarButton with an image and/or text, you should set its action a popViewController.

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.

Changing images of toolbar buttons dynamicaly

I have a tool bar with buttons whose image is set to a particular image.When the user clicks a button in the main view, i want to change the image of one of the toolbar buttons to another image.I tried many methods.Everything ran without errors, but none showed any change in toolbar.Any suggestions?
There is a tutorial for this:
How-to-change-a-uibarbuttonitem-in-the-iphone-toolbar
This is a great tutorial because it goes over changing the images based on state as well.

How can I change the way NSButtonCell objects highlight when clicked?

I am using several NSButtonCell objects in an NSTableView. They are simple square buttons with custom images on them.
These buttons draw properly when they are not highlighted: all that is visible is the image, and the rest of the button rectangle is transparent. However, when I click on them, the entire button rectangle is highlighted, inverting the background in the parts that were transparent.
I would prefer to see the image drawn inverted, and the transparent parts remain transparent. How can this be done?
Try setting your cell's highlightsBy property to NSContentsCellMask. I think you'll have to do this in code (probably in awakeFromNib); I don't see a way to do it in IB alone.
You can do it in Interface Builder too. I use "Square Button" so the button alters between two images (so the image is not inverted at all).
Your buttons behaviour is probably set to "Momentary Light" or "Momentary Push In".
Set the Behaviour to "Momentary Change", and it should work.

Resources