animation - Two picture loops after each other objective-c -
im trying create animation pictures using code:
nsmutablearray *imagearray = [[nsmutablearray alloc] initwithcapacity:22]; int i; (i =1; < 22; i++) { [imagearray addobject:[uiimage imagenamed:[nsstring stringwithformat:@"fbanimation%d.png", i]]]; //make animate self.fblogin.animationimages = [nsarray arraywitharray:imagearray]; self.fblogin.animationduration =0.8; self.fblogin.animationrepeatcount = 5; [self.fblogin startanimating]; } int j; nsmutablearray *imageloading = [[nsmutablearray alloc] initwithcapacity:4]; (j = 1; j < 4; j++) { [imageloading addobject:[uiimage imagenamed:[nsstring stringwithformat:@"loading%d.png", j]]]; //make animate self.fblogin.animationimages = [nsarray arraywitharray:imageloading]; self.fblogin.animationduration = 1; self.fblogin.animationrepeatcount = 5; [self.fblogin startanimating]; }
}
the problem either way i've tried far 1 animation gets executed on screen. want first animation run , sec "loading..." until other info facebook ready.
firstly, calling [self.fblogin startanimating]
, resetting animationimages
array each time go round each for
loop. should move them outside loops - need start each animation once. secondly, sec loop executed after first, result expect sec animation appear, , not first. 1 way of getting round problem set code sec animation in separate method, , arrange called after first has finished calling:
[self performselector:@selector(animation2) withobject:nil afterdelay:durationofpreviousanimation];
at end of first for
loop. i'm assuming since animation code we're guaranteed on main thread.
objective-c animation loops
No comments:
Post a Comment