如何在每次打开时让ABPeoplePicker从顶部开始?

时间:2012-02-01 16:15:20

标签: iphone ios uitableview uiscrollview abpeoplepickerview

首次加载ABPeoplePicker时,它会从地址簿的顶部开始,搜索栏显示在顶部。但是,一旦用户与之交互,它就会加载到上次滚动到的位置。是否有命令或属性使其始终加载,以便顶部的搜索栏显示?

1 个答案:

答案 0 :(得分:0)

找到了答案!

// Show the people picker
[self presentModalViewController:self.picker animated:YES];

// Force display the search bar and make the keyboard pop up
[self.picker.topViewController.searchDisplayController setActive:YES];
[self.picker.topViewController.searchDisplayController.searchBar becomeFirstResponder];