Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>add any <code>UIViews</code> to <code>cell.contentView</code> and set <code>autoResizeMask</code> property for this view</p> <p>here is the sample of creating <code>cell</code> with <code>UILabel</code> and <code>UITextField</code>: </p> <pre><code>// custom cell implementation - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if ( (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) ) { self.label = [[[UILabel alloc] init] autorelease]; self.label.font = [UIFont fontWithName:@"Helvetica-Bold" size:17]; self.label.backgroundColor = [UIColor clearColor]; [self.contentView addSubview:self.label]; self.textField = [[[UITextField alloc] init] autorelease]; //this will make our textField resized properly self.textField.autoresizingMask = UIViewAutoresizingFlexibleWidth; self.textField.borderStyle = UITextBorderStyleNone; self.textField.backgroundColor = [UIColor clearColor]; self.textField.textColor = [UIColor darkGrayColor]; //text color self.textField.font = [UIFont systemFontOfSize:17.0]; //font size self.textField.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support self.textField.keyboardType = UIKeyboardTypeDefault; // type of the keyboard self.textField.returnKeyType = UIReturnKeyNext; // type of the return key self.textField.clearButtonMode = UITextFieldViewModeWhileEditing; // has a clear 'x' button to the right [self.contentView addSubview:self.textField]; self.selectionStyle = UITableViewCellSelectionStyleNone; self.accessoryType = UITableViewCellAccessoryNone; } return self; } </code></pre> <p>and in dataSource method</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath </code></pre> <p>something like that</p> <pre><code> CustomCell* c = (CustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1]; if (c == nil) { c = [[[CellWithPass alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier1] autorelease]; c.textField.delegate = self; } //in this method cell and cell subviews are not resized, so //we are setting subviews frames here for cell with frame {{0,0},{320,44}} c.label.text = @"label"; float w = [c.label.text sizeWithFont:c.label.font].width; c.label.frame = CGRectMake(10, 0, w, 44); c.textField.frame = CGRectMake(w + 10, 12, c.contentView.frame.size.width - w - 20, 20); return c; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload