Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-23-2011, 10:50 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2011
Location: France
Posts: 2
Par0teck is on a distinguished road
Question SOS - activityIndicator is stopped, but my webView content is not completely show

Hi everyone,

I'm getting a problem, so i would ask your help.

I created an webViewBased application.

I'm using an activityIndicator, it's animation begin at: webViewDidStartLoad, and finish at webViewDidFinishLoad

The problem is that the activityIndicator is stopped, but my webView content is not completely show

So, how can i fix it? Stop the ActivityIndicator only when ALL content of my webView is show?

Thank you very much for your help

Sincerely,
Bob
Par0teck is offline   Reply With Quote
Old 04-23-2011, 10:55 AM   #2 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,346
iSDK is on a distinguished road
Send a message via AIM to iSDK
Default

Avez-vous lu http://www.iphonedevsdk.com/forum/ip...-problem.html?

S'il vous plaît le lire et nous donner plus d'informations.

(thought I would test out my french )

Quote:
Originally Posted by Par0teck View Post
Hi everyone,

I'm getting a problem, so i would ask your help.

I created an webViewBased application.

I'm using an activityIndicator, it's animation begin at: webViewDidStartLoad, and finish at webViewDidFinishLoad

The problem is that the activityIndicator is stopped, but my webView content is not completely show

So, how can i fix it? Stop the ActivityIndicator only when ALL content of my webView is show?

Thank you very much for your help

Sincerely,
Bob
iSDK is offline   Reply With Quote
Old 04-23-2011, 11:15 AM   #3 (permalink)
Registered Member
 
Join Date: Apr 2011
Location: France
Posts: 2
Par0teck is on a distinguished road
Default

Quote:
Bonjour,

Bon français est très bien
Hello,

Good French cool

I'm sorry I thought I was clear enough in my request.

In fact I would like the WebView am fully charged before removing the indicator.

For now we can see the ActivityIndicator but it closes before all the page is finished loading.

Suddenly you can see the screen all white and then the images are loaded one by one. (Not nice)

Here is the code

Code:
#import "FirstViewController.h"
#import "InfoViewController.h"
#import "Reachability.h"


@implementation FirstViewController
@synthesize toolbar, pageTitle; 

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    if (navigationType == UIWebViewNavigationTypeLinkClicked) {
        NSURL *url = [request URL];
        if([[url absoluteString] rangeOfString:@"http://www.google.com"].location == NSNotFound) {
            [[UIApplication sharedApplication] openURL:url];
            
            return NO;
            
        }
    }
    
    return YES;
}

- (IBAction)infoButtonPressed:(id)sender;
{
    InfoViewController *infoview = [[InfoViewController alloc] initWithNibName:nil bundle:nil];
    
    infoview.modalTransitionStyle = UIModalTransitionStylePartialCurl ;
    [self presentModalViewController:infoview animated:YES];
}

/*
- (void)awakeFromNib
{
	[AutoRefProcess loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.fr"]]];
    
    
    [AutoRefProcess setDelegate:self];
}
*/

- (void)webViewDidStartLoad:(UIWebView *)AutoRefProcess
{	
		
	[activity startAnimating]; 
    [pageTitle setText:@"Chargement..."]; 
    
    
}

//La webview a finit de chargé on masque la vue loading avec un fadeout
- (void)webViewDidFinishLoad:(UIWebView *) AutoRefProcess	
{
	
    [activity stopAnimating]; 
    [pageTitle setText:@"Google"];
    

	
}

/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
    }
    return self;
}
*/

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    Reachability *r = [Reachability reachabilityWithHostName:@"http://www.google.com"];
	
	NetworkStatus internetStatus = [r currentReachabilityStatus];
	
	if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN))
	{
		UIAlertView *myAlert = [[[UIAlertView alloc] initWithTitle:@"NoConnect" message:@"NoConnectContent" delegate:self cancelButtonTitle:@"CloseWebView" otherButtonTitles:nil] autorelease];
		[myAlert show];
		
    }
    
    [AutoRefProcess loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
    
    
    [AutoRefProcess setDelegate:self];
    [super viewDidLoad];
}



// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    // return (interfaceOrientation == UIInterfaceOrientationPortrait);
    return YES;
}


- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
    [activity release]; 
    [toolbar release]; 
    [AutoRefProcess release]; 
    [pageTitle   release]; 
}



@end
Thank you very much for your help

Sincerely,
Bob
Par0teck is offline   Reply With Quote
Old 05-14-2011, 09:57 PM   #4 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 557
Joseph Nardone is on a distinguished road
Default

There is not a proper solution to this problem as the webview delegate start and finish loading are called many times each when loading pages.

You can put a delay in before the activity indicator disappears so that it won't flash on and off so much.
Joseph Nardone is offline   Reply With Quote
Reply

Bookmarks

Tags
activityindicator, iphone, webview, webviewdidfinishload

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 342
12 members and 330 guests
dansparrow, iOS.Lover, lorrettaui53, Nobbsy, Objective Zero, oztemel, pbart, PlutoPrime, samdanielblr, sledzeppelin, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:50 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0