iOS选择头像示例代码
来源:互联网 发布:mac卸载opera 编辑:程序博客网 时间:2024/05/19 17:58
- (void)tap:(UITapGestureRecognizer *)tapGR{NSLog(@"被点按了");
UIActionSheet *as = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"从手机相册获取" otherButtonTitles:@"打开照相机", nil];
[as showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
switch (buttonIndex) {
case 0:
[self gotoPhoto];
break;
case 1:
[self gotoCamera];
break;
}
}
-(void)gotoPhoto{
NSLog(@"照片");
UIImagePickerController*pickerFromPhotoLibrary = [[UIImagePickerController alloc]init];
pickerFromPhotoLibrary.delegate = self;
pickerFromPhotoLibrary.allowsEditing = YES;
pickerFromPhotoLibrary.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:pickerFromPhotoLibrary animated:YES completion:nil];
}
-(void)gotoCamera{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIImagePickerController *ipc = [[UIImagePickerController alloc]init];
[ipc setSourceType:UIImagePickerControllerSourceTypeCamera];
ipc.delegate = self;
ipc.allowsEditing = YES;
[self presentViewController:ipc animated:YES completion:nil];
}else{
UIAlertView*alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"该设备暂不能使用" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alert show];
NSLog(@"这设备没相机");
}
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
self.image = [info objectForKey:@"UIImagePickerControllerEditedImage"];
self.iv.image=self.image;
[self dismissViewControllerAnimated:YES completion:nil];
}
0 0
- iOS选择头像示例代码
- iOS 选择头像后显示到imageView中 纯代码
- iOS 修改头像,几行代码实现从相册选择照片
- iOS 用户头像选择以及上传服务器
- Android 仿iOS头像选择效果
- 头像选择
- 头像选择
- 头像选择
- 选择行的示例代码
- Jquery选择卡示例代码
- 请选择您喜欢的人物头像JS代码
- iOS 调用相机拍照和选择图库图片 设置头像
- ios gif播放示例代码
- IOS内存管理示例代码
- iOS 代码自定义cell示例
- iOS 网易新闻用户头像翻转效果核心代码
- 头像选择基本原理
- android 选择头像上传
- 数字信号处理的学习资源
- 汉澳sinox的先进文件系统zfs轻松击败微软ReFS和linux的btrfs
- java之多线程实例
- alibaba technology
- memcpy的实现
- iOS选择头像示例代码
- 嵌入式工程师应该知道的C语言 .
- thumb长跳转指令(BL)机器码详解
- [ATL/WTL]_[中级]_[原生的复选框(checkbox button)和单选按钮(radio button)实现透明背景效果解决方案]
- final 参数的测试
- ubuntu下禁止TeamViewer开机自启分析
- iOS 选择头像后显示到imageView中 纯代码
- java日期和时间
- chapter 9 ICMP