Popovercontroller doesn't display full

Posted by user2959234 on Stack Overflow See other posts from Stack Overflow or by user2959234
Published on 2013-11-06T06:59:29Z Indexed on 2013/11/08 3:54 UTC
Read the original article Hit count: 100

Filed under:
|
|
|

I have an UIPopovercontroller in with an content that generate from an viewcontroller.

popOverController = [[UIPopoverController alloc]initWithPopUp:emLightPopUp];
    popOverController.delegate = self;

// Get device position.
    CGRect position = {parentButton.frame.origin,emLightPopUp.popUpView.frame.size};
    CGSize popUpViewFrameSize = emLightPopUp.popUpView.frame.size;

Link screenshot: http://i.stack.imgur.com/AxqoG.png

The issue is that when I change the position of select devices (touched button) upwards, the displayed popup will be resized like the screenshot.

I already try to set content size inside the subclass of uipopover but it still doesn't work:

 self.popoverContentSize  = emLightPopUp.popUpView.frame.size;

EDIT: I solved this problems by calculate the position that display the popup and scroll the scrollview inside into an upper position. Check out this code:

-(void)moveDeviceOutMiddleScreen:(id)deviceButton
{
    UIButton* button = (UIButton*)deviceButton;
    CGFloat yPositionRange = button.frame.origin.y - self.floorZoomScrollView.contentOffset.y;

    int middle_top_y = 70;
    int middle_bottom_y = 166;
    if (yPositionRange > middle_top_y && yPositionRange < middle_bottom_y) {
        CGRect newRect = CGRectMake(self.floorZoomScrollView.contentOffset.x,
                                    self.floorZoomScrollView.contentOffset.y +yPositionRange*0.6,
                                    self.floorZoomScrollView.frame.size.width, self.floorZoomScrollView.frame.size.height);
        [self.floorZoomScrollView scrollRectToVisible:newRect animated:NO];
    }
}

Thanks for your responses.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about xcode