2012-03-14 4 views

答えて

1

にアクセスすることができ、アドレス帳の枠組みを含め、私を助けてテーブルビュー。このコードでは、Firstnameはテーブルビューを満たします。

- (void)viewDidLoad 
    { 
     [super viewDidLoad]; 
     addressBook = ABAddressBookCreate(); 
     allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook); 
    ... 
    } 

    @implementation ContactsViewController 

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
        { 
         NSInteger size = CFArrayGetCount(allPeople); 
         return size; 
        } 

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
     static NSString *CellIdentifier = @"Cell"; 
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil){ 
     cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
    } 

    ABRecordRef person = CFArrayGetValueAtIndex(allPeople, indexPath.row); 

    NSString *cellValue = (__bridge NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty); 

    cell.textLabel.text = cellValue; 

    return cell; 
    } 
1

は、私はあなたがABAddressBookCopyArrayOfAllPeople機能の助けを借りて、あなたのデータソースとして、この配列を使用するよりも、配列にローカルアドレス帳からレコードを取得すべきだと思う。そこからuは、ローカルの連絡先に

+0

私はコードで私を助けることができますか? –

+0

申し訳ありません私はしばらく離れていました.U rはまだ立ち往生していますか、または助けが必要ですか? – Allamaprabhu

+0

私は助けが必要ですMr.prabhuu。 plzは、フルを必要とする –

関連する問題