问题
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];
}
回答1:
WORKAROUND!!
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]
before dismissing the UIImagePickerController seems to be the only option. This verified to work for my needs. But may not be an ideal solution
回答2:
I also had have the same problem, and I found the reason is in .plist the "View controller-based status bar appearance" value is NO. Solved the problem you should set "View controller-based status bar appearance" value to YES. Good luck!!!
来源:https://stackoverflow.com/questions/26651355/redbar-noticed-when-dismissing-uiimagepickercontroller