Hi ,
This blog describe how to make a call in an iphone application.
This blog is useful in the situations where there is a field shown phone number and when you click on it ,call will be initiated on that number.
-(void_initiateCall
{
NSString *phoneNo=@" phone number";
NSString *telephoneString=[phoneNo stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSMutableString *str1=[[NSMutableString alloc] initWithString:telephoneString];
[str1 setString:[str1 stringByReplacingOccurrencesOfString:@"(" withString:@""]];
[str1 setString:[str1 stringByReplacingOccurrencesOfString:@")" withString:@""]];
[str1 setString:[str1 stringByReplacingOccurrencesOfString:@"-" withString:@""]];
[str1 setString:[str1 stringByReplacingOccurrencesOfString:@" " withString:@""]];
telephoneString = [@"tel://" stringByAppendingString:str1];
[str1 release];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:telephoneString]];
}
Happy Coding:)
No comments:
Post a Comment