나는 모든 질문을 통해 검색 한 결과 내 답을 찾지 못하는 것 같습니다.UIButton에서 전화 걸기 전화 번호 :
다음 IBAction이 있습니다. 전화 번호를 누를 때마다 충돌이 발생합니다. DB로 돌아가 전화 번호를 (555) -123-5555 대신 5551235555로 포맷했습니다.
- (IBAction)callPhone:(UIButton *)sender{
Bar *items = self.detailItem;
NSURL *pn = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", items.barPhone]];
[[UIApplication sharedApplication] openURL:pn];
}
- (void)setCallButton:(UIButton *)callButton{
Bar *items = self.detailItem;
[callButton setTitle:items.barPhone
forState:UIControlStateNormal];
}
모든 코드 지침이 유용 할 것입니다.
스택 추적이란 무엇입니까? 그리고'items.barPhone'이 nil이 아니라고 확신합니까? – WrightsCS
네, 번호를 보여주는 것을 확인했습니다. 위에 추가 한 setTitle에도 잘 작동합니다. 그러나 'pn'은 nil을 표시합니다. 분명히 그것이 작동하지 않는 이유는 확실하지만 확실하지 않습니다. – user1454340
오류 메시지가 무엇입니까? – Selkie