Skip to main content
added 1 characters in body
Source Link
gyozo kudor
  • 6.4k
  • 10
  • 55
  • 83

Hello i want to get the width and height of my main view. I want the correct value in landscape or portrait mode. I've tried the following:

 NSLog(@"aaa %f", [UIScreen mainScreen].applicationFrame.size.width); NSLog(@"zzz %f", self.view.frame.size.width); 

These give 30300 in landscape and 320 in portrait mode, yes it is larger in portrait mode. So.. my view takes up the whole screen (- status bar) so I expect 480 in landscape mode and 320 in portrait mode. What happened to the rest of the pixels. Do I have to hardcode these values? Thanks.

Hello i want to get the width and height of my main view. I want the correct value in landscape or portrait mode. I've tried the following:

 NSLog(@"aaa %f", [UIScreen mainScreen].applicationFrame.size.width); NSLog(@"zzz %f", self.view.frame.size.width); 

These give 30 in landscape and 320 in portrait mode, yes it is larger in portrait mode. So.. my view takes up the whole screen (- status bar) so I expect 480 in landscape mode and 320 in portrait mode. What happened to the rest of the pixels. Do I have to hardcode these values? Thanks.

Hello i want to get the width and height of my main view. I want the correct value in landscape or portrait mode. I've tried the following:

 NSLog(@"aaa %f", [UIScreen mainScreen].applicationFrame.size.width); NSLog(@"zzz %f", self.view.frame.size.width); 

These give 300 in landscape and 320 in portrait mode, yes it is larger in portrait mode. So.. my view takes up the whole screen (- status bar) so I expect 480 in landscape mode and 320 in portrait mode. What happened to the rest of the pixels. Do I have to hardcode these values? Thanks.

Source Link
gyozo kudor
  • 6.4k
  • 10
  • 55
  • 83

Iphone: Get current view dimensions or screen dimensions

Hello i want to get the width and height of my main view. I want the correct value in landscape or portrait mode. I've tried the following:

 NSLog(@"aaa %f", [UIScreen mainScreen].applicationFrame.size.width); NSLog(@"zzz %f", self.view.frame.size.width); 

These give 30 in landscape and 320 in portrait mode, yes it is larger in portrait mode. So.. my view takes up the whole screen (- status bar) so I expect 480 in landscape mode and 320 in portrait mode. What happened to the rest of the pixels. Do I have to hardcode these values? Thanks.