how can i set button's image and title correctly position.
now the storyboard preview like:
I add title and image to the button and set title and image edgeinset to get picture layout. but the button'size is changed with the phone size. so i can't set it in storyboard properly for all size.
i want to to know is there a way to deal with this situation?
thanks!
see the tutorial link below ,
http://www.appcoda.com/introduction-auto-layout/
it's show how to fix constant heigh and width of view.
you see clear in image how it done.
Related
I can successfully take a photo and set it to the background image for a button. The problem is that the image gets smushed. Should I be setting a crop on it or what am I missing for this to render the image correctly. Thanks.
After properly using constraints in the IB, the image then set to the button in a normal format. I found out that having dotted lines on the view controller due to constraints is a bad thing. After doing constraints the right way, the image showed perfectly. Thanks all for the help.
I have settings View which is a View Object under self.view.
I added the background image as: self.settingsView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"settings_bg__650x740.png"]];
The problem is, it is having extra images at the bottom. This only happens in iOS 7.
Here's the screenshot:
Please, help me to solve.
The image is being tiled. Why are you creating a tiled image and using it as a background color? Just put the image in a UIImageView and add the image view to the view.
try resize your image before adding to background.
You can find answer in here
Stretching a image in iOS using colorWithPatternImage
the settings view's bound size is higher than the background color referred image. so, the image will tile to fill the settings view.
I have an image with irregular shape. I set it as a background image of an UIButton.
Now, I use OBShapedButton library to enable touch only where image is non-transparent. But, for some reason if I click on transparent image area, when view appears in screen, then it responds to click, whereas it should not.
I made some area of image transparent using adobe cs4 photoshop. Now, I want to try making it transparent in xcode only. May be it helps.
To have an idea of image shape I am attaching a sample image.
Does anyone know how to do that?
I was trying to add a background image to UITextField through Storyboard, but discovered a strange bug. When I'm trying to change Stretching under the View section of the Attributes inspector, the background image in the textfield does not change at all. I have also tried to do this with .xib file, but got the same result. And also I got the same result in UIButtons.
Try it yourself. Put a textfield into a view controller and add a background image to it and set stretching to 0.5, 0.5, 0, 0 You should get nothing.
So, is it a real bug or I'm doing something wrong?
I am using UITabBarItem. If i set image, its not correctly displayed. Image is "zoomed", so I can see only top part of it. Image size is 60x60px.
I am setting image from xcodes XIB editor -> BarItem -> Image
Whats wrong with it ? According to Apple Doc, image should be 60x60 for Retina and even bigger images should be auto-scaled to fit viewing area.
When you are supplying a retina image you should name it with [name]#2x~iphone.png or [name]#2x~ipad.png. Then, in the IB you should put the name of the file without the whole suffix, so just [name] instead of [name]#2x~iphone.png. The image won't show up in the IB, but should be ok in the live app.
First, you have to make two icons, one of 30x30, and a second one 60x60 with "#2x" appended at the end of your filename.
Then bind the 30x30 icon to your UITabBarItem in XIB editor. Apple should select automatically the appropriate picture to display depending on the device it's running on.