[問題] 錄影儲存出現的alertView
在錄影停止時會出現影片儲存的alertView
在viewDidLoad 已經先
[captureSession startRunning];
錄影按鈕 與錄影結束按鈕相同
- (IBAction)record:(id)sender
{
if (!isRecord) {
...
[captureOutput startRecordingToOutputFileURL:theFileURL
recordingDelegate:self];
isRecord = Yes;
}
else{
[NSThread detachNewThreadSelector: @selector(actIndicatorBegin)
toTarget:self withObject:nil];
[captureSession stopRunning];
[captureOutput stopRecording];
[captureSession startRunning];
[NSThread detachNewThreadSelector: @selector(actIndicatorEnd)
toTarget:self withObject:nil];
isRecord = NO;
}
}
//由執行緒產生alertView
- (void) actIndicatorBegin
{
//建立警示視圖
alertView = [[UIAlertView alloc]initWithTitle:@"影片儲存中"
message:@""
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:nil, nil];
[alertView show];
//建立活動指示器,並啓動旋轉動畫
indicator = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicator.center = CGPointMake(CGRectGetMidX(alertView.bounds) ,
CGRectGetMidY(alertView.bounds));
[indicator startAnimating];
//加入警示視圖
[alertView addSubview:indicator];
}
//結束alertView
- (void) actIndicatorEnd
{
//解除警示視圖 重置靜態變數
[alertView dismissWithClickedButtonIndex:0 animated:YES];
[indicator removeFromSuperview];
indicator = nil;
alertView = NULL;
}
現在問題來了
第ㄧ次點擊停止錄影時 畫面會先暫停 才出現警示試圖
第二次點擊停止錄影時 會先出先警示視圖 畫面才暫停 (正常)
第三第四次....都是正常
雖然編譯不會錯 但是第ㄧ次的停止怪怪的
所以感覺我這樣的寫法是錯的...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.40.175.94
→
11/23 12:10, , 1F
11/23 12:10, 1F
→
11/23 12:10, , 2F
11/23 12:10, 2F
所以在這個部分能給點提示嗎><
還是沒有頭緒...
※ 編輯: j5307 來自: 114.40.167.162 (11/25 11:45)
找到方法了 感恩
※ 編輯: j5307 來自: 114.40.167.162 (11/25 13:16)
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章