2011-10-20 72 views
-1

我正在構建一個相當簡單的使用Storyboard的Tabel View Controller,其中一些單元格將包含電子郵件地址。創建mailto:與iOS表單元格的鏈接

我該如何着手製作這些超鏈接?

正如我所說我一直主要使用Storyboard來創建這些視圖,所以相應的代碼是在XML中。我應該把我的「href = mailto:」標籤放在哪裏?

回答

1

您可以使用委託方法:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 

然後決定是該行中的哪些數據,然後你會想:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://blah"]]; 

或者您可以使用MFMailComposeViewController。在這裏閱讀更多:

http://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMailComposeViewController_class/MFMailComposeViewController_class.pdf