Xcode 6 beta and resizable Iphone: How to get the current Screen Dimensions

465 views Asked by At

I try to make my Views completely dynamic so the Views can fit any Screen Dimensions. At the Moment i get the screen Width and Height for calculation like this:

CGFloat getDisplayHeight() {
CGSize result = [[UIScreen mainScreen] bounds].size;
return result.height;
}

CGFloat getDisplayWidth() {
CGSize result = [[UIScreen mainScreen] bounds].size;
return result.width;
}

The Problem is that the "Resizable Iphone" Emulator always give me a Width of 768 and a Height of 1024 (Like the iPad). It doesn´t matter when i change the Width and Height Values on the Bottom of the Emulator...is there any new Function i can use for better testing?

EDIT:

I´m still not sure how to handle this exactly...At the Moment i calculate the Size of my Subviews in "viewDidLayoutSubviews" because this is the only Method which shows the correct Width and Heigth of the "resizable Iphone Simulator", the Problem is that when i calculate all my Stuff inside this method it gets called every time when i scroll or touch the UI, so it could be the case that it gets called hundreds of times...and when i try to calculate my Views in "ViewDidAppear" its too late and evrything look reallys weird after the recalculation....

0

There are 0 answers