iphone - UIImage Animation Causing App to Crash / Memory Leaks -
i'm using uiimage animation , causing numerous memory leaks , crashes different users using application.
below code. preloading set of 2 animation in viewdidappear
pointsview.image = [uiimage imagenamed:@"c72.png"];
nsmutablearray *menuanimationimages = [[nsmutablearray alloc] initwithcapacity:21]; nsstring *imagename; for( int anicount = 0; anicount < 72; anicount++ ) { imagename = [nsstring stringwithformat:@"c%d.png", anicount]; [menuanimationimages addobject:[uiimage imagenamed:imagename]]; } pointsview.animationimages = menuanimationimages; pointsview2.image = [uiimage imagenamed:@"i72.png"]; nsmutablearray *menuanimationimagess = [[nsmutablearray alloc] initwithcapacity:21]; nsstring *imagenames; for( int anicounts = 0; anicounts < 72; anicounts++ ) { imagenames = [nsstring stringwithformat:@"i%d.png", anicounts]; [menuanimationimagess addobject:[uiimage imagenamed:imagenames]]; } pointsview2.animationimages = menuanimationimagess; }
i running animation using
pointsview.animationduration = 3.11; pointsview.animationrepeatcount = 1; [pointsview startanimating];
any suggestions?
please read blog post subject: video-and-memory-usage-on-ios-devices. root of problem cannot have many images loaded main memory @ same time. need not use uiimageview.animationimages api, badly broken , lures developers writing bad code crash when run on device.
Comments
Post a Comment