我用了ABAddressBookRef获取信息,用的还不错,不过我想改变
ABPeoplePickerNavigationController的UINavigationBar的颜色。能实现吗?怎么实现?
先设置颜色:
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:@"> "];
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。