cabrera
cabrera

Reputation: 31

Two different viewports for ipad's portrait and landscape views

Is there a way to specify two different viewports, one for portrait and one for landscape mode, in the ipad?

I have a page that seem to be needing two different values for things to look ok. Is this possible?

I need (in portrait mode): meta name="viewport" content="width=device-width, initial-scale=0.7, maximum-scale=1.0"

And (in landscape): meta name="viewport" content="width=device-width, initial-scale=1.0"

Upvotes: 0

Views: 664

Answers (1)

PengOne
PengOne

Reputation: 48398

You can use a simple conditional

if (self.interfaceOrientation == UIInterfaceOrientationPortrait ||
    self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
    // do stuff for portrait
} else {
    // do other stuff for landscape
}

Upvotes: 0

Related Questions