Scale UIView to fill iPad Pro

Is it possible to simply scale a UIView and its subviews to fill the iPad Pro screen? I've been an iOS developer since 2010 and I've been struggleing with Autolayout since its introduction. I've bought books, watched videos and given it the good 'ol college try. Now that I understand it pretty well (still perplexed by some items) it is still a bear to work with. I feel like I'm drawing with my feet whenever I create a layout.


but I digress...


I read something about deleting the Launch Screen.xib to allow the views to scale up automatically and fill the iPad Pro. Unfortunately, I had no luck with that.


I also tried adding all the views so a superview and enabling Autoresize subviews (kinda knew that wouldn't work but I gave it a shot).


The layout is moderately complex, so I need to add some insane constraints here for the iPad Pro (aspect ratios, getting the UIScreen size to apply the percentage of change to the constraint constants on a bunch of views) that will add hours to the project. Any suggestions would be greatly appreciated. I'm amazed Apple made it this difficult to so such simple things like have a button scale up on a bigger screen with the same aspect ratio.


I've been working with Unity and SpriteBuilder. It is amazing how easy they make it working with multiple sized screens (especially those with the same aspect ratio like the iPads).

>I read something about deleting the Launch Screen.xib to allow the views to scale up automatically and fill the iPad Pro. Unfortunately, I had no luck with that.


eh?


You can opt your iPad application into natively supporting the iPad Pro by including a Launch Storyboard and building with the iOS 9.1 or higher SDK.

It's fairly simple. If you provide a launch screen (storyboard or XIB) to opt in to the iPad Pro screen size, then when your app is run on an iPad Pro it will be given a canvas of 1366 x 1024 points. On regular iPads it will be given the regular iPad screen of 1024 x 768 points. You will have to adjust your constraints to make things look good when drawn on either screen size. You won't know until runtime what screen size you will get. (And then there's multitasking... let's not go there...)


If you opt out by not providing a launch screen, then your app will see a screen of 1024 x 768 points on all iPads. It will just be scaled up to fill the screen on the iPad Pro. You only need one set of iPad constraints.


Disclaimer: I do not own an iPad Pro so this is just what I've read (and observed with the recent new screen sizes on iPhones).

After spending hours on this, I simply disabled autolayout and acheived the desired results in minutes:


if UIScreen.mainScreen().bounds.size.width>self.container.frame.size.width{


let startX = (UIScreen.mainScreen().bounds.size.width / 2) - (self.container.frame.size.width/2);

let startY = (UIScreen.mainScreen().bounds.size.height / 2) - (self.container.frame.size.height/2);

self.container.frame = CGRectMake(startX, startY, self.container.frame.size.width, self.container.frame.size.height)

self.container.transform = CGAffineTransformMakeScale(1.33,1.33);

self.fpoImage.frame = UIScreen.mainScreen().bounds;

}


Hopefully Apple will introduce a 'Scaling' tool like Stacked Views last year. That would make this process incredibly easier.

>will be given a canvas of 1366 x 1024 points.


Apps that natively support the iPad Pro will see a screen size of 1024x1366 points at 2x display scale (native bounds is 2732x2048), but perhaps that's what you meant.

I tried deleting the LaunchScreen.storyboard and the app did not scale as expected.

Hello,

I have got the same problem, I have tried: new storyboard, deleting the image, deleting the storyboard at all. Always the screen in the launchscreen is ok at iPad Pro then the app is small /23 of the screen.

Could you please specify where you put the code you mentioned? DO you know if the ObjC willl be managed to do the same?

Thank you in advance

Scale UIView to fill iPad Pro
 
 
Q