Skip to content

Commit

Permalink
Added spinner to indicate webview is being loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
jeyben committed Apr 27, 2013
1 parent 79d6bac commit b05e4a7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions IOSLinkedInAPI/LIALinkedInAuthorizationViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ @interface LIALinkedInAuthorizationViewController ()
@property(nonatomic, copy) LIAAuthorizationCodeSuccessCallback successCallback;
@property(nonatomic, copy) LIAAuthorizationCodeCancelCallback cancelCallback;
@property(nonatomic, strong) LIALinkedInApplication *application;
@property(nonatomic, strong) UIActivityIndicatorView *activityIndicatorView;
@end

@interface LIALinkedInAuthorizationViewController (UIWebViewDelegate) <UIWebViewDelegate>
Expand Down Expand Up @@ -60,8 +61,17 @@ - (id)initWithApplication:(LIALinkedInApplication *)application success:(LIAAuth

- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];

self.activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
self.activityIndicatorView.center = self.view.center;
self.activityIndicatorView.hidesWhenStopped = YES;
[self.activityIndicatorView startAnimating];
[self.view addSubview:self.activityIndicatorView];

self.authenticationWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
self.authenticationWebView.delegate = self;
self.authenticationWebView.hidden = YES;
[self.view addSubview:self.authenticationWebView];

self.navigationController.navigationBarHidden = YES;
Expand Down Expand Up @@ -104,4 +114,9 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
return YES;
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
[self.activityIndicatorView stopAnimating];
self.authenticationWebView.hidden = NO;
}

@end

0 comments on commit b05e4a7

Please sign in to comment.