how to link static cells to Outlet/Actions - E.G tap the call cell to call the number

Posted by holtii on Stack Overflow See other posts from Stack Overflow or by holtii
Published on 2012-12-04T16:06:01Z Indexed on 2012/12/06 11:06 UTC
Read the original article Hit count: 138

The code I have. By the way, I can't get Call to work and Website does not open either!

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *urlToOpen = @"";
if( indexPath.section == 0 ){
    // call number
    urlToOpen = @"tel:442074036933";
} else if( indexPath.section == 1 ){
    // open website
    urlToOpen = @"http://www.designmuseum.org";
} else {
    // open address

    urlToOpen = @"http://maps.apple.com/maps?daddr=Design+Museum+London";
}
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlToOpen]];
NSString *destinationAddress = [NSString stringWithFormat:@"%@+%@+%@",
                                [address street],
                                [address city],
                                [address country]];

NSString *sourceAddress = [LocalizedCurrentLocation currentLocationStringForCurrentLanguage];

NSString *url = [NSString stringWithFormat:@"http://maps.apple.com/maps?saddr=%@&daddr=%@",
                 [sourceAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
                 [destinationAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

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

I need to add destination address which for my App is = 28 Shad Thames, London, United Kingdom. Which format to write it in? because I cant get it to work and really need to sort this problem of my app real quick

© Stack Overflow or respective owner

Related posts about uitableview

Related posts about uitableviewcell