특정 회전이 발생하면 UIImageView
의 프레임을 수정하려고하는데, 변경하면 UIImageView
의 UIImage가 영향을받지 않습니다. NSLog의 프레임 크기가 변경되면 UIImageView
이 변경됩니다. , 그러나 그 견해에 반영되지 않은 이유는 무엇입니까? UIImageView의 프레임 변경
@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));
}
}
난 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}}
그러나보기에서 이미지는 항상 같은 크기입니까? 왜 이런 일이 일어나는 걸까요?
나는 가장 가능성이 큰 범인은 실제로 당신이'self.couponBg'에보기에 추가 된'UIImageView'를 할당하지 않았다는 것입니다. 당신이 이것을했는지 확인할 수 있습니까? – Adam