我有 2UIButtons
个使用 switch 语句更改其文本标签(仅出于测试目的做了第一种情况):
switch (_itemNumber)
{
case 0:
[_phoneButton setTitle:@"201-612-5480" forState:UIControlStateNormal];
[_emailButton setTitle:@"aacenter@bergen.edu" forState:UIControlStateNormal];
self.title = @"Acdmc. Adv. Center";
break;
default:
break;
}
因此,当UIButton
按下 时,将执行一个操作:
- (IBAction)phoneButtonAction:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",_emailButton.titleLabel.text]]];
}
- (IBAction)emailButtonAction:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://devprograms@apple.com"]];
}
更改文本标签有效,但不是操作。是因为每个人只能有一个出口或一个动作UIButton
吗?如果是这样,我怎样才能设法执行所需的操作?