问题描述
我正在使用UIImagePickerController记录,编辑视频并将其保存到文件.在关闭UIImagePickerController时,状态栏闪烁红色并消失.我想避免这种情况.我一直注意到,iOS8.1,iOS8,iOS7.1等的出现频率在降低.
I am using the UIImagePickerController to record, edit and save Video to file. While dismissing the UIImagePickerController the status bar blinks red and disappears. I want to avoid this. I have been noticing this in decreasing frequency from iOS8.1, iOS8, iOS7.1 ,etc
- (void) cameraClicked{
self.recordState=KRERecordStateRecording;
UIImagePickerController *pickerController = [[UIImagePickerController alloc] init];
pickerController.delegate = self;
pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
if(self.mediaType==MediaTypePhoto){
pickerController.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil];
}else if(self.mediaType==MediaTypeVideo){
pickerController.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
pickerController.allowsEditing = YES;
pickerController.videoMaximumDuration=30.0f;
}
[self presentViewController:pickerController animated:YES completion:nil];
}
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo{
}
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info{
[picker dismissViewControllerAnimated:YES completion:nil];
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
if (CFStringCompare ((CFStringRef) mediaType, kUTTypeImage, 0)
== kCFCompareEqualTo) {
self.selectedMedia = [[NSArray alloc] initWithObjects:[info objectForKey:UIImagePickerControllerOriginalImage], nil];
[self saveMedia];
}else if(CFStringCompare ((CFStringRef) mediaType, kUTTypeMovie, 0)
== kCFCompareEqualTo){
videoURL= [info objectForKey:UIImagePickerControllerMediaURL];
[self saveMedia];
}
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
[picker dismissViewControllerAnimated:YES completion:nil];
}
推荐答案
WORKAROUND !!
WORKAROUND!!
我无法获得该问题的实际解决方案,但确实找到了解决方法.关闭AudioSession
I couldn't get an actual solution for the problem but did find a work around.Switch off the AudioSession
[[AVAudioSession sharedInstance] setActive:NO error:nil]
在关闭UIImagePickerController之前似乎是唯一的选择.经验证可以满足我的需求.但这可能不是理想的解决方案
before dismissing the UIImagePickerController seems to be the only option. This verified to work for my needs. But may not be an ideal solution
这篇关于关闭UIImagePickerController时注意到红条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!