0

So I'm animating a set of images using a UIImageView. It works, but things are resizing oddly. I initialize everything within my extended UIImageView class like so:

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];

Whereprp.frames andprp.frameDur are values I'm passing in from a struct of custom properties.

The problem I'm having is that the size of the images is different at each stage. My source images are all 59x47. tImage (UIImage) is set as 46x26 (checking the size.width and size.height properties). tFrame (UIImage) is set as 53x35 (checking the same properties). Does anyone have a clue why this would be happening? Why doesn't it initialize as the original image size (59x47) and why would the two UIImage objects based on them be different from each other??

askedNov 14, 2012 at 7:02
Gothic's user avatar

1 Answer1

0

I figured it out on my own. I had changed the source image used with tImage from a 46x26 size to 59x47 by replacing it (same image name between both). It was still using the 46x26 image, in a cache or something I guess. I fixed it by Cleaning and Rebuilding the project. All is well. So this can be closed or whatever.

answeredNov 15, 2012 at 0:21
Gothic's user avatar
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.