Note that there are some explanatory texts on larger screens.

plurals
  1. POiphone sdk - weird bug with TableView Cell
    primarykey
    data
    text
    <p>I'm working in cellForRowAtIndexPath, and I'm trying to embed a textview into the cell. Now, the embedding part is all well and fine, but I am getting the strangest problem when I try and load the textview in all but the first row.</p> <p>Note: I want The TextView in all but the first row in my table.</p> <p>The problem is that when I implement an if statement to check for indexpath.row and then scroll down the text view is then NOT visible in some cells. It is somehow related to me having cells with quite large heights >200 and they are initially off screen. When I scroll down it is like the next cell underneath the bottom most visible cell is now responding to a indexpath row of ==0.</p> <p>I am completely baffled, has anyone any ideas?</p> <p>My Code</p> <pre><code>// Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; CGRect frame; frame.origin.x = 5; frame.origin.y = 10; frame.size.width = 20; frame.size.height = 25; // ..some unrelated setup in here //textbox setup textView = [[UITextView alloc] initWithFrame:CGRectMake(30, 80, 500, 150)]; textView.layer.cornerRadius = 10; textView.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.2]; textView.font = [UIFont fontWithName:@"Helvetica" size:17]; textView.text = @"test-content"; textView.layer.borderWidth = 1; textView.layer.borderColor = [[UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.9] CGColor]; textView.tag = 4; if (indexPath.row != 0) { [cell.contentView addSubview:textView]; [textView release]; } } // a little more unrelated stuff return cell; </code></pre> <p>}</p> <p>Can someone see the problem?</p> <p>Thanks</p>
    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.
 

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