Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeating done over and over on iPad. #66

Open
ghost opened this issue Apr 3, 2013 · 1 comment
Open

Repeating done over and over on iPad. #66

ghost opened this issue Apr 3, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 3, 2013

New to this whole game, but here we go. I have 3 storyboards, 3.5, 4" and iPad. Works flawlessly in simulator (as it always has), but recently I added that iPad storyboard, for more a universal app. One tester reported that it repeats "done" over and over.

I tried returning to default, no luck. Keep in mind I took over our app project for our forum. This is how the previous author implemented it into our app.

// MainViewController.h
//
// Created by Chris on 3/20/2013.
// Copyright (c) 2013 Chris. All rights reserved.
//

import "PullToRefreshView.h"

import <QuartzCore/QuartzCore.h>

import "MTStatusBarOverlay.h"

@interface MainViewController : UIViewController <PullToRefreshViewDelegate, UIWebViewDelegate, UIGestureRecognizerDelegate, MTStatusBarOverlayDelegate, UIScrollViewDelegate> {

IBOutlet UIWebView *webView;    
IBOutlet UIScrollView *currentScrollView;
NSTimer *timer;
UIApplication *app;
double myNumber;
MTStatusBarOverlay *overlay;
IBOutlet UIImageView *splash35Inch;
IBOutlet UIImageView *splash4Inch;
IBOutlet UIImageView *splashPad;
IBOutlet UIImageView *splashPadLandscape;

}

@Property (nonatomic, retain) UIImageView *splash35Inch;
@Property (nonatomic, retain) UIImageView *splash4Inch;
@Property (nonatomic, retain) UIImageView *splashPad;
@Property (nonatomic, retain) UIImageView *splashPadLandscape;

  • (IBAction)goBack:(UISwipeGestureRecognizer *)sender;
  • (IBAction)goForward:(UISwipeGestureRecognizer *)sender;

@EnD

///////////////////////////////////////////////

// MainViewController.m
//
// Created by Chris on 3/20/2013.
// Copyright (c) 2013 Chris. All rights reserved.
//

import "MainViewController.h"

//Random app code//

  • (void)swipeLeftAction:(id)ignored{
    [webView goBack];
    [overlay postMessage:@"Go Back" duration:1 animated:YES];
    }
  • (void)swipeRightAction:(id)ignored{
    [webView goForward];
    [overlay postMessage:@"Go Forward" duration:1 animated:YES];
    }

-(void)pullToRefreshViewShouldRefresh:(PullToRefreshView *)view {
[(UIWebView *)[self.view viewWithTag:999] reload];
[overlay postMessage:@"Reloading" duration:1 animated:YES];
}

  • (void)webViewDidFinishLoad:(UIWebView *)wv
    {
    NSLog(@"Done!" );
    [(PullToRefreshView *)[self.view viewWithTag:998] finishedLoading];
    [overlay postFinishMessage:@"Done!" duration:1 animated:YES];
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    }
  • (void)webViewDidStartLoad:(UIWebView *)webView {
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
    }

If anybody has any ideas why it keeps calling done, I'd appreciate it.

UPDATE:
How our forum is set up, we have ads running, unless your an advanced member. So the status bar overlay is registering that web load, over and over again. Seeing how its not a direct code issue we can mark this as solved.

However, if somebody has an idea on how to get it to distinguish between a forum web page and ads, that would be helpful.

@ghost
Copy link
Author

ghost commented Apr 4, 2013

I added a bit in - (void)webViewDidFinishLoad:(UIWebView *)webview which stalls the webView load until everything is done loading. So with this implemented, no more rapid fire "Done" messages. Heres what I used.

  • (void)webViewDidFinishLoad:(UIWebView *)webview {

if (webview.isLoading)
    return;

NSLog(@"Done!" );
[(PullToRefreshView *)[self.view viewWithTag:998] finishedLoading];
[overlay postFinishMessage:@"Done!" duration:1 animated:YES];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

}

/////
UPDATE:
This method above does not work on 5.0 targeted devices. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants