我想用這裏的功能塊替換「@selector」。但是,這樣做顯示了一個錯誤說:發送void(^)(UIButton * _strong)到不兼容類型的參數時出錯SEL
錯誤:發送「無效(^)(UIButton的* __強)」不兼容的型「SEL」的參數
請就如何把一個函數指示直接阻止,而不是使用「@選擇器」。
[_contactPhoneButton addTarget:self
action:^(UIButton *sender) {
NSString *phoneNumber = [@"tel://" stringByAppendingString:sender.titleLabel.text];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
}
私有方法,保留週期。不是一個好建議。 –