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

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

Related

How do I blur (ios7 style) a section of an image in a UITableViewCell?

I've got a UIImageView that takes up the whole cell and shows an image. I'd like to blur the bottom third of the view in the iOS7 style (we're targeting iOS7). There will be a label over the blurred part.
The issue seems to be that I can't "screenshot" the UIImageView right as I am setting up the cell in tableView:cellForRowAtIndexPath: as it hasn't loaded yet. Although i've even tried setting up a timer for a 0.1 second delay and that also doesn't work.
I've tried the stuff on http://damir.me/posts/ios7-blurring-techniques
I've tried https://github.com/justinmfischer/7blur
I'd like to use the new screenshotting API drawViewHierarchyInRect:afterScreenUpdates:
I'd also like to use apple's sample code UIImage+ImageEffects
The only thing that has worked so far has been to just put a UIToolbar in but the performance is really slow. I don't need dynamic updates.
I've managed to get the following effect a few times but it has just tinted the view and hasn't actually blurred anything so I'm a bit confused.
Use UIImageEffects sample from apple
Make a Image View with a size of the lower portion you want to blur... and then set its image to a blurred one. also set its content mode to UIViewContentModeBottom for the proper clipping
Since your image isnt the size of the cell.. first get a temp image as it is being displayed in the cell by drawing a UIImage from it.. refer for the code here
How to capture UIView to UIImage without loss of quality on retina display
then blur that image
Load this image into a UIImage, blur the image, clip to fit the area that you want. Use UIImage+blur.h

Image gets mixed up after orientation in iPhone

I'm currently working on an app which is like a photo gallery. It supports orientations too. The UIImageView which contains the UIImage, is in UIViewContentModeScaleAspectFit. When I change the orientation of the device, some part of the UIImage gets displayed on the part of the view which is not a part of the aspect fit region.Any ideas to tackle it??
I just got similar kind of problem while using zooming effect. After changing the orientation of device while the image is zoomed in, it overlaps the imageView. Try to zoom out the image just after changing the orientation. That worked for me.

How to keep image size when changing iPhone orientation

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.

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.

is there a declarative approach to have one's background image changed from the portrait to landscape version upon orientation change in IOS?

Background - I have an iPhone/iPad app that has a background image in the main view. I'd like to introduce a specific portrait and landscape image for this background image, which is in a UIImageView subview.
Question - is there a declarative approach to have one's background image changed from the portrait to landscape version upon orientation change in IOS? For example through some file name convention approach?
(i.e. or do you have to manually change the image yourself each orientation change in the view controller's didRotateFromInterfaceOrientation)
I've never heard about such sweet opportunity. So I think you should manually reload images.