實例如下所示:

成都創(chuàng)新互聯(lián)公司專注于巫溪網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供巫溪營銷型網(wǎng)站建設(shè),巫溪網(wǎng)站制作、巫溪網(wǎng)頁設(shè)計、巫溪網(wǎng)站官網(wǎng)定制、小程序開發(fā)服務(wù),打造巫溪網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供巫溪網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
//保存圖片
-(void)saveImageDocuments:(UIImage *)image{
//拿到圖片
UIImage *imagesave = image;
NSString *path_sandox = NSHomeDirectory();
//設(shè)置一個圖片的存儲路徑
NSString *imagePath = [path_sandox stringByAppendingString:@"/Documents/test.png"];
//把圖片直接保存到指定的路徑(同時應(yīng)該把圖片的路徑imagePath存起來,下次就可以直接用來取)
[UIImagePNGRepresentation(imagesave) writeToFile:imagePath atomically:YES];
}
// 讀取并存貯到相冊
-(UIImage *)getDocumentImage{
// 讀取沙盒路徑圖片
NSString *aPath4=[NSString stringWithFormat:@"%@/Documents/%@.png",NSHomeDirectory(),@"test"];
// 拿到沙盒路徑圖片
UIImage *imgFromUrl3=[[UIImage alloc]initWithContentsOfFile:aPath4];
// 圖片保存相冊
UIImageWriteToSavedPhotosAlbum(imgFromUrl3, self, nil, nil);
return imgFromUrl3;
}以上這篇iOS 沙盒圖片保存讀取實例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持創(chuàng)新互聯(lián)。
網(wǎng)頁名稱:iOS沙盒圖片保存讀取實例
文章地址:http://chinadenli.net/article44/gsgcee.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、網(wǎng)站建設(shè)、微信公眾號、面包屑導(dǎo)航、網(wǎng)站制作、App開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)