最詳細撥打電話方法iOS

2021-07-25 08:46:07 字數 772 閱讀 3453

本菜鳥看了一些撥打**的方法,不是很完善,故mark乙個完善的,三個方法:

方法一:直接撥打**,不彈出提示框(可以自己用uiactioncontroller 寫乙個提示框來進行撥打,好處是比方法二的彈出時間短)打完之後回到原程式(ios9.0以上)

nsmutablestring  * str = [[nsmutablestring alloc] initwithformat:@"tel:%@",@"138***x7097"];

方法二:原生自帶彈出提示框,(缺點是彈出提示框速度比較慢,所以被我棄用) 打完之後也是回到原程式

nsmutablestring *str=[[nsmutablestring alloc] initwithformat:@"tel:%@",@"138***x7097"];

uiwebview *callwebview = [[uiwebview alloc] init];

方法三 :這種方法也會回去到原來的程式裡(注意這裡使用的是「telprompt」),會彈出提示,但是上架容易被拒

nsmutablestring* str=[[nsmutablestring alloc] initwithformat:@"telprompt://%@",@"138***x7097"];

[callwebview loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:str]]];

[self.view addsubview:callwebview];

好,就寫到這裡,謝謝大家的**。

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...