thisguy
thisguy

Reputation: 71

Rotate an image on iPhone only?

How would one rotate an image using the following line of code but for iPhone only?

PhotoView.transform=CGAffineTransformMakeRotation(M_PI*0.5);

My app uses a UIScrollView. In the scrollView are thumbnail images. When a thumbnail is tapped, a segue is triggered to load an image in a new view controller, but for some reason, the image loads on its side on iPhone 4 (it loads perfectly straight on iPad mini)

I used the following if statement format to no avail...

 if ([[UIScreen mainScreen] bounds].size.height == 480)
    {
        // iPhone, iPod Touch
     ...
    }

My question: Is there another way to explicitly rotate the image on iPhone devices only? The following line successfully rotates the image correctly for iPhone uses, but conversely erroneously loads it for the iPad.

PhotoView.transform=CGAffineTransformMakeRotation(M_PI*0.5);

How can one programmatically rotate an image for iPhone 4 only? Additional info: this is technically an iPhone app under build settings.

Upvotes: 0

Views: 53

Answers (1)

Pradumna Patil
Pradumna Patil

Reputation: 2220

Try this

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad){
}
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
}

Upvotes: 1

Related Questions