まず、ビデオ ファイルをドキュメント ディレクトリに保存する次のコードがあります。
filePath = [NSString stringWithFormat:@"%@/Documents/%f.mp4", NSHomeDirectory(),[[NSDate date] timeIntervalSince1970]];
次にUIAlertView
、ユーザーが保存するビデオに必要な名前を入力できるようにする があります。
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"GIVE YOURE VIDEO A NAME" delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[alert show];
そして、私は入力されたものを表示するためにこれを持っています:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
if (alertView.alertViewStyle == UIAlertViewStylePlainTextInput){
NSLog(@"Entered: %@",[[alertView textFieldAtIndex:0] text]);
}
}
else
{
NSLog(@"user pressed Button Indexed 1");
// Any action can be performed here
}
}
私がしたいことは、.csv ファイルに入力されたテキストで指定された名前でビデオ ファイルを保存することですUIAlertView
。これを行うには、次の行を変更する必要があります。filePath = [NSString stringWithFormat:@"%@/Documents/%f.mp4", NSHomeDirectory(),[[NSDate date] timeIntervalSince1970]];
これにより、ファイルが現在の日付と時刻として入力されたテキストに保存されます。しかし、私はそれをどのように行うのかわかりません。