2

How can I display the loading screen animation in iphone? I mean the bars arranged in circles. So that I can use it while some of the part of my app is loading, like initializing. Or should I create may own animation loading?

Thanks.

Adrian
  • 6,013
  • 10
  • 47
  • 68
domlao
  • 15,663
  • 34
  • 95
  • 134
  • 1
    Small note to point out something you probably already know: You can't start animating until your application has actually taken over. So you'll be doing the animation while part of your application is loading/initializing. – Epsilon Prime Dec 04 '09 at 21:22
  • Yeah, thats what I'm planning. Add the UIActivityIndicatorView that I created, then initialize some screen or objects. So can I start animate then call my initialization codes? Or should I start another thread? Thanks. – domlao Dec 04 '09 at 21:31
  • 1
    That's a good question -- if your init code is heavy enough to block the main thread, it shouldn't affect the animation of the activity indicator. If you do want threading, might check into NSOperationQueue, which Apple's evangelists are recommending over threading. Handy, handy tool. Probably already know this, too, but keep in mind nothing in UIKit is thread-safe. – Danilo Campos Dec 04 '09 at 21:49

3 Answers3

4

That's a class called UIActivityIndicatorView. You can either instantiate it as you would any other view in your code or you can drop it into a nib with Interface Builder.

Danilo Campos
  • 6,430
  • 2
  • 25
  • 19
  • Thanks! Just a question, does the animation in UIActivityIndicatorView will affect the frame rate or speed of the app? – domlao Dec 04 '09 at 21:22
  • 1
    It never has in my experience -- feels pretty light weight. As long as you're not using several of them at once, incurring heavy compositing costs, you should be just fine. – Danilo Campos Dec 04 '09 at 21:25
  • Wow great! Good to hear that answer. Thanks a lot again. =) – domlao Dec 04 '09 at 21:25
1

The widget is called UIActivityIndicatorView.

Community
  • 1
  • 1
Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
1

Here is a good example of creating a loading view while waiting for something to happen http://cocoawithlove.com/2009/04/showing-message-over-iphone-keyboard.html

John Stallings
  • 581
  • 2
  • 6