2014-10-30 50 views
4

我正在使用UIImagePickerController來記錄,編輯並保存視頻到文件。關閉UIImagePickerController時,狀態欄閃爍紅色並消失。我想避免這種情況。我一直注意到iOS8.1,iOS8,iOS7.1等下降頻率。Redbar在解僱時注意到UIImagePickerController

- (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]; 
} 
+0

在appdelegate中看到什麼是窗口顏色 – 2014-10-30 11:11:38

+0

白色。這似乎是因爲音頻會話而發生的。當錄音未正常停止時,它曾經出現在我身上。 – 2014-10-30 11:29:05

+0

你有沒有解決這個問題的方法@EdAbe – Leena 2014-12-29 07:50:35

回答

6

解決方法!

我無法得到問題的實際解決方案,但找到了解決辦法。 關掉AudioSession

[[AVAudioSession sharedInstance] setActive:NO error:nil] 

解聘前的UIImagePickerController似乎是唯一的選擇。 經過驗證可以滿足我的需求。但可能不是一個理想的解決方案

0

我也有同樣的問題,我發現原因是在.plist中「基於視圖控制器的狀態欄外觀」值爲NO。解決了應該將「基於控制器的狀態欄外觀」值設置爲YES的問題。祝你好運!!!