I want to have the same background for every size of iPhones and iPads using scale to fill mode.
This is my background:
This is how my Image View looks in Xcode:
The question is why it doesn't scale to fill when I run this on emulator (iPhone 4s)?
Any ideas for this problem?
Set constrain of imageView as below image. Add adding 4 Constrain.
OUTPUT :
Related
How can I change button background image - I need one for all iPhones and another (due to size) for iPads. I have square buttons imitating keyboard with smaller background image. On iPad font on buttons is twice bigger, but they are not squares anymore. So I made bigger backgroud image to make them squares again, but how can I change that image only for iPads in storyboard. Is it possible?
Thanks.
on iPhones:
on Ipads:
You can design the layout using size class. The size class for iPad is R*R.
newbie here.
I started with iphone 6 for my app.
Say I have a button with fixed size w: 60 and h: 60 and I have a background image for the button : btnImage#2x.png, btnImage#3x and I dont have btnImage#1x.png ( if needed, can use btnImage.png or btnImage#1x.png ?) The size of the image is : 120x120.
In Design view for iphone6. It looks good.
Problem:
1. When viewing in iphone 6+ ( or iphone 7+) in Design view or storyBoard, The Image for the btn look small inside the button? I have btnImage#3x.png ,why it did not scale up with #3x image?
What I must do when change from iphone 6 to iphone 6+?
--UPdate
Button has two properties : 1) Image 2) Background
using (1) will not scale up
using (2) , it will scale.
Which one is the proper one?
Please help. Thanks
As much as I know the UIButton background image doesnot get scaled. Unless its bigger than the button size resolution.
I guess that a more proper way to do this. Is to add a UIImageView
behind your button and set the image to it.
Alternativly, try the content alignment:
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentFill
button.contentVerticalAlignment = UIControlContentVerticalAlignmentFill
This also can be found on storyboard.
I had Used UICollectionView to show three images in each cell in portrait and landscape mode using AutoLayout. Fetch images from server to load in UICollectionView data. In iphone 4s and 5 working little better but iphone 6 and 6 plus Image stretching issue in portrait and landscape mode. I had tried AspectFit but i need to fill image in full space. I had spent more time with this so How to solve this issue? please let me your suggestions.
Thanks in Advance
FYI, Screenshot
You need to use AspectFill
AspectFit Keeps the aspect ration, but showing all the image, therefore it won't fill your imageView, and AspectFill keeps the aspect ratio, and filling your imageView, therefore it wont show all the image, think about it like sort of cropping the image to fit in your imageView.
I am new to IOS. I have a ViewController in which i add a Container in it. Then there is another ViewController in which i have a image and after the image there is a text view. The problem i am facing is when i run this app on Iphone 5 everything works perfect But when i run the app on Iphone 4s, the space grey bar appear between image and textView.I dont know how can I resolve this issue.
here are the images
I want to ask one thing more is I want to start the text in textView after two or three line breaks from top.How can i start a text after some line breaks starting from top?
Try Using auto-layout if you are using autolayout else try autoresizing for the views as iPhone 5 is 4-inch (320*568) display and iPhone 4s is 3.5-inch (320*480). So the issue is because of the different resolutions.
Weird problem here which may be a bug in Xcode...
Using an Xcode 5.1.1 storyboard with auto layout, I am working on the design of a view controller that contains a full iPhone 4 sized UIImageView that references an xcassets image set. The xcassets image set includes 1x and 2x iPhone 3.5-inch images, and an iPhone 4 R4 image.
Problem 1: Once I set the Image View Image for the UIImageView in the utilities panel using a View Mode of Aspect Fit, the storyboard shows the smaller iPhone 3.5 image with white spaces at the top and the bottom of the view instead of the iPhone 4 image which would fill the entire storyboard representation of the view, as they are the same size since Xcode infers an iPhone 4 sized screen in the storyboard.
Problem 2: If I ignore problem 1 and run the program using the iPhone Retina (4-Inch) simulation, the applications selects the correct image size from xcassets and everything seems fine. However, if I run the simulation using the iPhone Retina (3.5-Inch) simulation, the applications also selects the correct sized image, but pushes the images down and display white space at the top of the page.
Before I start hacking around these problems, I thought I would reach out and see if anyone else has experienced either of these issues. Any help will be greatly appreciated.