ios 设置相机照片库中文
2015-07-11 17:12
281 查看
设置info
实现跳转,选择图片
func fromAlbum() { //判断设置是否支持图片库 if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary) { //初始化图片控制器 let picker = UIImagePickerController() //设置代理 picker.delegate = self //指定图片控制器类型 picker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary //设置允许编辑 picker.allowsEditing = true //弹出控制器,显示界面 self.presentViewController(picker, animated: true, completion: { () -> Void in }) }else { let aler = UIAlertView(title: "读取相册错误", message: nil, delegate: nil, cancelButtonTitle: "确定") aler.show() } } func fromPhotograph() { if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) { //创建图片控制器 let picker = UIImagePickerController() //设置代理 picker.delegate = self //设置来源 picker.sourceType = UIImagePickerControllerSourceType.Camera //允许编辑 picker.allowsEditing = true //打开相机 self.presentViewController(picker, animated: true, completion: { () -> Void in if UIImagePickerController.isCameraDeviceAvailable(UIImagePickerControllerCameraDevice.Front) { picker.cameraDevice = UIImagePickerControllerCameraDevice.Front } }) } else { let aler = UIAlertView(title: "找不到相机", message: nil, delegate: nil, cancelButtonTitle: "确定") aler.show() } } func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) { //查看info对象 println(info) //获取选择的原图 let image = info[UIImagePickerControllerOriginalImage] as! UIImage //赋值,图像视图显示图片 picView.image = image //图片控制器退出 picker.dismissViewControllerAnimated(true, completion: { () -> Void in }) } func imagePickerControllerDidCancel(picker: UIImagePickerController) { //图片控制器退出 picker.dismissViewControllerAnimated(true, completion: { () -> Void in }) }
相关文章推荐
- iOS调用系统相册、相机界面语言设置为中文
- iOS调用系统相册、相机界面语言设置为中文
- iOS调用系统相册、相机 显示中文标题
- iOS 6编程-使用Photo Library(照片库)和相机
- 关于iOS应用通过OpenURL在设置打开相机权限,然后原应用会立即崩溃(重启)的理解
- IOS FKConsole设置XCODE控制台输出中文
- 调用系统自带的相机,日历等,将英文设置为中文
- iOS 设置app语言中文,比如 copy中文,拍照按钮cancel 中文
- iOS APP中将系统文字设置为中文
- IOS相机字体英文转中文
- iOS 调用系统相册 相机 时,显示中文标题
- iOS陆先森随笔(二)ios8,模拟器设置中文键盘
- iOS 调用系统相机、相册时显示中文问题
- iOS 调用相机拍照和选择图库图片 设置头像
- iOS开发-调用系统相机文字改为中文
- iOS开发--调用系统相册、相机显示中文title
- iOS开发中调用系统相册、相机 显示中文标题
- IOS 设置ios中DatePicker的日期为中文格式
- ios 打开图片库和相机选择图片界面英文修改为简体中文