You need to rotate your yourimageview
by 90 degree in landscape mode -
In AppDelegate.swift inside the "didFinishLaunchingWithOptions"
function I put:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "rotated", name: UIDeviceOrientationDidChangeNotification, object: nil)
and then inside the AppDelegate
class I put the following function:
func rotated()
{
if(UIDeviceOrientationIsLandscape(UIDevice.currentDevice().orientation))
{
print("landscape")
//Rotate 90 degrees clockwise:
yourimageview1.transform = CGAffineTransformMakeRotation(CGFloat(M_PI_2))
//Rotate 90 degrees counterclockwise:
yourimageview2.transform = CGAffineTransformMakeRotation(CGFloat(-M_PI_2))
}
if(UIDeviceOrientationIsPortrait(UIDevice.currentDevice().orientation))
{
print("Portrait")
}
}
Hope this helps anyone else!