1

I am having trouble setting up the frame for one of my views. I know that the height in points of the iPhone 5 is 568, but when I enter this code into the viewDidLoad in my ViewController:

    var height = self.bounds.height
    println(height)

output:

    640.0

Why does it come out as this when it should be 568? Is it a problem with the simulator?

bhzag
  • 2,932
  • 7
  • 23
  • 39

2 Answers2

2

I thin your viewController height is more than 568.You have did FreeForm.Check the height in Size inspector of your view controller. Make simulated size fixed.

enter image description here

EDIT: You can make it portrait and iPhone 4 inch to show it correctly see below.

enter image description here

codester
  • 36,891
  • 10
  • 74
  • 72
0

To get the height of the screen you want the height of the VIEW. To do that you would want:

DO NOT PUT:

var height = self.view.bounds.height

DO:

var height = self.view.bounds.size.height

Wyetro
  • 8,439
  • 9
  • 46
  • 64