星空网 > 软件开发 > 操作系统

iOS中调用系统相册以及使用系统相册的照片

#import "ViewController.h"@interface ViewController ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate>@property (nonatomic,strong)UIImageView *headImageView;@end@implementation ViewController- (void)viewDidLoad {  [super viewDidLoad];  self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];  _headImageView.backgroundColor = [UIColor yellowColor];  _headImageView.layer.cornerRadius = 50;  _headImageView.layer.masksToBounds = YES;  _headImageView.tag = 101;  [self.view addSubview:_headImageView];    _headImageView.userInteractionEnabled = YES;  UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];  [_headImageView addGestureRecognizer:tap];          // Do any additional setup after loading the view, typically from a nib.}- (void)tapAction:(UIImageView*)sender{  UIImagePickerController *imagePicker = [[UIImagePickerController alloc]init];  imagePicker.allowsEditing = YES;  imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;  imagePicker.delegate = self;  [self presentViewController:imagePicker animated:YES completion:^{    NSLog(@"打开相册");  }];}- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{  [picker dismissViewControllerAnimated:YES completion:^{    NSLog(@"取消");  }];}- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{  _headImageView.image = info[UIImagePickerControllerEditedImage];  NSLog(@"%@",info);  [picker dismissViewControllerAnimated:YES completion:^{    NSLog(@"选照片");  }];      }- (void)didReceiveMemoryWarning {  [super didReceiveMemoryWarning];  // Dispose of any resources that can be recreated.}@end

 




原标题:iOS中调用系统相册以及使用系统相册的照片

关键词:IOS

IOS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

跨境电商亚马逊无货源店群铺货系统亚马逊铺货erp:https://www.ikjzd.com/w/2665
YINOLINK易诺:https://www.ikjzd.com/w/2666
Youfen有粉_跨境社交电商粉丝营销系统:https://www.ikjzd.com/w/2668
Shopee实操指南:https://www.ikjzd.com/w/2669
Unicorn Smasher功能,查销量:https://www.ikjzd.com/w/267
CBO:https://www.ikjzd.com/w/2670
珠海市图书馆官网入口:https://www.vstour.cn/a/335174.html
珠海图书馆几点开门几点关门?附营业时间:https://www.vstour.cn/a/335175.html
相关文章
我的浏览记录
最新相关资讯
跨境电商服务平台 | 深圳旅行社 | 东南亚物流