博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
打开相册另类写法
阅读量:5033 次
发布时间:2019-06-12

本文共 3024 字,大约阅读时间需要 10 分钟。

 

 

- (IBAction)actionPhoto:(id)sender//-------------------------------------------------------------------------------------------------------------------------------------------------{    PresentPhotoLibrary(self, YES);}#pragma mark - UIImagePickerControllerDelegate//-------------------------------------------------------------------------------------------------------------------------------------------------- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info//-------------------------------------------------------------------------------------------------------------------------------------------------{………………}
//-------------------------------------------------------------------------------------------------------------------------------------------------BOOL PresentPhotoLibrary(id target, BOOL canEdit)//-------------------------------------------------------------------------------------------------------------------------------------------------{    if (([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary] == NO         && [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum] == NO)) return NO;    //---------------------------------------------------------------------------------------------------------------------------------------------    NSString *type = (NSString *)kUTTypeImage;    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];    //---------------------------------------------------------------------------------------------------------------------------------------------    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]        && [[UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary] containsObject:type])    {        imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;        imagePicker.mediaTypes = [NSArray arrayWithObject:type];    }    else if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]             && [[UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum] containsObject:type])    {        imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;        imagePicker.mediaTypes = [NSArray arrayWithObject:type];    }    else return NO;    //---------------------------------------------------------------------------------------------------------------------------------------------    imagePicker.allowsEditing = canEdit;    imagePicker.delegate = target;    [target presentViewController:imagePicker animated:YES completion:nil];    //---------------------------------------------------------------------------------------------------------------------------------------------    return YES;}

 

转载于:https://www.cnblogs.com/songxing10000/p/4823037.html

你可能感兴趣的文章
Direct2D教程(三)简单几何图形
查看>>
手机GUI自动化测试介绍
查看>>
进程间通信——IPC之共享内存
查看>>
斐波拉契数列的由来
查看>>
第4课 脚本命令与登录程序
查看>>
Windows加密服务架构
查看>>
php with bootstrap
查看>>
firedebug调试Jquery
查看>>
相同属性类之间的转换
查看>>
关于GIT合并出错的记录
查看>>
线性代数作业
查看>>
Appium+python自动化18-brew、carthage和appium-doctor
查看>>
PythonWeb开发教程(二),搭建第一个django项目
查看>>
javax.transaction.xa.XAException: java.sql.SQLException: 无法创建 XA 控制连接。(SQL 2000,SQL2005,SQL2008)...
查看>>
请指点下!我不想浪费资源
查看>>
Magento How To Display Product Custom Option On list.phtml
查看>>
使用js对select动态添加和删除OPTION
查看>>
dnn给搜索引擎所做的工作
查看>>
日志服务器的运作机制:
查看>>
TensorFlow2.0矩阵与向量的加减乘
查看>>