Xcode7 - Swift2 ウインドウズサイズ取得
Xcode 7.0.1 Swift 2.0
下記で取得できる。
self.view.bounds.widthself.view.bounds.height上記は、CGFloat型というやつらしい。計算したりするときは、下記のように型を合わせる必要がある。
let img_h:CGFloat = 500.0 * self.view.bounds.width / 750.0let img_y:CGFloat = img_h * CGFloat(idx)imgView.frame = CGRectMake(0, img_y, self.view.bounds.width, img_h);