2011-06-28 12 views
5
- (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]; 
    [email protected]"Search"; 


    searchedData = [[NSMutableArray alloc]init]; 

    tableData = [[NSMutableArray alloc]init]; 

    [tableData addObjectsFromArray:dataSource]; 
} 
+0

Próbowałem edytować pytanie :-P. To było nieczytelne. Prawdopodobnie powinieneś dodać więcej szczegółów na temat tego, co chcesz tutaj. –

+0

Podobnie jak w mojej aplikacji, muszę pokazać całą listę kontaktów, ale powinna ona być wyświetlana na moim widoku. – Furqi

Odpowiedz

0

Będziesz musiał zaimplementować poniższą metodę delegata tabeli, aby rzeczywiście uzyskać tabelę do wyświetlania danych.

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

Można znaleźć więcej dokumentacji na UITableViewhere

0

ABPerson funkcja [ABAddressBookCopyArrayOfAllPeople] zadziała tutaj.

ABAddressBookRef addressBook = ABAddressBookCreate(); 
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook); 
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook); 

for (int i = 0; i < nPeople; i++) 
{ 
    ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i); 
    ... 
} 

Po pobraniu tablicy np. Możesz wyświetlić ją w swoim tableView lub zrobić to, co chcesz zaimplementować.

Powiązane problemy