自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

iPhone開發(fā) 在模擬器中添加視頻

移動(dòng)開發(fā) iOS
本文介紹的是iPhone開發(fā) 在模擬器中添加視頻,很有趣的一個(gè)小實(shí)例,具體實(shí)現(xiàn)結(jié)果,我們一起來(lái)看內(nèi)容。

iPhone開發(fā) 在模擬器中添加視頻是本文要介紹對(duì)內(nèi)容,要把視頻添加進(jìn)模擬器,真機(jī)上的 iTunes 同步法是沒用的。CocoaChina 會(huì)員“castielyue”分享了他的視頻添加工程,把 video 放在 resource 里,把 viewdidload 里的 video 名改下,運(yùn)行后就會(huì)自動(dòng)添加到模擬器的相片庫(kù)里。附件下載 SaveVideo.zip (1068 K)。

這里主要用到了以下函數(shù)

  1. UIVideoAtPathIsCompatibleWithSavedPhotosAlbum  
  2.  
  3. Returns a Boolean value indicating whether the specified video can be saved to user’s Saved Photos album.  
  4.  
  5. BOOL UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (  
  6.    NSString *videoPath  
  7. ); 

Parameters

videoPath

The filesystem path to the movie file you want to save.

Return Value

YES if the video can be saved to the photo album or NO if it cannot.

Discussion

Not all devices are able to play video files placed in the user’s Saved Photos album. So, before attempting to save videos to the user’s camera roll, you should call this function to ensure that saving the video is supported for the current device.

相應(yīng)的,向模擬器里添加圖片的話,可使用這個(gè)函數(shù)

  1. UIImageWriteToSavedPhotosAlbum  
  2. Adds the specified image to the user’s Saved Photos album.  
  3. void UIImageWriteToSavedPhotosAlbum (  
  4.    UIImage *image,  
  5.    id completionTarget,  
  6.    SEL completionSelector,  
  7.    void *contextInfo  
  8. ); 

Parameters

image

The image to write to the user’s device.

completionTarget

The object whose selector should be called after the image has been written to the user’s device.

completionSelector

The method selector, of the target object, to call. This optional method should be of the form:

  1. - (void) image: (UIImage *) image  
  2.     didFinishSavingWithError: (NSError *) error  
  3.     contextInfo: (void *) contextInfo; 

contextInfo

An optional pointer to any context-specific data that you want passed to the completion selector.

Discussion

The use of the completionTarget, completionSelector, and contextInfo parameters is optional and necessary only if you want to be notified asynchronously when the function finishes writing the image to the user’s Saved Photos album. If you do not want to be notified, pass nil for these parameters.

小結(jié):iPhone開發(fā) 在模擬器中添加視頻的內(nèi)容介紹完了,希望本文對(duì)你有所幫助!

本文來(lái)自:http://www.cocoachina.com/iphonedev/sdk/2010/1229/2520.html

責(zé)任編輯:zhaolei 來(lái)源: CocoaChina
相關(guān)推薦

2011-07-26 09:32:08

iPhone 模擬器

2009-08-20 10:55:59

2011-07-27 17:45:29

iPhone 模擬器 圖片

2022-12-30 14:21:54

2011-09-13 17:23:26

2011-06-07 16:58:42

Android 模擬器

2013-07-04 13:29:40

Androidgenymotion

2009-09-14 09:59:19

CCNA模擬器介紹CCNA

2011-08-18 17:32:55

iPhone開發(fā)Table Cell

2009-08-05 15:23:04

ExtJS Andro

2011-07-06 13:33:41

iPhone 模擬器 XCode

2010-04-12 17:32:59

Windows Pho

2009-09-04 16:05:08

2011-05-31 09:16:26

Android Mar應(yīng)用商店Google

2011-07-26 14:18:20

2011-07-22 16:22:27

iPhone Lipo 模擬器

2010-06-21 15:39:59

Windows Pho

2011-08-16 18:56:11

iPhone開發(fā)Three20

2009-09-17 09:11:59

CCNA實(shí)驗(yàn)?zāi)M器CCNA

2010-01-27 13:37:15

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)