OK, I am retarded so I need explicit instructions how to link the NSURL code section at the bottom to a label click to make a call:
- (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]];
}
I tried messing with IBActions and Outlets to no avail. Do I need to put an IBAction in my header file and somehow link it to the label? 3rd day coding objective c and I-OS so go easy on me.
You can achieve making a call by clicking on
UILabelbut not recommendable :), The way to do is catch touchEvents and check if the touch event is from the call label than make a call…Something like this,Not Recommendable
Where
calLabelis an IBOutlet in your header file…Or when touch is ending,
Recommendable is…
Create a UIButton make IBAction and write your call logic inside it…Something like this,
Hope this will help!
EDIT