0
votes

I have added one UIScrollView and 2 UIImageView into it. It shows up fine in potrait mode. But it hides it in landscape mode. I am running from xcode n simulator and implemented the method - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation.

I am new to iPad programming and lil stuck. Appreciate any help.

2

2 Answers

1
votes
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{

    if(UIInterfaceOrientationIsLandscape(interfaceOrientation))
    {
        [self.view insertSubview:scrollView aboveSubview:imageView];
    }
    else
    {

        [self.view insertSubview:imageView aboveSubview:scrollView];
    }

    return YES;
}
1
votes

The problem seems to be the autoresizing of these views you've added. If you created them from Interface Builder go to the fifth tab on the right panel and select a view, there you can set the view to adjust it's size and position when the parent view changes it's size (which is what happens when you rotate the device). If you created these view from code you should set the autoresizing mask (use the method setAutoresizingMask:), you can add several values to obtain the desired effect.

hope this helps!