EXC_BAD_ACCESS when trying to get iPhone screen dimensions

后端 未结 1 692
情深已故
情深已故 2021-01-22 07:01

I\'m trying to make certain elements resize according to the screen dimensions when the interface orientation changes. I\'ve read in various places (including a few answers on h

相关标签:
1条回答
  • 2021-01-22 07:16

    %@ format specifier expects format parameter to be objective-c object, while what you provide is plain float. To print float numbers use %f specifier:

    NSLog(@"view dimensions: (%f, %f)", [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height);
    
    0 讨论(0)
提交回复
热议问题