iPhone 应用中实现拨打电话功能的代码
来源:互联网 发布:第五次人口普查数据 编辑:程序博客网 时间:2024/04/29 10:12
下面的代码能在应用中添加一个电话按钮,点击即可拨打电话号码。对于 iPhone 开发者还是很有用的。
//添加电话图标按钮
UIButton *btnPhone = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
btnPhone.frame = CGRectMake(280,10,30,30);
UIImage *image = [UIImage imageNamed:@"phone.png"];
[btnPhone setBackgroundImage:image forState:UIControlStateNormal];
//点击拨号按钮直接拨号
[btnPhone addTarget:self action:@selector(callAction:event:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:btnPhone]; //cell是一个UITableViewCell
//定义点击拨号按钮时的操作
- (void)callAction:(id)sender event:(id)event{
NSSet *touches = [event allTouches];
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.listTable];
NSIndexPath *indexPath = [self.listTable indexPathForRowAtPoint: currentTouchPosition];
if (indexPath == nil) {
return;
}
NSInteger section = [indexPath section];
NSUInteger row = [indexPath row];
NSDictionary *rowData = [datas objectAtIndex:row];
NSString *num = [[NSString alloc] initWithFormat:@"tel://%@",number]; //number为号码字符串
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:num]]; //拨号
}
- iPhone 应用中实现拨打电话功能的代码
- iPhone 应用中实现拨打电话功能的代码
- 代码实现电话的拨打
- Symbian开发中实现拨打电话功能
- 在android中实现电话拨打功能
- iOS中实现拨打电话功能
- iOS 拨打电话功能的实现
- iOS 拨打电话功能的实现
- IOS拨打电话功能的实现
- iOS拨打电话功能的实现
- Android 实现拨打电话功能
- android拨打电话功能实现
- Android 实现拨打电话功能
- Android实现拨打电话功能
- 【Android】Android开发初学者实现拨打电话的功能,拨打电话app小demo实现
- 【自学笔记】Intent意图——实现简单的拨打电话功能代码
- iphone 开发中 拨打电话等的操作
- Android 应用中拨打电话
- 不调用苹果似有API也能获取 iPhone 本机 IP 地址的
- SQL交叉表实例
- 多态的缺陷:“覆盖私有方法”
- 11g Active Standby Database Automatic Block Corruption Repair
- sourceinsight
- iPhone 应用中实现拨打电话功能的代码
- iphone开发每日一练【2011-10-11】
- vb/vb.net开发精粹(5)
- android开发技术文章荟萃【2011-10-11】
- python and pattern
- Struts2中OGNL的"#,%,$"使用!
- poj 3133 插头Dp
- 新闻发布管理系统
- 单选框