Skip to content

Instantly share code, notes, and snippets.

@versluis
Created July 24, 2012 07:38
Show Gist options
  • Save versluis/3168622 to your computer and use it in GitHub Desktop.
Save versluis/3168622 to your computer and use it in GitHub Desktop.
Spinning Wheel Acitivity Indicator
#import <UIKit/UIKit.h>
@interface WebViewController : UIViewController <UIWebViewDelegate>
@property (strong, nonatomic) IBOutlet UIWebView *myWebView;
@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *spinningWheel;
- (IBAction)dismissModalView:(id)sender;
- (IBAction)stopSpinning:(id)sender;
@end
#import "WebViewController.h"
@interface WebViewController ()
@end
@implementation WebViewController
@synthesize myWebView;
@synthesize spinningWheel;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSURL *detailURL;
detailURL=[[NSURL alloc] initWithString:@"http:/www.wikipedia.com"];
[self.myWebView loadRequest:[NSURLRequest requestWithURL:detailURL]];
}
- (void)viewDidUnload
{
[self setMyWebView:nil];
[self setSpinningWheel:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (IBAction)dismissModalView:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)stopSpinning:(id)sender {
[self.spinningWheel stopAnimating];
}
#pragma mark - Web View Delegate
- (void)webViewDidFinishLoad:myWebView {
[self.spinningWheel stopAnimating];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment