【发布时间】:2011-12-29 00:19:58
【问题描述】:
好的,我很迟钝,所以我需要明确的说明如何将底部的 NSURL 代码部分链接到标签单击以拨打电话:
- (void)viewDidLoad {
[super viewDidLoad];
lblText.text = agencyName;
lblPhone.text = phone;
lblEmail.text = email;
lblAddress.text = agcaddress;
//Set the title of the navigation bar
self.navigationItem.title = @"Agency Info";
mapView=[[MKMapView alloc] initWithFrame:self.view.bounds];
}
- (IBAction)callPlaceNumber:(id)sender {
NSString *number = [NSString stringWithFormat:@"tel://%@", phone];
number = [number stringByReplacingOccurrencesOfString:@" "
withString:@""];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:number]];
}
我尝试弄乱 IBActions 和 Outlets 无济于事。我是否需要在我的头文件中放置一个 IBAction 并以某种方式将其链接到标签?第 3 天编码目标 c 和 I-OS,所以对我来说轻松一点。
【问题讨论】:
-
能否请您重新表述您的问题?你到底想做什么?打开 URL onViewLoad 还是通过点击标签打开 URL?
-
或者您想通过点击按钮拨打电话?
-
是的,通过点击标签打开网址。对不起。
-
将标签作为链接是理想的
标签: objective-c cocoa-touch iphone-sdk-3.0