这是可能的,但它有点像黑客。首先,FBFriendPickerViewController
使用 aUIToolbar
而不是 a UINavigationBar
。
您必须呈现FBFriendPickerViewController
,然后浏览其视图的子视图以找到UIToolbar
显示在顶部的那个。一旦你找到了,UIToolbar
你可以随意修改它。
因此,在要显示好友选择器的视图控制器的代码中,您可以这样做:
FBFriendPickerViewController *fbFriendPickerController = [[FBFriendPickerViewController alloc] init];
[fbFriendPickerController loadData];
[self presentViewController:fbFriendPickerController animated:NO completion:nil];
//Search through subviews of friendPicker until we find the UIToolbar
//NOTE: you have to do this after calling [self presentViewController...], otherwise
//the UIToolbar won't be in the array of subviews
NSArray *subs = [fbFriendPickerController.view subviews];
for (UIView *child in subs) {
if ([child isKindOfClass:[UIToolbar class]]) {
UIToolbar *bar = (UIToolbar *)child;
[bar setBackgroundImage:[UIImage imageNamed:@"YOUR_IMAGE.png"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
}
}