Dav*_*988 8 objective-c ios ios11
我继承了一个遗留应用程序,并负责为iOS 11更新它.在一个视图中,用户可以单击一个名称并将该用户添加到他们的联系人.但是,当转到iOS 11中的"添加联系人"视图时,导航和状态栏显示为白色.它在iOS 10及更低版本上运行良好.
这是一个比较iOS 10(左)和iOS 11(右)的屏幕截图:
ABRecordRef person = ABPersonCreate();
//...
ABNewPersonViewController *newPersonViewController = [[ABNewPersonViewController alloc] init];
[newPersonViewController setDisplayedPerson:person];
newPersonViewController.newPersonViewDelegate = self;
UINavigationController *newNavigationController = [[UINavigationController alloc] initWithRootViewController:newPersonViewController];
[self presentViewController:newNavigationController animated:YES completion:nil];
CFRelease(person);
Run Code Online (Sandbox Code Playgroud)
我根据在网上发现的内容尝试了一些不同的东西:
任何意见将是有益的.
编辑:导航栏颜色在didFinishLaunchingWithOptions方法的AppDelegate中设置,如下所示.我尝试删除在此处设置的所有自定义逻辑.这有点修复了导航栏,但状态栏仍然是白色的白色文本.
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
if ([MPUtils isIOS7OrHigher]) {
[[UIToolbar appearance] setBarTintColor:[MPColors colorWithColorString:MPColorString0A3B77]];
[[UINavigationBar appearance] setBarTintColor:[MPColors colorWithColorString:MPColorString0A3B77]];
//color of text on buttons:
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes:@{UITextAttributeTextColor : [UIColor whiteColor]}];
} else {
[[UIToolbar appearance] setTintColor:[MPColors colorWithColorString:MPColorString0A3B77]];
[[UINavigationBar appearance] setTintColor:[MPColors colorWithColorString:MPColorString0A3B77]];
}
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[MPUserDataSynchronizer syncUserData];
return YES;
}
Run Code Online (Sandbox Code Playgroud)