Skip to content

Instantly share code, notes, and snippets.

@boucher
Created December 17, 2008 04:29
Show Gist options
  • Select an option

  • Save boucher/36938 to your computer and use it in GitHub Desktop.

Select an option

Save boucher/36938 to your computer and use it in GitHub Desktop.
// Add a text field to the cell
cell = [tableView dequeueReusableCellWithIdentifier:@"usernameCell"];
if (!cell)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"usernameCell"] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.text = @"username";
cell.font = [UIFont boldSystemFontOfSize:16.0];
UITextField *inputField = [[UITextField alloc] initWithFrame:CGRectMake(0, 10.0f, 180.0f, 25.0f)];
inputField.borderStyle = UITextBorderStyleNone;
cell.accessoryView = inputField;
[inputField release];
inputField.autoresizingMask = UIViewAutoresizingFlexibleWidth;
cell.autoresizingMask = UIViewAutoresizingFlexibleWidth;
}
usernameField = cell.accessoryView;
usernameField.placeholder = @"your username";
usernameField.delegate = self;
usernameField.text = [defaults stringForKey:usernameKey];
return cell;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment