有没有办法在iOS SDK 3.0b中自定义FBFriendPickerViewController?

时间:2012-07-20 04:24:13

标签: ios facebook-ios-sdk

例如,如果我想在FBFriendPickerViewController的tableview上添加搜索栏,我应该在编程代码中添加什么?

self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0,self.friendPickerController.tableView.frame.size.width, 0)];
self.friendPickerController.tableView.tableHeaderView = self.searchBar;
[self.searchBar sizeToFit];

这种尝试并不成功。 FBFriendPickerViewController是一种方便的方式,但.... 在没有搜索条件的情况下以有效的方式找到朋友是不可能的.....

1 个答案:

答案 0 :(得分:2)

来自Facebook开发人员文档here

  

自定义好友拣货员

     

默认的朋友选择器以下列方式显示:

     
      
  • 显示完成按钮
  •   
  • 可以看到取消按钮
  •   
  • 显示好友资料图片
  •   
  • 朋友按名字排序
  •   
  • 朋友的名字首先显示名字
  •   
     

您可以通过配置来自定义这些默认显示功能   FBFriendPickerViewController的相关属性:

// Initialize the friend picker
FBFriendPickerViewController *friendPickerController = 
    [[FBFriendPickerViewController alloc] init];

// Allow the selection of only one friend
friendPickerController.allowsMultipleSelection = NO;

// Hide the friend profile pictures
friendPickerController.itemPicturesEnabled = NO;

// Configure how friends are sorted in the display.
// Sort friends by their last names.
friendPickerController.sortOrdering = FBFriendSortByLastName;

// Configure how each friend's name is displayed.
// Display the last name first.
friendPickerController.displayOrdering = FBFriendDisplayByLastName;

// Hide the done button
friendPickerController.doneButton = nil;
...

// Hide the cancel button
friendPickerController.cancelButton = nil;
     

您还可以显示该朋友的朋友列表   登录:

// Initialize the friend picker
FBFriendPickerViewController *friendPickerController = 
    [[FBFriendPickerViewController alloc] init];
// Get friend's list from one of user's friends.
// Hard-coded for now.
friendPickerController.userID = @"100003086810435";
...
     

注意:朋友的朋友列表可能不会显示给该朋友   已关闭所有Facebook应用程序。

     

如果您需要进一步的自定义,例如更改好友选择器   颜色或添加更多朋友信息到显示器,考虑建立   你自己的选择器。

相关问题