2

I've created a UIScrollView in Interface Builder which takes up the entire screen of the iPad (0, 0, 1024, 768)

However - when running the app, the scrollView is only displaying on the screen at (0, 0, 1024, 440). The 440 is an estimate, but it is not extending all the way down to fill the screen as it should.

I've done this same thing in other apps and have not encountered this issue. I've run "Clean" on the project and I've tried deleting the scrollView and recreating it and still the same issue occurs.

I even tried to programmatically reinforce what's in Interface Builder but still it showed up the same way.

CGRect scrollFrame = CGRectMake(0, 0, 1024, 768);
[scrollView setFrame:scrollFrame];

If you have any idea why this may be happening, your help would be GREATLY appreciated.

* UPDATE * After some more research, there is something wrong with the view controller. That area at the bottom where the scrollView isn't showing is totally not accessible. If I put a button toward the bottom of the screen, I can't click that button. If it's up in the top half of the screen I can click it just fine.

Also, the scrollview isn't really starting at 0, 0. Where it starts it is missing the top part of the content. So it seems like the scrollView DOES have the height of 768, but is starting at -320 so that the top of it is off the top of the screen and the bottom of it ends before the bottom of the screen.

RanLearns
  • 4,086
  • 5
  • 44
  • 81
  • 1
    Can you explain your view hierarchy a bit? – Deepak Danduprolu Jun 27 '11 at 04:21
  • Check correctly, you did a mistake some where in code. – Ishu Jun 27 '11 at 04:31
  • Is the view controller in a tab view controller or navigation controller? – bunnyhero Jun 27 '11 at 06:22
  • it's a view-based application where I create my own view controllers – RanLearns Jun 27 '11 at 06:32
  • I faced similar problem in one of my application. I found that I have done something wrong with the default view provided with the View controller, I bounded that view with one of IBOutlet and was not able to access some part of view as you are facing. just FYI. Rename existing and may be recreating UIViewController with same name would resolve your problem. – Janak Nirmal Jun 27 '11 at 08:50

2 Answers2

0

The issue seems to have been that the app thought it was in Portrait mode even though I had the .xib in Landscape mode.

Fixed it with this little trick in the viewDidLoad of the mainProjectViewController:

CGRect landFrame = self.view.frame;
landFrame.size.width = self.view.frame.size.height;
landFrame.size.height = self.view.frame.size.width;
self.view.frame = landFrame;
RanLearns
  • 4,086
  • 5
  • 44
  • 81
0

Actually, viewing it in landscape mode is just a convenience for you to see what happens if you rotate the device. Launching in landscape mode can be problematic. See this question and its answers for some excellent info.

Community
  • 1
  • 1
mackworth
  • 5,873
  • 2
  • 29
  • 49