Preloading a UIImageView animation using objective c for the iphone -


i have animated image works great. consists of 180 high quality images , plays fine , loops continuously. problem first time load view containing these images takes long time load. every subsequent time after loads assuming images have been cached or preloaded!!! come flash background , sure aware preloaders common muck don't feel should difficult find after countless googling cannot find examples on preloading or articles on why there delay , it.

so question(s) this:

  1. is there checkbox in info.plist preload images @ start of app?

  2. how can preload images , there simple example projects at?

  3. is best way implement video has been output png sequence?

  4. is there method viewdidload not work expect do. traces "finished loading images" (see code below) view not show second or 2 after images have been loaded if view not show until images have loaded neither uiactivityindicatorview in same view.

  5. how do event listening in objective c?

below code in viewdidload believe standard:

any appreciated banging head on brick wall on seems basic in ui development. :)

- (void)viewdidload {     [super viewdidload];      imagearray = [[nsmutablearray alloc] initwithcapacity:image_count];      nslog(@"start loading images");      // build array of images, cycling through image names     (int = 0; < image_count; i++){         [imagearray addobject:[uiimage imagenamed: [nsstring stringwithformat:@"main_%d.png", i]]];     }      animatedimages = [[uiimageview alloc] initwithframe:cgrectmake(0,20,image_width, image_height)];     animatedimages.animationimages = [nsarray arraywitharray:imagearray];     animatedimages.animationduration = 6.0;     animatedimages.animationrepeatcount = 0;         [self.view addsubview:animatedimages];     animatedimages.startanimating;     [animatedimages release];      nslog(@"finish loading images");  }  

cheers

m

in case finds question, have answer, pre-render images this.

nsmutablearray *menuanimationimages = [[nsmutablearray alloc] init];  (int anicount = 1; anicount < 21; anicount++) {     nsstring *filelocation = [[nsbundle mainbundle] pathforresource: [nsstring stringwithformat: @"bg%i", anicount + 1] oftype: @"png"];      // here code load , pre-render image     uiimage *frameimage = [uiimage imagewithcontentsoffile: filelocation];     uigraphicsbeginimagecontext(frameimage.size);     cgrect rect = cgrectmake(0, 0, frameimage.size.width, frameimage.size.height);     [frameimage drawinrect:rect];     uiimage *renderedimage = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();      // add resulting image array     [menuanimationimages addobject:renderedimage]; }  settingsbackground.animationimages = menuanimationimages; 

i have tried multiple other methods of pre-loading images, , thing i've found works.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -