Xcode 6 beta and resizable Iphone: how to get current screen sizes

I am trying to make my views fully dynamic so that the views can fit any screen size. At the Moment I get the Width and Height screen to calculate 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 the "Resizable Iphone" emulator always gives me a width of 768 and a height of 1024 (just like the iPad). It doesn't matter when I change the width and height values ​​at the bottom of the emulator ... is there any new feature I can use for better testing?

EDIT:

I'm still not sure how to deal with this ... At Moment I am calculating the size of my Subviews in "viewDidLayoutSubviews" because that is the only method that shows the correct width and height of the "Resizable Iphone Simulator" The problem is that when I calculate all my stuff inside this method, it gets called every time I scroll or touch the UI, so it could be that it is called hundreds of times ... and when I try to calculate my views in "ViewDidAppear" its too late and everyone looks weird after recounting ....

+3


source to share





All Articles