页面常见问题

一、页面跳转时停顿问题

在跳转后的页面添加背景色:[self.view setBackgroundColor:[UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1]];

二、页面布局被标题栏覆盖问题

- (id)init {

    self = [super init];

    if (self) {

        if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {

            [self setEdgesForExtendedLayout:UIRectEdgeNone];

        }

        

        if ([self respondsToSelector:@selector(setExtendedLayoutIncludesOpaqueBars:)]) {

            [self setExtendedLayoutIncludesOpaqueBars:NO];

        }

        

        if ([self respondsToSelector:@selector(setModalPresentationCapturesStatusBarAppearance:)]) {

            [self setModalPresentationCapturesStatusBarAppearance:NO];

        }

        

        [self.view setBackgroundColor:RGBCOLOR(255, 255, 255)];

    }

    return self;

}



三、页面跳转

1、利用UINavigationController进行跳转

进入:[self.navigationController pushViewController myVC animated:ture;

返回:[self.navigationController popViewControllerAnimated:YES];

2、利用UIViewController自身的presentModalViewController进行跳转

进入:[self presentModalViewController myVC animated:YES];

返回:[self dismissModalViewControllerAnimated:YES];

四、appDelegate加载页面

self.window =[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];


ViewController *viewController = [[ViewController alloc] init];

navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];

self.window.rootViewController = navigationController;

self.window.backgroundColor = [UIColor whiteColor];

[self.window makeKeyAndVisible];





你可能感兴趣的:(页面常见问题)