如何将联系人列表从iphone地址簿导入我的应用程序?

Fur*_*rqi 5 iphone contact-list

- (void)viewDidLoad {
    [super viewDidLoad];

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.

    UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"2.png"] style:UIBarButtonItemStyleBordered target:self action:nil];
    self.navigationItem.rightBarButtonItem = btn;

    self.navigationItem.title = @"Contacts";

    sBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0,0,320,30)];
    sBar.delegate = self;

    [self.view addSubview:sBar];
    sBar.placeholder=@"Search";


    searchedData = [[NSMutableArray alloc]init];

    tableData = [[NSMutableArray alloc]init];

    [tableData addObjectsFromArray:dataSource]; 
}
Run Code Online (Sandbox Code Playgroud)

cod*_*nja 0

您将需要实现以下表委托方法才能真正让表显示数据。

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

您可以在这里找到更多文档UITableView