Skip to content

Instantly share code, notes, and snippets.

@jacobch
Created August 19, 2010 05:09
Show Gist options
  • Save jacobch/537101 to your computer and use it in GitHub Desktop.
Save jacobch/537101 to your computer and use it in GitHub Desktop.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
UILabel *label;
UITextField *textField;
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
label = [[UILabel alloc] initWithFrame:CGRectMake(10, 12, 90, 25)];
label.font = [UIFont boldSystemFontOfSize: 16];
label.tag = 1;
[cell.contentView addSubview:label];
textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 12, 200, 25)];
textField.tag = 2;
textField.delegate = self;
[cell.contentView addSubview:textField];
}
else {
label = (UILabel *)[cell.contentView viewWithTag:1];
textField = (UITextField *)[cell.contentView viewWithTag:2];
}
switch (indexPath.row) {
case 0:
label.text = @"Domain";
// [textField becomeFirstResponder];
break;
case 1:
label.text = @"Email";
break;
case 2:
label.text = @"Password";
textField.secureTextEntry = YES;
break;
}
[label release];
[textField release];
return cell;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment