91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

[IOS]Photo應用

發布時間:2020-07-12 03:40:25 來源:網絡 閱讀:316 作者:蓬萊仙羽 欄目:移動開發

IOS應用開發,如何加載圖片庫中的Image到view中?下面我們來學習一下吧!

操作步驟:

1.創建一個SingleView的項目,然后啟動模擬器,點擊模擬器上的瀏覽器,然后將本地的圖片拖放上去,然后點擊圖片長按,點擊saveImage到圖片庫。

2.修改ViewController

ViewController.h:

#import <UIKit/UIKit.h> @interface DXWViewController : UIViewController<UIImagePickerControllerDelegate,UINavigationControllerDelegate> @property (retain, nonatomic) IBOutlet UIImageView *imageView; @property (retain, nonatomic) IBOutlet UIButton *Button; @property(retain,nonatomic) UIImage *image; - (IBAction)click:(id)sender; @end

ViewController.m:

#import "DXWViewController.h"  @interface DXWViewController ()  @end  @implementation DXWViewController  - (void)viewDidLoad {     [super viewDidLoad]; 	 }  -(void)viewWillAppear:(BOOL)animated {     self.imageView.image = self.image; } //加載成功 -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {     self.Image = [info objectForKey:UIImagePickerControllerEditedImage];     [picker dismissViewControllerAnimated:YES completion:nil]; } //取消 -(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {     [picker dismissViewControllerAnimated:YES completion:nil]; }  - (void)dealloc {     [_imageView release];     [_image release];     [_Button release];     [super dealloc]; } //打開圖庫獲取圖片 - (IBAction)click:(id)sender {     if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {         UIImagePickerController *picker = [[UIImagePickerController alloc] init];         picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;         picker.delegate = self;         picker.allowsEditing = YES;         [self presentViewController:picker animated:YES completion:nil];     } } @end


運行結果:

[IOS]Photo應用[IOS]Photo應用[IOS]Photo應用[IOS]Photo應用

demo文件:http://download.csdn.net/detail/s10141303/6037575

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

西林县| 攀枝花市| 绍兴县| 静宁县| 奉化市| 巩留县| 德化县| 广宁县| 正安县| 龙南县| 罗田县| 海盐县| 新晃| 康定县| 揭阳市| 青州市| 体育| 革吉县| 周口市| 霸州市| 蓬溪县| 瓦房店市| 南岸区| 滦平县| 苍山县| 宁河县| 宁远县| 棋牌| 故城县| 双鸭山市| 开封县| 五指山市| 博爱县| 渑池县| 新安县| 虞城县| 钦州市| 邹平县| 大悟县| 开原市| 读书|