Created
July 24, 2012 07:38
-
-
Save versluis/3168622 to your computer and use it in GitHub Desktop.
Spinning Wheel Acitivity Indicator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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