作者j5307 (JJ)
看板MacDev
标题[问题] 录影储存出现的alertView
时间Fri Nov 23 11:40:56 2012
在录影停止时会出现影片储存的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
1F:→ uranusjr:detachNewThreadSelector: 本来就不保证 selector 里面 11/23 12:10
2F:→ uranusjr:的事情会比 detachNewThreadSelector: 後面的事情先发生 11/23 12:10
所以在这个部分能给点提示吗><
还是没有头绪...
※ 编辑: j5307 来自: 114.40.167.162 (11/25 11:45)
找到方法了 感恩
※ 编辑: j5307 来自: 114.40.167.162 (11/25 13:16)