How to show some processing while some background task is going on?

424 Views Asked by At

I am making an iPhone app wherein I need users to enter their email ID and password, and then they can access their account on my website.

Once they enter the authentication details they must wait for a few seconds for the next page to come up.

I need to show a "Processing" or "Please Wait" kind of symbol to the user.

How should I implement it?

Help me, please.

4

There are 4 best solutions below

0
On BEST ANSWER

What you are searching for is an activity indicator.

Here is the tutorial for the activity indicator.

http://www.edumobile.org/iphone/iphone-programming-tutorials/use-activityindicator-in-iphone/

Hope it helps you

0
On

This is something that has been handled by lots of people, so if you want to take advantage of someone else's work and avoid reinventing the wheel, you could use something like the Tapku Library. It's open source and on GitHub.

Specifically, check out the TKProgressAlertView and TKLoadingView classes.

0
On

As ParthBhatt noted it's an activity indicator you want.

I quite like David Sinclair's DSActivityView class: extremely easy to implement, easy to show and change messages, it can be used to disabled the UI by covering it, including a tab bar and nav bar, if desired.

http://www.dejal.com/developer/dsactivityview

0
On

I usually create a UIView that gets instantiated as needed. Here's some code for you to try in your own app:

- (id)initWithLabel:(NSString*)labelName {
    self = [super init];
    if (self) {
        UIImageView *loadingBackgroundView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 150, 120, 40)];
        [loadingBackgroundView setBackgroundColor:[UIColor blackColor]];
        [loadingBackgroundView setAlpha:0.9];
        [loadingBackgroundView.layer setCornerRadius:8.0];
        [loadingBackgroundView.layer setBorderColor:[[UIColor clearColor] CGColor]];
        [self addSubview:loadingBackgroundView];
        [loadingBackgroundView release];

        UILabel *loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake (125, 160, 100, 20)];
        [loadingLabel setBackgroundColor:[UIColor clearColor]];
        [loadingLabel setTextAlignment:UITextAlignmentCenter];
        [loadingLabel setTextColor:[UIColor whiteColor]];
        [loadingLabel setText:labelName];
        [self addSubview:loadingLabel];
        [loadingLabel release];

        UIActivityIndicatorView *loadingActivityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(110,160,20,20)];
        [loadingActivityIndicatorView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];
        [loadingActivityIndicatorView startAnimating];
        [self addSubview:loadingActivityIndicatorView];     
        [loadingActivityIndicatorView release];
    }
    return self;
}

This will give you something similar to the below: alt text