views:

47

answers:

2

Hi, I want to use a TableView for representing a Username/Password textfields dialog in a nice and grouped view. I figured the best case is to use the TableView and two cells for this.

I kind of got lost in the implementation... Is there any built in cells for this that I am missing?

A: 

Check out three20, it might have exactly what you are looking for.

Claus Broch
Hi, I've checked three20 but it seems to be a bit too complicated to implement it (at least as I see in the site)
Chen Harel
A: 

What you probably want to do is make a custom UITableViewCell subclass with properties for the textfield(s) you need. Create the nib file for your new cell type, lay it out as desired. Set the "file's owner" class to your UITableViewController class, and create a connection from an outlet (say, "newCell") in the "file's owner" to your custom cell.

Then when you need to create a cell (inside tableView: cellForRowAtIndexPath:), you can load it from the nib:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  // Reuse or create cell
  MyCell *cell = (MyCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
    // load from nib, reference into self.newCell
    [[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:self options:nil];
    cell = self.newCell;
    self.newCell = nil;    // don't need to hang on to the memory
  }
  return cell;
}
David Gelhar