Loading

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];

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);
}

Auto Orientation

Go Through

http://developer.apple.com/library/ios/#codinghowtos/UserExperience/index.html

Saturday, September 18, 2010

Push 2 View Controller from App Stack

YourAppDelegate* appDelegate = (YourAppDelegate*)[UIApplication sharedApplication].delegate;
UINavigationController *navigationController = [appDelegate navigationController];
NSInteger Go_To_Controller=[navigationController.viewControllers count]-3;
[navigationController popToViewController:[navigationController.viewControllers objectAtIndex:Go_To_Controller] animated:YES];

Friday, September 17, 2010

Resize The Image for Save

NSData *imgdata = UIImageJPEGRepresentation([PhotoArray objectAtIndex:0], 0.85f);
UIImage *image = [UIImage imageWithData:imgdata];
CGRect rect = CGRectMake(0.0, 0.0, 320, 480);
UIGraphicsBeginImageContext(rect.size);
[image drawInRect:rect];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imgdata1 = UIImageJPEGRepresentation(img, 0.6);

Hide Callout

NSArray *arr=YourmapView.selectedAnnotations;
MKAnnotation *Curranno=[arr objectAtIndex:0];
[YourmapView deselectAnnotation:Curranno animated:YES];