그래서 UIImageView를 사용하여 일련의 이미지에 애니메이션을 적용하고 있습니다. 그것은 작동하지만 이상하게 크기가 조정됩니다. 나는 그렇게처럼 내 확장있는 UIImageView 클래스 내에서 모든 것을 초기화 : prp.frames
및 prp.frameDur
내가 지정 속성의 구조체에서 전달하고있어 값입니다원본 이미지와 UIImage는 서로 다른 크기입니다
tImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@.png",tName]];
self = [self initWithImage: tImage];
NSMutableArray *frameArray = [[NSMutableArray alloc] initWithCapacity:0];
UIImage *tFrame;
for(int i = 1; i < prp.frames + 1; i++) {
tFrame = [UIImage imageNamed:[NSString stringWithFormat:@"%@%d.png", tName, i]];
[frameArray addObject:tFrame];
}
CGRect cropRect = CGRectMake(0.0, 0.0, tFrame.size.width, tFrame.size.height);
self.bounds = cropRect;
[self setContentMode:UIViewContentModeScaleAspectFit];
self.clipsToBounds = YES;
[self setAnimationImages:frameArray];
[self setAnimationDuration:prp.frameDur];
[self startAnimating];
.
내가 겪고있는 문제는 이미지의 크기가 각 단계마다 다릅니다. 원본 이미지는 모두 59x47입니다. tImage (UIImage)는 46x26으로 설정됩니다 (size.width 및 size.height 속성 확인). tFrame (UIImage)이 53x35로 설정되어 있습니다 (동일한 속성 확인). 누군가 이런 일이 일어날 수있는 단서가 있습니까? 왜 그것은 원래의 이미지 크기 (59x47)로 초기화되지 않으며 왜 그것들에 기반한 두 개의 UIImage 객체가 서로 다를 것입니까 ??