偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

iPhone應用開發(fā)之調用系統(tǒng)照相機

移動開發(fā) iOS
本文介紹的是IPhone應用開發(fā)之UIImagePickerController調用系統(tǒng)照相機,很詳細的介紹了iphone應用程序的一個實例,來看內容。

IPhone應用開發(fā)之UIImagePickerController調用系統(tǒng)照相機是本文要介紹的內容,不多說,我們來看內容。iphone api中提供了調用系統(tǒng)照相機的接口,我們只需調用相應的界面,即刻在自己的程序中獲取相機圖片.下面是一個非常簡單的調用系統(tǒng)照相機的例子.

相應的界面如下:

iPhone應用開發(fā)之UIImagePickerController調用系統(tǒng)照相機 

iPhone應用開發(fā)之UIImagePickerController調用系統(tǒng)照相機 iPhone應用開發(fā)之UIImagePickerController調用系統(tǒng)照相機

***可以編輯圖片和使用相應的圖片.

下面是主要代碼:

  1. - (void) addPicEvent   
  2. {   
  3.     //先設定sourceType為相機,然后判斷相機是否可用(ipod)沒相機,不可用將sourceType設定為相片庫   
  4.     UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;   
  5.     if (![UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {   
  6.         sourceType = UIImagePickerControllerSourceTypePhotoLibrary;   
  7.     }     
  8.     UIImagePickerController *picker = [[UIImagePickerController alloc] init];   
  9.     picker.delegate = self;   
  10.     picker.allowsEditing = YES;   
  11.     picker.sourceType = sourceType;   
  12.     [self presentModalViewController:picker animated:YES];   
  13.     [picker release];   
  14. }   
  15. - (void)saveImage:(UIImage *)image {   
  16.     NSLog(@"保存");   
  17. }   
  18. #pragma mark –   
  19. #pragma mark Camera View Delegate Methods   
  20. - (void)imagePickerController:(UIImagePickerController *)picker   
  21. didFinishPickingMediaWithInfo:(NSDictionary *)info {   
  22.     [picker dismissModalViewControllerAnimated:YES];   
  23.     UIImage *image = [[info objectForKey:UIImagePickerControllerEditedImage] retain];   
  24.     [self performSelector:@selector(saveImage:)   
  25.                withObject:image   
  26.                afterDelay:0.5];   
  27. }   
  28. - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {   
  29.     [picker dismissModalViewControllerAnimated:YES];   

源代碼:http://easymorse-iphone.googlecode.com/svn/trunk/CameIphone/

小結:IPhone應用開發(fā)之UIImagePickerController調用系統(tǒng)照相機的內容介紹完了,希望本文對你有所幫助!

責任編輯:zhaolei 來源: 互聯(lián)網
相關推薦

2022-12-15 17:35:37

2015-11-17 11:02:35

2011-08-10 10:10:21

iPhoneUIPopoverCo

2017-05-23 10:17:40

互聯(lián)網

2021-11-02 22:50:10

鼠標計算機傳感器

2011-08-11 10:03:43

iPhonecocoaNSRunLoop

2011-08-09 11:36:41

iPhoneUIPickerVieDEMO

2011-08-11 17:15:54

iPhone歸檔

2011-08-17 15:19:38

iPhone應用數(shù)據(jù)

2011-08-03 16:01:24

iPhone應用開發(fā) 自動登陸

2012-03-02 10:35:22

金山快盤云相機

2013-11-18 10:27:05

Tizen智能家居

2011-07-08 14:58:16

iPhone Xcode iOS

2011-07-19 09:46:38

2011-07-19 09:58:36

2011-08-08 10:10:14

iPhone開發(fā) 圖片 方法

2011-08-08 16:56:44

iPhone 字符處理 視圖

2011-08-09 17:29:29

iPhone文件屏幕

2011-08-01 18:27:58

iPhone開發(fā) UISearchBa

2012-10-29 10:59:27

Windows 8
點贊
收藏

51CTO技術棧公眾號