UIImagePickerController when dismissed pushes view to 20 px up in iOS 6.0 only

前端 未结 4 1171
执笔经年
执笔经年 2021-01-29 04:16

EDIT : I am using UIStoryBoard.

I have presented like this:

UIImagePickerController *imagePicker = [[UIImagePi         


        
相关标签:
4条回答
  • 2021-01-29 04:36

    If that blue part of view is custom UIView then you should check the auto resizing mask for that view. You will find the problem.

    0 讨论(0)
  • 2021-01-29 04:37

    I have similar problem, and in my case 20 pixels was the status bar height. So, try to set status bar visibility to NO before showing imagePicker and YES when it finished (in delegate methods).

    something like this:

    [UIApplication sharedApplication].statusBarHidden = YES;
    [self.navigationController presentViewController:imagePicker animated:YES completion:^{
            }];
    
    
    -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
       // ... your code here
       [UIApplication sharedApplication].statusBarHidden = NO;
       [self dismissViewControllerAnimated:YES completion:^{
        }];
    }
    
    0 讨论(0)
  • 2021-01-29 04:47

    I had similar issue on iOS 8.2. After picking video using UIImagePickerController the frame is increased by 20px, top area of view controller is looking good, but the bottom is cut off. The solution is:

    -(void)openPicker {}
        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
        UIImagePickerController *picker = [[UIImagePickerController alloc] init];
        //configure image picker here
        [self presentViewController:picker animated:YES completion:NULL];
    }
    
    -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
        [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(showStatusBar) userInfo:nil repeats:NO];
        [picker dismissViewControllerAnimated:YES completion:NULL];
    }
    
    -(void)showStatusBar {
        dispatch_async(dispatch_get_main_queue(), ^{
            [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
        });
    }
    
    0 讨论(0)
  • 2021-01-29 05:00

    The reason was i was setting frame of view controller which is in protrait mode as its previous view was in landscape mode.

    self.view.bounds = CGRectMake(0,0,...,...);
    

    Whenever imagepicker dissmiss got called it moved to original position as mentioned.

    Now changed in structure for orientation without setting self.view frame externally solved my problem.

    0 讨论(0)
提交回复
热议问题