The following function saves UIImage in test.png file in the user Document folder: - (void)saveImage: (UIImage*)image { if (image != nil) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString* path = [documentsDirectory stringByAppendingPathComponent: [NSString stringWithString: @"test...
How to dial phone number programatically in iPhone / xCode?
UIDevice *device = [UIDevice currentDevice]; if ([[device model] isEqualToString:@”iPhone”] ) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@”tel:130-032-2837″]]]; } else { UIAlertView *Notpermitted=[[UIAlertView alloc] initWithTitle:@”Alert” message:@”Your device doesn’t support this feature.”...
“how to find Image size for a url in iPhone”
float size = [UIImageJPEGRepresentation(Image,0.9) length]/1024.0/1024.0;
//in above line Image is your image name
//NSLog(@”File Size : %f”, size);
if (size == 0)
{
UIImage *imagenew = [UIImage imageNamed”img-not-available.jpg”];
[ImageButton setImage:imagenew forState:UIControlStateNormal];
}
else
[ImageButton setImage:Image forState:UIControlStateNormal];
Adding an MKMapView programmatically
MKMapView * map = [[MKMapView alloc] initWithFrame:
CGRectMake(0, 0, 320, 480)];
Map.delegate = self;
[self.view addSubview:map];