iOS給button繫結撥打電話功能

2022-09-10 14:15:26 字數 392 閱讀 2606

首先在xib檔案中把button繫結到頭檔案和實現檔案。在建立的新方法中加入如下**:

uiwebview*callwebview =[[uiwebviewalloc] init];

nsurl*telurl =[nsurlurlwithstring:@"tel:12345"];

[callwebview loadrequest:[nsurlrequestrequestwithurl:telurl]];

//記得新增到view上

[self.viewthisaddsubview:callwebview];

if(telurl==nil)

if  判定如果號碼為空,需要提示使用者開啟通訊錄,暫未實現跳轉通訊錄。

viewthis方法同樣要在標頭檔案中宣告。

iOS撥打電話

1,這種方法,撥打完 回不到原來的應用,會停留在通訊錄裡,而且是直接撥打,不彈出提示 nsmutablestring str nsmutablestring alloc initwithformat tel 186 x6979 nslog str str 2,這種方法,打完 後還會回到原來的程式,也...

iOS 撥打電話

1.這種方法,撥打完 回不到原來的應用,會停留在通訊錄裡,而且是直接撥打,不彈出提示 nsmutablestring str nsmutablestring alloc initwithformat tel 186 x6979 2.這種方法,打完 後還會回到原來的程式,也會彈出提示,推薦這種 nsm...

iOS程式撥打電話

三種方法,各有不同,拿來給大家分享,希望給大家有所幫助 1,這種方法,撥打完 回不到原來的應用,會停留在通訊錄裡,而且是直接撥打,不彈出提示 nsmutablestring str nsmutablestring alloc initwithformat tel 186 x6979 nslog st...