0

I am working on a project based on phonegap iOS. And we load web site pages and local html pages in the same webview. When load some page ,the view will be portrait ,and some of these pages are landscape,the others will support both landscape and portrait .Now when I try :

[UIDevice currentDevice]  setOrientation: UIDeviceOrientationPortrait];

An error occured : No visible @interface for 'UIDevice' declares the selector 'setOrientation:' Is this about the version of sdk or something else ? I saw other people can use it and just get a waring on the stackoverflow.

Sorry for my english.

Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68

2 Answers2

0

In iOS 6 setOrientation is depreciated, you should replace it with:

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

check below question for more details:

How to change the device orientation programmatically in iOS 6

Community
  • 1
  • 1
Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68
0

Since iOS6, the 'orientation' property of UIDevice is 'readonly'.

To control the interface orientations in iOS6, you can refer this Apple doc.

Ratan
  • 301
  • 2
  • 13