On my iPhone app I have it restricted to portrait only under the project targets deployment info
There is one page that I want only in landscape and I use the supportedInterfaceOrientations method to obtain that.
Standard implementation:
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.Landscape
}
It works perfectly on all iPhone devices and iOS version except for iPhone 6+. The supportedInterfaceOrientations method is never called.
I cant find any reason why this might be affecting just the iPhone 6+, any tips would be greatly apreciated.
you can try this code it works for me
// you have to import foundation
import Foundation
class YourViewController : UIViewController {
var device = self.platform()
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(true)
if device.lowercaseString.rangeOfString("iphone6plus") != nil {
supportedInterfaceOrientations()
}
}
// add this method to your view controller
func platform() -> String {
var sysinfo = utsname()
uname(&sysinfo) // ignore return value
return NSString(bytes: &sysinfo.machine, length: Int(_SYS_NAMELEN), encoding:
NSASCIIStringEncoding)! as String
}
Please note that this will not run on the simulator but will run perfectly on the actual device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With