mirror of
https://github.com/samsonjs/5by5Browser.git
synced 2026-04-27 15:07:39 +00:00
only display loading view once per page load
This commit is contained in:
parent
f441071fd8
commit
efb8d95545
2 changed files with 21 additions and 3 deletions
Binary file not shown.
|
|
@ -11,14 +11,20 @@
|
||||||
#import "InstapaperCredentials.h"
|
#import "InstapaperCredentials.h"
|
||||||
#import "UIAlertView+marshmallows.h"
|
#import "UIAlertView+marshmallows.h"
|
||||||
|
|
||||||
|
// Private API
|
||||||
@interface SSDetailViewController ()
|
@interface SSDetailViewController ()
|
||||||
{
|
{
|
||||||
UIBarButtonItem *_showsButton;
|
UIBarButtonItem *_showsButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (strong, nonatomic) UIPopoverController *masterPopoverController;
|
@property (strong, nonatomic) UIPopoverController *masterPopoverController;
|
||||||
|
@property BOOL isLoading;
|
||||||
|
|
||||||
- (void) configureView;
|
- (void) configureView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation SSDetailViewController
|
@implementation SSDetailViewController
|
||||||
|
|
||||||
@synthesize episode = _episode;
|
@synthesize episode = _episode;
|
||||||
|
|
@ -29,6 +35,7 @@
|
||||||
@synthesize instapaperButton = _instapaperButton;
|
@synthesize instapaperButton = _instapaperButton;
|
||||||
@synthesize loadingView = _loadingView;
|
@synthesize loadingView = _loadingView;
|
||||||
@synthesize masterPopoverController = _masterPopoverController;
|
@synthesize masterPopoverController = _masterPopoverController;
|
||||||
|
@synthesize isLoading = _isLoading;
|
||||||
|
|
||||||
#pragma mark - Managing the detail item
|
#pragma mark - Managing the detail item
|
||||||
|
|
||||||
|
|
@ -90,15 +97,24 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) webView: (UIWebView *)webView shouldStartLoadWithRequest: (NSURLRequest *)request navigationType: (UIWebViewNavigationType)navigationType
|
||||||
|
{
|
||||||
|
self.isLoading = navigationType == UIWebViewNavigationTypeOther ? self.isLoading : YES;
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) webViewDidStartLoad: (UIWebView *)webView
|
- (void) webViewDidStartLoad: (UIWebView *)webView
|
||||||
{
|
{
|
||||||
[UIView animateWithDuration: 1.0 animations: ^{
|
if (self.isLoading) {
|
||||||
self.loadingView.alpha = 1.0;
|
[UIView animateWithDuration: 1.0 animations: ^{
|
||||||
}];
|
self.loadingView.alpha = 1.0;
|
||||||
|
}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) webViewDidFinishLoad: (UIWebView *)webView
|
- (void) webViewDidFinishLoad: (UIWebView *)webView
|
||||||
{
|
{
|
||||||
|
self.isLoading = NO;
|
||||||
[UIView animateWithDuration: 0.3 animations: ^{
|
[UIView animateWithDuration: 0.3 animations: ^{
|
||||||
self.loadingView.alpha = 0.0;
|
self.loadingView.alpha = 0.0;
|
||||||
}];
|
}];
|
||||||
|
|
@ -108,6 +124,8 @@
|
||||||
|
|
||||||
- (IBAction) goHome: (id)sender
|
- (IBAction) goHome: (id)sender
|
||||||
{
|
{
|
||||||
|
// Show the loading animation
|
||||||
|
self.isLoading = YES;
|
||||||
if (self.episode) {
|
if (self.episode) {
|
||||||
[self.webView loadRequest: [NSURLRequest requestWithURL: self.episode.url]];
|
[self.webView loadRequest: [NSURLRequest requestWithURL: self.episode.url]];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue