0

I am creating a view and setting its autoresizemask:

UIViewController *vc = [[UIViewController alloc]init];
vc.view.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
                                         UIViewAutoresizingFlexibleRightMargin |
                                         UIViewAutoresizingFlexibleTopMargin |
                                         UIViewAutoresizingFlexibleBottomMargin |
                                         UIViewAutoresizingFlexibleWidth |
                                         UIViewAutoresizingFlexibleHeight);

I am then adding it as a subview.

[self.mainView addSubview:flightsHome.view]; //mainView is a UIView IBOutlet which is positioned perfectly

This view is used in both portrait and landscape orientations and I want it to resize accordingly.

My question is what frame (size, origin) should I give this view initially and how does Cocoa Touch determine what the initial frame is.

The code above does not resize as I expect it to.

TheLearner
  • 19,387
  • 35
  • 95
  • 163

1 Answers1

0

You should look at the UIScreen.

here is a reference to a similar post

IPhone/IPad: How to get screen width programmatically?

Community
  • 1
  • 1
Jason Cragun
  • 3,233
  • 1
  • 26
  • 27