IOS自带的相机自带编辑框相册

1.弹出相册和相框的提示框

UIActionSheet* actionSheet = [[UIActionSheetalloc]

initWithTitle:@"请选择照片来源"

delegate:self

cancelButtonTitle:@"取消"

destructiveButtonTitle:nil

otherButtonTitles:@"照相机",@"本地相簿",nil];

[actionSheetshowInView:self.view];

2.

NSLog(@"buttonIndex = [%ld]",(long)buttonIndex);

switch(buttonIndex) {

case0://照相机

{

UIImagePickerController*imagePicker = [[UIImagePickerControlleralloc]init];

imagePicker.delegate=self;

imagePicker.allowsEditing=YES;

imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;

[selfpresentViewController:imagePickeranimated:YEScompletion:nil];

}

break;

case1://本地相簿

{

UIImagePickerController*imagePicker = [[UIImagePickerControlleralloc]init];

imagePicker.delegate=self;

imagePicker.allowsEditing=YES;

imagePicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;

[selfpresentViewController:imagePickeranimated:YEScompletion:nil];

}

break;

default:

break;

}

3.实现相机相册的代理方法

- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info{

UIImage*img = [infoobjectForKey:UIImagePickerControllerEditedImage];

[pickerdismissViewControllerAnimated:YEScompletion:nil];


}

取消

- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker{
}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容