AlphabetTable 0.0.2

AlphabetTable 0.0.2

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



  • By
  • Bryce Redd

Alphabet Table

Alphabet table will automatically sort your data objects by letter.

Alphabet Table

To use

Implement the protocol on your data objects:

@protocol ITVAlphabetObject <NSObject>
- (NSString*) title;
@end

Add the data objects to your ITVAlphabetTable instance:

// ITVAlphabetTable* table = [[ITVAlphabetTable...
// NSArray* data = [NSArray arrayWithObject:data... all data objects conform to ITVAlphabetObject protocol

[table addObjectsFromArray:data];
[table reloadData];

Override your cells to make more interesting cells:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  static NSString *cellIdentifier = @"VanillaCell";

  NSObject<ITVAlphabetObject>* object = [self objectForIndexPath:indexPath];

  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

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

  [cell.textLabel setText:object.title];

  return cell;
}