Port iPhone UIView to iPad verison

SDK: xCode 3.2
Device: iPad

      As the width/height of iPhone is smaller than iPad. When we create new UIVIewController class, we can select iPad version, so that the width/height is correct.

      However, how to update the existing iPhone UIViewController class to have ipad width/height?

      Should i modify the xib file directly to change the width/height?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

view has initWithFrame.
Here is a tutorial for the beginner that shows how to create the view dynamically
I attached a simple example.

The application frame you can get from here:
[UIScreen mainScreen] applicationFrame;
for example:
CGRect appRect = [[UIScreen mainScreen] applicationFrame];
contentView = [[UIView alloc] initWithFrame:appRect];

Here is one more method:

There is also autoresizeing mask:
view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)
Pay attention on 'Autoresize subviews' in the attribute inspector.
- (void)loadView {
  //create a frame that sets the bounds of the view
  CGRect frame = CGRectMake(0, 0, 320, 480);
  //allocate the view
  self.view = [[UIView alloc] initWithFrame:frame];
  //set the view's background color
  self.view.backgroundColor = [UIColor whiteColor];

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
agicfutureAuthor Commented:
Hi pgnatyuk,

So that  "CGRect frame = CGRectMake(0, 0, 320, 480);" is one of the key point.  I will try it out.


Btw, would you please also help on this question? Many thanks.

CGRect frame = CGRectMake(0, 0, 320, 480);

Maybe you need to think about
CGRect appRect = [[UIScreen mainScreen] applicationFrame];

Sorry, I do not have time today to download and compile these samples. So it will be easier, if you can show in that thread some details, what's going on in the program, etc.
agicfutureAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.