- // assuming you have an ivar to store a weak reference to a UIWebView:
- // UIWebView *phoneCallWebView;
- - (void) dialPhoneNumber:(NSString *)aPhoneNumber
- {
- NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",aPhoneNumber]];
- if ( !phoneCallWebView ) {
- phoneCallWebView = [[UIWebView alloc] initWithFrame:CGRectZero];
- }
- [phoneCallWebView loadRequest:[NSURLRequest requestWithURL:phoneURL]];
- }
- - (void) dealloc
- {
- // cleanup
- [phoneCallWebView release], phoneCallWebView = nil;
- [super dealloc];
- }
js与UIWebView交互打电话
最新推荐文章于 2020-10-10 11:25:50 发布