Aprende a programar aplicaciones IOS #5 Activity Indicator
Hola iPhoneaticos y aqui continuamos con el 5to tutorial del curso de XCode para que desarrollen su primer aplicación.
Caracteristicas:
– 1 WebView
– 1 ActivitIndicatorView
ViewController.h
@interface ViewController : UIViewController{
IBOutlet UIWebView *webview;
IBOutlet UIActivityIndicatorView *actividad;
NSTimer *timer;
}
@end
ViewController.m
@implementation ViewController
– (void)viewDidLoad
{
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@»http://www.youtube.com»]]];
[webview addSubview:actividad];
timer = [ NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(loading) userInfo:nil repeats:YES];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)loading{
if (!webview.loading)
[actividad stopAnimating];
else
[actividad startAnimating];
}
@end