0

i'm using uitextview for searching the contact details from address book. i.e., like uisearchbar search the contact details while text edit change in uitextview.

this is the image

i'm using uitextview if i tap 'a', the list of the contacts from address book will be display in table view

please give me the solution

Sri
  • 454
  • 6
  • 22
  • 1
    You will probably get more answers if you show the code that you have written, and give details about what is/is not working. – Greg Mar 14 '11 at 16:44
  • @GregInYEG: here i added the image please verify that – Sri Mar 14 '11 at 17:07
  • First, clicking on an iPhone (or any device that has no mouse) is impossible. Secondly, use ⇧⌘4 followed by pressing the Space bar when making a screenshot on your Mac. Thirdly, [Three20](https://github.com/facebook/three20) has a message composer class. You can look in its source code. –  Mar 14 '11 at 17:08

1 Answers1

0

Finally I got the solution simple coding here it is

//viewDidLoad

  NSMutableArray *personArray = [[NSMutableArray alloc] init];
  ABRecordRef personRef;
  for (int i = 0; i < CFArrayGetCount(allPeople); i++)
  {
    personRef = (ABRecordID*)CFArrayGetValueAtIndex(allPeople, i);
    ABRecordRef person = ABAddressBookGetPersonWithRecordID(addressBook, ABRecordGetRecordID(personRef));
    @try 
    {
        if (ABRecordCopyValue(person, kABPersonBirthdayProperty))
            [personArray addObject: (id)personRef];
    }
    @catch (NSException * e) 
    {
    }
    @finally 
    {
    }
  NSString *FirstName = [[[NSString stringWithString:(NSString *)ABRecordCopyValue(personRef, kABPersonFirstNameProperty)]stringByAppendingString:@" "]stringByAppendingString:(NSString *)ABRecordCopyValue(personRef, kABPersonLastNameProperty)];
    [arr addObject:FirstName];
}
[arr3 addObjectsFromArray:arr];
  }

//textviewdidchange

  [arr3 removeAllObjects];
   NSInteger counter = 0;
  for(NSString *name in arr)
  {
    NSRange r = [name rangeOfString:txtView.text options:NSCaseInsensitiveSearch];  
    if(r.location != NSNotFound)
    {
         [arr3 addObject:name];
    }
    counter++;
}
[table reloadData];

Thanks for your help

Sri
  • 454
  • 6
  • 22