2012-04-25 3 views
4

私は彼のライブラリーからビデオを選んで45秒に制限したいと思っています(WhatsAppのように - あなたはビデオを編集でき、送信されるビデオは45秒以下です。videoMaximumDurationは期間を制限していません

しかし、私は次のコードを使用している場合、それは関係なく、継続時間の映像を選ぶ、と私は(ビデオ、長さ1分でそれをテスト済み)のWhatsAppで

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; 
     imagePickerController.delegate = self; 
     imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
     imagePickerController.videoQuality = UIImagePickerControllerQualityTypeLow; 
     imagePickerController.videoMaximumDuration = 45.0f; //? 
     imagePickerController.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; 

     [[self parentViewController] presentModalViewController:imagePickerController animated:YES]; 
     [imagePickerController release]; 

それをトリムカント、Iありません次の画面を表示します。これは再現したいものです: enter image description here

答えて

14

コントローラを表示する前にallowEditingをYESに設定してください。

imagePickerController.allowsEditing = YES;

+0

これは意味があります。私はそれを試みる!ヒントありがとう! –