UIView is cropped on the status bar before autorotation

Ive created a multi-user application that uses several controllers to display and manage views. Im's problem is that when the simulator initially loads the view, the title is partially covered by a bar at the top of the screen, and the toolbar at the bottom does not touch the main part of the screen. I used the interface linker size attributes to control the view when the iphone rotates and works fine. Everything fully unfolds in both landscape and portrait modes AFTER a turn, but the problem is related to the initial load before the start of rotation. Your thoughts are greatly appreciated. Tony

+5
source share
4 answers

I had problems with views that were cropped by status, navigation and tabs. I fixed most of them using the Simulated Metrics feature in Interface Builder. Thus, what you post on IB is much more accurate than what you are actually going to get.

+3
source

I struggled with this problem for several days and days - there were no errors in IB's work.

I ended up getting it to work by adding this line:

mainViewController.view.frame = window.screen.applicationFrame;

for the application: doneFinishLaunchingWithOptions: method. (Where mainViewController is the main UIViewController).

+18
source

. , ADBannerView iPhone. : ( ):

// In the function that displays an iAD Banner
CGRect contentFrame = self.view.bounds;
CGRect myStatusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
CGFloat statusHeight = myStatusBarFrame.size.height;

// Set the view origin to be under the status bar.

contentFrame.origin.y = statusHeight;

, .

+1

, "" Apple ( IMHO Apple - , !)

, Apple , "" 20 (, - 20 , Apple , statusBarFrame UIApplication)

Apple - . UINavigationController/UITabBarController - 20 , . , , , 20 , 20 .

, , "" . .

cf this link for a more detailed explanation of what is happening and how to write code the way Apple wants you to:

http://blog.red-glasses.com/index.php/tutorials/iphone-auto-rotation-for-intermediate-developers-tutorial-1/

0
source

All Articles