UIImagePickerController在被解雇时使用UITabbarcontroller获取带有应用名称的redbar

时间:2015-02-25 15:26:55

标签: ios objective-c uinavigationcontroller uitabbarcontroller uiimagepickercontroller

我正在使用UIImagePickerController来录制视频并拍照,编辑并将视频保存到文件中。在关闭UIImagePickerController时,状态栏闪烁红色并消失,有时我的tabbar向下移动。 无法理解为什么会发生这种问题。

enter image description here  我想避免这种情况。从iOS8.1,iOS8,iOS7.1等开始降低频率,我一直注意到这一点

tabbar向下移动一段时间(意味着随机)。enter image description here

为什么当我在服务器上录制视频和上传或在uiimagepickerviewcontreller中使用取消按钮时,钢筋即将到来。 。为什么当我拍摄影像时它不会进来,以及为什么每次都不会出现它来。

    -(void)mediaAction{

/// calling action sheet action 
        }

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

    //setting for image
    cameraUI = [[UIImagePickerController alloc] init];
    cameraUI.delegate = self;


    //Get the name of the current pressed button
    NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex];

    if ([buttonTitle isEqualToString:@"Record a Video"]) {
        mediachecker=@"video";
        cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
        cameraUI.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
        cameraUI.allowsEditing = NO;
        [self presentViewController:cameraUI animated:YES completion:nil];

    }
    if ([buttonTitle isEqualToString:@"Upload from Gallery"]) {
        //NSLog(@"ChooseFromGallery");
        mediachecker=@"video";
        cameraUI.allowsEditing = YES;
        cameraUI.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
        cameraUI.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
        [self presentViewController:cameraUI animated:YES completion:NULL];

    }

    if ([buttonTitle isEqualToString:@"Click a Picture"]) {

        mediachecker=@"photo";
        cameraUI.allowsEditing=YES;
        cameraUI.sourceType=UIImagePickerControllerSourceTypeCamera;
        [self presentViewController:cameraUI animated:YES completion:NULL];
        //NSLog(@"UseCamera");

    }
    if ([buttonTitle isEqualToString:@"Photo Library"]) {
        //NSLog(@"UseGallery");
        mediachecker=@"photo";
        cameraUI.allowsEditing=YES;
        cameraUI.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
        [self presentViewController:cameraUI animated:YES completion:NULL];

    }

    if ([buttonTitle isEqualToString:@"Cancel"]) {
    }

}  



 - (void) imagePickerController: (UIImagePickerController *) picker
             didFinishPickingMediaWithInfo: (NSDictionary *) info {

                [picker dismissViewControllerAnimated:YES completion:nil];

            //getting file here; and uploading 
}


- (void) imagePickerControllerDidCancel: (UIImagePickerController *) picker {


[[picker presentingViewController] dismissViewControllerAnimated:YES completion:nil];
            //dissming here; 

            }

我已经提到了这些链接 Redbar Noticed when dismissing UIImagePickerController

IPhone - After dismissing Modal View Controller - gap is left at top of page

但仍然遇到同样的问题。如何解决这个问题。

1 个答案:

答案 0 :(得分:0)

我在拍摄视频时解雇UIImagePickerViewController时遇到了同样的问题:不要递归引用Stack Overflow链接,但这解决了我的问题:

尝试:"您应该设置"查看基于控制器的状态栏外观" .plist"

中的值为YES

UIImagePickerController messing tabbar frame when dismissing

不确定为什么答案会引用这个,而且这里没有回答。