if([result count]>0)
{
NSIndexPath* indPath = [NSIndexPath indexPathForRow:0 inSection:0];
[tblArticle scrollToRowAtIndexPath:indPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
Tuesday, October 19, 2010
Use of Autorelase Pool
The First line of Thread =
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
and the Last Line is
[pool release];
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];
}*/
}
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];
}*/
}
Wednesday, September 29, 2010
Color With Image Pattern
NSString *backgroundPath = [[NSBundle mainBundle] pathForResource:@"Display" ofType:@"png"];
UIImage *backgroundImage = [UIImage imageWithContentsOfFile:backgroundPath];
return [UIColor colorWithPatternImage:backgroundImage];
UIImage *backgroundImage = [UIImage imageWithContentsOfFile:backgroundPath];
return [UIColor colorWithPatternImage:backgroundImage];
Remove Horizental Scrollindicator from Code
scrl.scrollIndicatorInsets=UIEdgeInsetsMake(0, 0, 0, -10);
Monday, September 20, 2010
X,Y and Z Position of Device
1. include UIAccelerometerDelegate in .h file
2. Declare UIAccelerationValue acceleration[3]; in .h
3. [[UIAccelerometer sharedAccelerometer] setDelegate:self]; in ViewDidLoad or ViewWillAppear
4. - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
[self updateHistoryWithX:acceleration.x Y:acceleration.y Z:acceleration.z];
} // Delegate method
- (void)updateHistoryWithX:(float)x Y:(float)y Z:(float)z {
NSLog(@"X=%f Y=%f Z=%f ",x,y,z);
}
2. Declare UIAccelerationValue acceleration[3]; in .h
3. [[UIAccelerometer sharedAccelerometer] setDelegate:self]; in ViewDidLoad or ViewWillAppear
4. - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{
[self updateHistoryWithX:acceleration.x Y:acceleration.y Z:acceleration.z];
} // Delegate method
- (void)updateHistoryWithX:(float)x Y:(float)y Z:(float)z {
NSLog(@"X=%f Y=%f Z=%f ",x,y,z);
}
Auto Orientation
Go Through
http://developer.apple.com/library/ios/#codinghowtos/UserExperience/index.html
http://developer.apple.com/library/ios/#codinghowtos/UserExperience/index.html
Subscribe to:
Posts (Atom)