Loading

Tuesday, October 19, 2010

Table Scroll to Top

if([result count]>0)
{
NSIndexPath* indPath = [NSIndexPath indexPathForRow:0 inSection:0];
[tblArticle scrollToRowAtIndexPath:indPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
}

Use of Autorelase Pool

The First line of Thread =

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];


and the Last Line is

[pool release];

Tuesday, October 12, 2010

Hide ActivityIndicator When Page DidFinish Loading

1. [WebViewWebDetail loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@""]]];

NSString* WebAddress=[NSString stringWithFormat:@"%@",YourWebAddress];
NSURL* url=[NSURL URLWithString:[WebAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[WebViewWebDetail loadRequest:[NSURLRequest requestWithURL:url]];


2. WEBVIEW Delegate Methods

- (void)webViewDidStartLoad:(UIWebView *)webView
{
Process.alpha=1.0;
Process.hidesWhenStopped = YES;
[Process startAnimating];

}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
if([Process isAnimating])
[Process stopAnimating];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{

if([Process isAnimating])
[Process stopAnimating];
/*
if (error != NULL) {
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle: [error localizedDescription]
message: [error localizedFailureReason]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[errorAlert show];
[errorAlert release];
}*/
}