开发者

show uiactivityview while an other operation is loading

i googled for hours now but i can't find a code example, which describes how to show an uiactivityview while an operation/method is loading.

in 开发者_如何学运维my case i want to show it while i load a large image to an uiimageview. have you got an idea how to realize that?

thanks in advance.

sean


You might want to look in the UI UIActivityIndicatorView Class Reference documentation.

Make sure to return to the run loop while waiting for the image to load in order to see the activity indicator animating. Also, you will probably need to create a method to stop the activity indicator, and perhaps call that stop method by doing a performSelectorOnMainThread from whatever method handles the asynchronous completion of the loading.


well its quit easy.

  1. show activity indicator
  2. start thread loading that image
  3. if image loaded, thread tells mainapp to kill activity indicator.

   NSThread detachNewThreadSelector:@selector(myMethod) 

toTarget:self withObject:nil];

and

      [self performSelectorOnMainThread:@selector(myMethod) 
           withObject:nil 
           waitUntilDone:false];

will be helpfully. taken from http://www.iphoneexamples.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜