ios - Creating a animated loading frame w/ condition NOT animated launch screen -


hi few view controllers in app pretty intensive image processing @ load up.

so id create full screen animated image(which know how image view) , continue animating until view controller ready use. know have create thread animation(i think) , somehow have image loop until condition true? have tutorials share or have useful code. i've been finding online animated launch images tutorials go time programmer has set..not tutorials explain how until condition true

the trick not think of waiting cycle. should think of 2 distinct events: loading started, , loading completed.

when loading starts, create image view hosts .gif, , display it:

[self.imageview startanimating]; [self.view addsubview:self.imageview]; 

or, if want fade in:

self.imageview.alpha = 0; [self.imageview startanimating]; [self.view addsubview:self.imageview]; [uiview animatewithduration:0.5 animations:^{     self.imageview.alpha = 1.0; }]; 

then, when loading completes, need fade out again:

[uiview animatewithduration:0.5 animations:^{     self.imageview.alpha = 0; } completion:^(bool finished) {     [self.imageview stopanimating];     [self.imageview removefromsuperview]; }]; 

see this github project how break down .gif frames , animate using uiimageview. approach, don't care how long loading takes. imageview display , automatically keep looping until explicitly remove it.

edit:

if want custom animations using uikit, can put animations in auto-repeating (and auto-reversing?) animation block:

[uiview animatewithduration:0.5                       delay:0.0                     options:uiviewanimationoptionautoreverse | uiviewanimationoptionrepeat                  animations:^{                      // animation                  } completion:nil]; 

then, cancel animation when loading completes:

[self.view.layer removeallanimations]; 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -