iPhone Best practices for large number of animations using UIImageView

后端 未结 2 1140
执念已碎
执念已碎 2021-01-29 02:27

Just requesting a little advice animating images on the iphone. I\'m building an app that consists of a character with 5 animations.

Each animation consists of roughly

2条回答
  •  迷失自我
    2021-01-29 02:29

    I'd recommend the movie route, if you can get away with it. It'll be cleaner and likely much more performant.

    However, if you're stuck with images for some reason, here's performance from loading 5000 full-frame images in succession:

    [UIImage imageWithData:...] // 44.8 seconds
    
    [UIImage imageWithContentsOfFile:...] // 52.3 seconds
    
    [[UIImage alloc] initWithContentsOfFile:…] // 351.8 seconds
    
    [UIImage imageNamed:...] // hung due to caching
    

提交回复
热议问题