How to initiate a phone call when the user taps on a phone number on an iPhone application

Declare the number with prefix “tel:”

NSString *tele = @"tel:0094-776764360";

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:tele]];

[tele release];

Proper way to add a text to the table cell in an iPhone application

First declare a label with x, y locations and width, height.

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 40, 110, 25)];

Then declare the text alignment, font and other properties in the text label.

label.textAlignment = UITextAlignmentLeft;

label.font = [UIFont boldSystemFontOfSize:14];

Finally set the text in label and add the label to the table cell as a sub view.

label.text = @"Address:";

[cell.contentView addSubview:label];

[label release];


How to create a sequence of images animated in an iPhone application.

    NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"test.png"], [UIImage imageNamed:@"buddha.jpg"], nil];
    UIImageView *myAnimatedView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    [myAnimatedView initWithFrame:[self.view bounds]];
    myAnimatedView.animationImages = myImages;
    myAnimatedView.animationDuration = 0.25; // seconds
    myAnimatedView.animationRepeatCount = 0; // 0 = loops forever
    [myAnimatedView startAnimating];
    [self.view addSubview:myAnimatedView];
    [myAnimatedView release];