How to keep image size when changing iPhone orientation - iphone

I have an image that's 575x300px with text inside it.
While the iPhone is in the landscape position everything's dandy, but change the orientation to portrait and the image 'shrinks' in size (resolution change?) and the text becomes unreadable.
Is there a way to maintain the image size for both orientations?
Edit - I'm talking about a web page, not an app.

Set the view's contentMode to the value you would like. You probably want a value like UIViewContentModeScaleAspectFill.

try to set the autoresizing mask property for the UIImageView to UIViewAutoresizngmasknone.

Related

How to resize the UIWebView content size on orientation?

My application has a UIWebView which consists of an UIImageView as its subview, when i change the orientation of the device, the image in UIWebView is not affected and it remains in the same position as before. So is there a way to fix this issue. i want the image to automatically allign to its respective orientation.
How about use "Size Inspector". Set as below, the image view will move to new position.
Can you see what I have done in this picture? I removed all red lines around square so that the view moves to keep ratio of distance to edge of screen.
Have a look on the autoresizingMask which defines how the view behaves if the superviews bounds changes. In Xcode you can do it in the Interface Builder/Size Inspector.

presenting same image in all orientations in fullscreen

I was just wondering how can I set up a gallery in landscape and portrait mode, and show the images as normal in both modes (not stretched or squashed). The only way I can think of is having the same image in both sizes so it can be shown the one that suits the orientation. This idea appears "dumb" to me so if someone knows a better way to set an image view in all orientations please give me some advices
Landscape and portrait are different aspect ratios. If you don't want to stretch or squash the images, you can either crop the image or letterbox it.
Cropping is where you don't show the entire image, for instance an image that covers the entire screen in portrait would have the top and bottom removed.
Letterboxing is where the entire image is shown, but with a solid colour surrounding the image. For instance, a landscape image shown in portrait would have black areas above and below the image.
It's relatively easy to do the above on the iPhone by selecting the correct content mode options in Interface Builder.
You can also supply different images as you describe, but that would just mean that you'd be cropping or letter boxing manually.
You should look at the contentMode property of your image view (or any UIView subclass, for that matter). Set it to UIViewContentModeScaleAspectFit, which will size the content of the image view to fill as much of it as possible without distorting the aspect ratio or clipping anything. In this case, just set the image view to be as large as possible, and the content mode will handle the rest.

How code in program for display same image view whatever orientation?

I want to show same image view whatever u have mode either portrait or LAndsacpe mode.5n my case when i change my UIView then image frame in scroll layout frame don't show same image it start from image no.1 but i required same image no. when i change orientation. So for that what will i do ?
It sounds like you're having problems with scroll views when the orientation changes? Have a look at this answer I posted a while ago (example code included).

Image looks blurry after start of the app

I use an image with some buttons on it in my iPad split view app. When the app starts in portrait mode, the image looks a bit blurry. When I rotate it to landscape and back to portrait, it looks crisp.
Why?
Your UIImageView has certainly an autoresizingMask that make it being placed at, for example, 0.5;0.5, or being resized so that your image is scaled.
In interface builder, under the Size Inspector (ruller icon), try tweaking parameters to get the effect you want

Question about using landscape mode with custom images on the iPhone/iPad

Hey I just had a simple question about implementing landscape mode for an app, particularly running on the iPad (but I am sure the concept holds true for the iPhone). I have a custom background image that I am wanting to use for my root view. I designed the image so that it fits the iPad screen size for portrait mode. Do I need to design a second image for landscape mode so that it fits correctly? Is that how the landscape/portrait transition works, switching between two different images? I really don't have any idea, so any help would be appreciated. Thanks!
One other thing to think about is that the UIImage class has stretchableImageWithLeftCapWidth:topCapHeight: method to take an existing image, and build a new image that can adjust to any size by repeating only the central portion of the image and leaving the corners of the image as fixed image segments.
You can load in a fixed UIImage, generate a stretchable copy using this method, and assign it to a UIImageView - then as you resize the UIImageView due to rotation, the image will adjust as needed and not resample the image.
Assuming you have a UIImageView as your backdrop, change its image property after the device orientation changes.
See Handling View Rotations in http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html