
下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
- (voID)vIEwDIDLoad { [super vIEwDIDLoad]; // Do any additional setup after loading the vIEw. self.imageVIEw = [[UIImageVIEw alloc] initWithFrame:CGRectMake(60,100,200,300)]; _imageVIEw.image = [UIImage imagenamed:@"hmt.jpg"]; _imageVIEw.userInteractionEnabled = YES; [self.vIEw addSubvIEw:_imageVIEw]; UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] init]; tapGesture.numberOfTapsrequired = 1; tapGesture.numberOftouchesrequired = 1; [tapGesture addTarget:self action:@selector(tapSaveImagetoIphone)]; [self.imageVIEw addGestureRecognizer:tapGesture]; } - (voID)tapSaveImagetoIphone{ /** * 将图片保存到iPhone本地相册 * UIImage *image 图片对象 * ID completionTarget 响应方法对象 * SEL completionSelector 方法 * voID *contextInfo */ UIImageWritetoSavedPhotosAlbum(self.imageVIEw.image,self,@selector(image:dIDFinishSavingWithError:contextInfo:),nil); } - (voID)image:(UIImage *)image dIDFinishSavingWithError:(NSError *)error contextInfo:(voIDvoID *)contextInfo{ if (error == nil) { UIAlertVIEw *alert = [[UIAlertVIEw alloc] initWithTitle:@"提示" message:@"已存入手机相册" delegate:self cancelbuttonTitle:nil otherbuttonTitles:@"确定",nil nil]; [alert show]; }else{ UIAlertVIEw *alert = [[UIAlertVIEw alloc] initWithTitle:@"提示" message:@"保存失败" delegate:self cancelbuttonTitle:nil otherbuttonTitles:@"确定",nil nil]; [alert show]; } } 以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的iOS开发之保存图片到手机相册全部内容,希望文章能够帮你解决iOS开发之保存图片到手机相册所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)