I have a problem like in this question, but answers don't help me. I want that colors navigation bar in seconds screen will be like a first screen. iOS 9 or later.
- (void) showAdressBookActionForIOSNineOrLater {
CNContactPickerViewController * newPicker = [[CNContactPickerViewController alloc] init];
newPicker.delegate = self;
NSDictionary *attributesNormal = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont appFont_Headline], NSFontAttributeName,
[UIColor appColor_white_0], NSForegroundColorAttributeName, nil];
//appColor_white_0 my custom color APP_RGBA(255.0f, 255.0f, 255.0f, 1.0f); appFont_Headline - [UIFont HelveticaNeueRegularFont:fontSize];
newPicker.navigationController.navigationBar.titleTextAttributes = attributesNormal;
newPicker.navigationController.navigationBar.translucent = NO;
newPicker.navigationController.navigationBar.barStyle = UIBarStyleBlack;
newPicker.navigationController.navigationBar.tintColor = [UIColor appColor_white_0];
[[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UINavigationController class]]] setTintColor:[UIColor appColor_white_0]];
[[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[UINavigationController class]]] setTintColor:[UIColor appColor_white_0]];
[[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[UINavigationController class]]] setBarTintColor:[UIColor appColor_white_0]];
[[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[UINavigationController class]]] setTitleTextAttributes:attributesNormal];
newPicker.predicateForEnablingContact = [NSPredicate predicateWithFormat:@"phoneNumbers.@count > 0"];
newPicker.predicateForSelectionOfContact = [NSPredicate predicateWithFormat:@"phoneNumbers.@count == 1"];
newPicker.predicateForSelectionOfProperty = [NSPredicate predicateWithFormat:@"key == phoneNumber"];
newPicker.displayedPropertyKeys = @[CNContactPhoneNumbersKey];
//
[[self currentNavigationController] presentViewController:newPicker animated:YES completion:nil];
And implement delegate methods:
- (void)contactPicker:(CNContactPickerViewController *)picker didSelectContactProperty:(CNContactProperty *)contactProperty{
CNContact *contact = contactProperty.contact;
NSString *identify = contactProperty.identifier;
NSString * selectedNumber = @"";
for (CNLabeledValue<CNPhoneNumber*>* number in contact.phoneNumbers) {
if ([number.identifier isEqualToString:identify]) {
selectedNumber = ((CNPhoneNumber *)number.value).stringValue;
}
} [self.currentNavigationController.presentedViewController dismissViewControllerAnimated:YES completion:nil];
}
- (void)contactPickerDidCancel:(CNContactPickerViewController *)picker {
[self.currentNavigationController.presentedViewController dismissViewControllerAnimated:YES completion:nil];
}
Screen story: