I have a UIImageView in bottom side of UIWindow. I want it to always display it in bottom side whatever the orientation is, but having trouble implementing it. Any Solution for this ?
Asked
Active
Viewed 187 times
1 Answers
0
NSLog(@"rotate");
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)){
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
// Rotate 90 degrees to hide it off screen
CGAffineTransform rotationTransform = CGAffineTransformIdentity;
rotationTransform = CGAffineTransformRotate(rotationTransform,DegreesToRadians(0));
delegate.imgV.transform = rotationTransform;
}
else if (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation)){
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
// Rotate 90 degrees to hide it off screen
CGAffineTransform rotationTransform = CGAffineTransformIdentity;
rotationTransform = CGAffineTransformRotate(rotationTransform,DegreesToRadians(90));
delegate.imgV.transform = rotationTransform;
}
Enjoy :-)

Rahul Vyas
- 28,260
- 49
- 182
- 256

Jayendra
- 73
- 1
- 8
-
DegreesToRadians is define value. like-- #define DegreesToRadians(x) (M_PI * (x) / 180.0) – Jayendra Aug 21 '12 at 05:50
-
I have added #define also but it's not working see screenshot – Rahul Vyas Aug 21 '12 at 08:25
-
once try to change your image view frame size when device is orientated. – Jayendra Aug 21 '12 at 09:25
-
I think window orientation is always portrait. you should check the uidevice orientation and set the imageview transformation. – Mitesh Khatri Aug 21 '12 at 13:26