I am newbie too ios and objective c,I know my question is very simple but i found not solution do asked,I am having a method for a static value,now i want to make it dynamic by passing value to that method,So can anybuddy please tell me how to write method with parameter and how to call it.my code is as below:
-(void)phoneNumberLabelTap
{
NSURL *phoneUrl = [NSURL URLWithString:[NSString stringWithFormat:@"telprompt:%@",fonlabel.text]];
if ([[UIApplication sharedApplication] canOpenURL:phoneUrl]) {
[[UIApplication sharedApplication] openURL:phoneUrl];
} else {
UIAlertView * calert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Call facility is not available!!!" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
[calert show];
}
}
I want to add a parameter to this method, And i am calling this method as below,
fonlabel.userInteractionEnabled = YES;
homeLabel.userInteractionEnabled = YES;
UITapGestureRecognizer *tapGesture =
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(phoneNumberLabelTap)];
[fonlabel addGestureRecognizer:tapGesture];
[homeLabel addGestureRecognizer:tapGesture];