Note that there are some explanatory texts on larger screens.

plurals
  1. POUITextField used for searching UITableView with multiple saved strings
    primarykey
    data
    text
    <p>In my app, there is component for sending one message to multiple users at the same time. </p> <p>I would like to implement it similar to facebook message composing. By using uitextfield with local notifications, I'm able to filter my UITableView like this;</p> <pre><code>self.searchTextFieldObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UITextFieldTextDidChangeNotification object:self.searchTextView queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { if ([self.displayArray count]) { NSArray *tempUsersArray = nil; NSArray *tempNonUsersArray = nil; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"fullName CONTAINS[cd] %@", self.searchTextView.text]; self.displayArray = [MyAddressBook sortedContacts:self.contacts]; if ([self.searchTextView.text length] &gt; 0) { tempUsersArray = [self.displayArray[0] filteredArrayUsingPredicate:predicate]; self.displayArray = @[tempUsersArray]; } } [self.tableView reloadData]; }]; </code></pre> <p>This works as expected... As I'm providing input for textfield, my table gets filtered. What I want to implement is this approach:</p> <p><img src="https://i.stack.imgur.com/4Is6x.png" alt="FBImage"></p> <p>When I select one user by searching the table view, his nickname should be inserted in my textfield and predicate should be reseted to empty string, so I can start filtering again. Back button should select already inserted name and on second backspace tap, it should delete it. </p> <p>I was thinking about this for some time, and all I could come up with, was using multiple element on top of each other. UITextView would change it's frame as users are added up (saved in array, which is source for UILabel's text, that partly replaces frame of textview), but I hitted wall, when I had to have possibility of removing already picked users.</p> <p>If you guys know about another approach, or about any library that could help me, I would be very glad.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload