gpt4 book ai didi

iphone - 如何更改 ABPeoplePickerNavigationController 的 UINavigationBar 的颜色?

转载 作者:可可西里 更新时间:2023-11-01 03:42:20 24 4
gpt4 key购买 nike

我正在使用 ABAddressBookRef 获取电话簿中的人员信息。它工作正常,但我想更改 ABPeoplePickerNavigationControllerUINavigationBar 的颜色。

这可能吗?如果可能,请告诉我怎么做。

最佳答案

设置色调颜色,像这样....

ABPeoplePickerNavigationController *objPeoplePicker = [[ABPeoplePickerNavigationController alloc] init];
[objPeoplePicker setPeoplePickerDelegate:self];
objPeoplePicker.topViewController.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.294 green:0.278 blue:0.247 alpha:1.0];
[self presentModalViewController:objPeoplePicker animated:YES];

更改 UISearchBar 颜色

if( picker.searchDisplayController == nil ) 
NSLog(@"searchDisplayController is nil");
if( picker.topViewController.searchDisplayController == nil )
NSLog(@"topViewController.searchDisplayController is nil");


static BOOL foundSearchBar = NO;
- (void)findSearchBar:(UIView*)parent mark:(NSString*)mark {

for( UIView* v in [parent subviews] ) {

if( foundSearchBar ) return;

NSLog(@"%@%@",mark,NSStringFromClass([v class]));

if( [v isKindOfClass:[UISearchBar class]] ) {
[(UISearchBar*)v setTintColor:[UIColor blackColor]];
foundSearchBar = YES;
break;
}
[self findSearchBar:v mark:[mark stringByAppendingString:@"> "]];
}
}

- (void)pickPerson:(BOOL)animated {
foundSearchBar = NO;
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
[[picker navigationBar] setTintColor:[UIColor blackColor]];

picker.peoplePickerDelegate = self;
picker.displayedProperties = [NSArray arrayWithObjects:
[NSNumber numberWithInt:kABPersonEmailProperty],
nil];

[self presentModalViewController:picker animated:animated];
[picker release];

[self findSearchBar:[picker view] mark:@"> "];
}

关于iphone - 如何更改 ABPeoplePickerNavigationController 的 UINavigationBar 的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12794241/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com