IOS调用相机相册(1)
来源:互联网 发布:战舰世界藏王数据 编辑:程序博客网 时间:2024/05/18 17:58
//// SendViewController.m// WeiNiXieShi//// Created by vshine on 14-5-18.// Copyright (c) 2014年 wdl. All rights reserved.//#import "SendViewController.h"#import <MobileCoreServices/UTCoreTypes.h>@interface SendViewController ()<UIActionSheetDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate>-(IBAction)selectDescPic:(id)sender;@end@implementation SendViewController- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { } return self;}- (void)viewDidLoad { [super viewDidLoad];}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning];}-(IBAction)selectDescPic:(id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"拍照", @"从手机相册选择",nil]; actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; [actionSheet showInView:self.view];}-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { UIImagePickerController *camera = [[UIImagePickerController alloc] init]; camera.delegate = self; camera.allowsEditing = NO; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { camera.sourceType = UIImagePickerControllerSourceTypeCamera; //此处设置只能使用相机,禁止使用视频功能 camera.mediaTypes = [[NSArray alloc]initWithObjects:(NSString *)kUTTypeImage,nil]; } else { NSLog(@"相机功能不可用"); return; } [self presentViewController:camera animated:YES completion:nil]; } else if (buttonIndex == 1) { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.allowsEditing = NO; //从相册列表选取 picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { //此处设置只能使用相机,禁止使用视频功能 picker.mediaTypes = [[NSArray alloc]initWithObjects:(NSString *)kUTTypeImage,nil]; } [self presentViewController:picker animated:YES completion:nil]; } else if(buttonIndex == 2) { //取消 }}@end
0 0
- IOS调用相机相册(1)
- iOS调用相册、相机、上传
- iOS--调用相机和相册
- iOS 10调用相机相册
- ios开发学习笔记--调用相册或相机(UIImagePickerController)
- iOS调用相机/相册,并使用VPImageViewController(三方库)对图像处理(1)
- ios调用相册或相机上传图片
- iOS调用相册、相机、上传等问题
- iOS调用相册、相机、上传等问题
- iOS 相册 相机的调用及上传
- iOS中调用相机以及相册
- ios开发调用系统相机相册
- iOS 调用相册/相机/图片压缩
- IOS 如何调用相机和相册
- iOS开发 调用系统相机和相册
- iOS调用相机,相册,上传头像
- [iOS]调用系统相机,相册,闪光灯
- iOS学习: 系统相机 相册的调用
- 地图API公交线路查询
- 我的c#之路(6.类型转换)
- JAVA安卓开发第二天
- 快速摸清一个行业的基本情况
- 淘宝的行癲时代(上)
- IOS调用相机相册(1)
- POI3.8中 大数据量的处理
- 《C++ Primer第四版》学习笔记(五)变量和基本类型 之 变量
- oracle 错误 access violation at address in module 'ora805.dll'. write of address
- Sciter笔记- 1
- python 使用memcache
- MyEclipse中变量变色的问题
- 机器翻译很搞笑
- 为View创建截图的优化方案