I'm trying to modify the frame of a UIImageView
when a specific rotation happens, but when i change it the UIImage inside the UIImageView
doesn't look affected, and if i NSLog the UIImageView
frame size its changed, but its not reflected on the view, why this happens?
@property (strong, nonatomic) IBOutlet UIImageView *couponBg;
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if ((UIInterfaceOrientationIsPortrait(fromInterfaceOrientation)) &&
UIDeviceOrientationLandscapeRight == [[UIDevice currentDevice] orientation]) {
self.couponBg.frame = CGRectMake(0, 0, self.couponBg.frame.size.width, self.couponBg.frame.size.height);
NSLog(@"FRAME:%@", NSStringFromCGRect(self.couponBg.frame));
self.couponBg.frame = CGRectZero;
NSLog(@"FRAME:%@", NSStringFromCGRect(self.couponBg.frame));
}
}
I get the correct frame sizes in NSLog:
2013-11-23 17:05:00.674 -----[10302:70b] FRAME:{{0, 0}, {320, 199}}
2013-11-23 17:05:00.674 -----[10302:70b] FRAME:{{0, 0}, {0, 0}}
But in the view the Image is always the same size ? Why is this happening?
UIImageView
that has been added to your view toself.couponBg
Can you verify that you have done this? – Adam