この方法を使用して、画面の幅と高さを検出しました。ただし、縦向きと横向きでも幅が 768、高さが 1024 と表示されます。
CGRect screenBounds = [[UIScreen mainScreen] bounds];
float widthfloat= screenBounds.size.width;
float heightfloat= screenBounds.size.height;
NSLog(@" width float %f",widthfloat);
NSLog(@"height float %f",heightfloat);
NSLog(@"width view %f \n height view %f", self.view.bounds.size.width, self.view.bounds.size.height);
NSLog(@"width %f \n height %f", screenBounds.size.width, screenBounds.size.height);
float wvalue = [[UIScreen mainScreen] bounds].size.width;
float hvalue = [[UIScreen mainScreen] bounds].size.height;
NSLog(@" wvalue %f",wvalue);
NSLog(@"hvalue %f",hvalue);
CGFloat width1 = [UIScreen mainScreen].bounds.size.width;
CGFloat height1 = [UIScreen mainScreen].bounds.size.height;
NSLog(@"width1 %f",width1);
NSLog(@"height1 %f",height1);
CGFloat screenScale = [[UIScreen mainScreen] scale];
CGRect screenBounds1 = [[UIScreen mainScreen] bounds];
CGSize screenSize = CGSizeMake(screenBounds1.size.width * screenScale, screenBounds1.size.height * screenScale); if (screenSize.height==1136.000000)
NSLog(@"abcd1 %f",screenBounds1.size.width);
NSLog(@"abcd2 %f",screenBounds1.size.height);
NSLog(@"efgh1 %f",screenSize.width);
NSLog(@"efgh2 %f",screenSize.height);