Port iPhone UIView to iPad verison

SDK: xCode 3.2
Device: iPad

Problem:
      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?

Thanks.
agicfutureAsked:
Who is Participating?
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.

pgnatyukCommented:
view has initWithFrame.
Here is a tutorial for the beginner that shows how to create the view dynamically
http://www.switchonthecode.com/tutorials/an-absolute-beginners-guide-to-iphone-development
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:
http://www.zimbio.com/iPhone/articles/1109/Picking+Images+iPhone+SDK+UIImagePickerController

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

0

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.

Thanks.

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

http://www.experts-exchange.com/Apple/Programming/Objective-C/Q_25828769.html
0
pgnatyukCommented:
CGRect frame = CGRectMake(0, 0, 320, 480);

Maybe you need to think about
CGRect appRect = [[UIScreen mainScreen] applicationFrame];
0
pgnatyukCommented:
http://www.experts-exchange.com/Apple/Programming/Objective-C/Q_25828769.html

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.
0
agicfutureAuthor Commented:
Good
0
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
C

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.