문제

I'm using a custom created loading spinner for my iOS app, but the edges looks rough on a coloured background as expected from a GIF.

How do other apps handle this situation? Do they use anything other than GIF, maybe APNG or something? Cause with GIF, the edges are always going to be rough, if matte is used, it would look good on just one color and not the others.

Any solution?

도움이 되었습니까?

해결책

The UIImageView class provides the easiest way for developers to implement animations. All you need to do is to create an UIImageView object with a series of images for animating.

Example

// Load images
NSArray *imageNames = @[@"win_1.png", @"win_2.png", @"win_3.png"];

NSMutableArray *images = [[NSMutableArray alloc] init];
for (int i = 0; i < imageNames.count; i++) {
    [images addObject:[UIImage imageNamed:[imageNames objectAtIndex:i]]];
}

// Normal Animation
UIImageView *animationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(60, 95, 86, 193)];
animationImageView.animationImages = images;
animationImageView.animationDuration = 0.5;

[self.view addSubview:animationImageView];
[animationImageView startAnimating];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top