Created
December 27, 2010 20:16
-
-
Save brianpartridge/756502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
NSString *CellIdentifier = @"Cell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) { | |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; | |
} | |
// Set the font and text based on the index path | |
NSString *fontName = @""; | |
switch (indexPath.row) { | |
case HELVETICA: | |
fontName = @"Helvetica"; | |
break; | |
case VERDANA: | |
fontName = @"Verdana"; | |
break; | |
} | |
cell.textLabel.text = fontName; | |
cell.textLabel.font = [UIFont fontWithName:fontName size:cell.textLabel.font.pointSize]; | |
// This bit just determines the user-selected font and adds the checkmark | |
NSString *selectedFont = [DEFAULTS stringForKey:kFont]; | |
cell.accessoryType = UITableViewCellAccessoryNone; | |
if ([selectedFont compare:cell.textLabel.text] == NSOrderedSame) { | |
cell.accessoryType = UITableViewCellAccessoryCheckmark; | |
} | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment