I have a right bar button item but I want to remove paddinf of it.I have looked all question here I tryied some of them such as fixedspace and image inset but it does not solve my problem.When I use image inset , it did not work all device.
Related
I want to create a custom tabBar like this
Now I just can create a tabBar as below, I want the 4 tab bar Items (the add sign is a button) to be centered and don't cover the button, so the cart icon should move to the left a little bit, and the mall icon should move to the right. But I don't know how to adjust the position of tab bar item, neither using storyBoard or in a programmatic way.
Thank you for your help.
You should try adjusting the insets for the individual icons. You can do this in the storyboard.
Check this post:
Moving UITabBarItem Image down?
Please modify Item Position in Attributes Inspector in Storyboard.
Select Item position as "Centered".
Choose Custom for Width and Spacing.
Play with the numbers for Width and Spacing and set it was you wish.
I create a button set image title like below picture.
I want
image
title
image on the top title below is it possible without any code?
I cant just use insets because to another size will wrong
Adjust both the title insets and the image insets.
It will need some calculations, and auto layout will probably screw it up ;)
Probably better to create a subclass of UIButton with a .xib
click the link to view my screenshot
So I am trying to customize a bar button item for this slideoutmenu I am creating. I want it to be a particular image. However I am having trouble doing this. Whenever I try to change the image programatically by saying
menuButton.image = UIImage(named: "myImage.png")
It appears to be all stretched. Whenever I tell it to be set to an image using the attribute inspector, it will do the same thing, and I am unable to resize it in the Main Storyboard and interface builder. I imagine the fix to be simple, but I am unable to figure it out. Is there possibly a way to customize the size of the navigation controller to give it more room? Does anybody have any ideas?
I misunderstood the question originally. It sounds like what you are asking is how you resize the image, because it's all stretched out. It might take a little adjusting, but you can set the image insets on the UIBarButtonItem programmatically:
menuButton.imageInsets = UIEdgeInsetsMake(5, 5, 5, 5)
This is just telling the button to draw the image inset 5pts from the top, 5pts from the left, 5pts from the bottom, and 5pts from the right. You can tweak those values until it looks how you wish.
What I need,
What I get, on adding backButtonImage,
I want to shift the backButtonImage horizontally? No answers on here seem to work for me.
Any suggestions will be welcomed.
EDIT
I am just setting back image and back mask in storyboard, here it is (nav_back)
Have a look at UIBarButtonItem Size Inspector in storyboard.
You should be able to shift image to the right by X points by setting image left inset to X and right inset to -X. This worked with bar button item with custom image but not sure if it will with default back button
I'm using Objective-C. In Xcode, I set a image(.png) to a navigation bar button item. But no matter how I change the resolution of the image, it always going to be a blue pic, big or small.
It looks like this(the right top corner):
Does the picture cause the problem? How to solve it? Thanks in advance!
It is because of Barbutton's size is fixed.
So , my advice is add UIView as Barbutton item and then add UIButton and set image According to your required size.
Check output in below image.
Your Hierarchy will be something like this ,