Note that there are some explanatory texts on larger screens.

plurals
  1. POuitableview loading the cells with previous cells' content
    primarykey
    data
    text
    <p>in my table view the cell size fits to the whole screen size. so it creating only two cells but from the 3rd cell its using old cell's content...so i am getting the incorrect data..</p> <p>how to resolve this...?</p> <p>thanks.</p> <pre><code> - (UITableViewCell *)tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil) cell = [[[UITableViewCell alloc] initWithFrame:CellFrame reuseIdentifier:CellIdentifier] autorelease]; for(UIView *v in [cell.contentView subviews]) [v removeFromSuperview]; curCellNo = indexPath.row; if(curCellNo == 0){ min = 0; max = 8; x=0; y=yForFirst; col = 1; }else{ if(curCellNo &lt; prevCellNo){ min = min-12; max = max-12; }else{ min = max; max = min+12; } x=0; y=0; } prevCellNo = curCellNo; NSLog(@"Max...%d",max); NSLog(@"Min...%d",min); NSLog(@"songsCount...%d",[songs count]); for(int i=min; i&lt;max &amp;&amp; i&lt;[songs count]; i++){ Song *thesong = [self.songs objectAtIndex:i]; CGRect frame; frame.size.width=coverWidth; frame.size.height=coverHeight; frame.origin.x=x; frame.origin.y=y; LazyImageView* asyncImage = [[[LazyImageView alloc] initWithFrame:frame]autorelease]; NSURL* url = [NSURL URLWithString:thesong.cover]; [asyncImage loadImageFromURL:url]; UILabel *label = [[[UILabel alloc]initWithFrame:CGRectMake(x, y+artistLabelYPos, artistLabelWidth, artistLabelHeight)]autorelease]; label.text = [thesong.title stringByAppendingString:[@"\nby " stringByAppendingString:thesong.artist]]; [label setTextAlignment:UITextAlignmentLeft]; label.numberOfLines = 0; label.font = [UIFont systemFontOfSize:artistLabelFontSize]; label.textColor = [UIColor whiteColor]; label.backgroundColor = [UIColor darkTextColor]; label.alpha = 0.75; UIButton *playBtn = [UIButton buttonWithType:UIButtonTypeCustom]; playBtn.frame = CGRectMake(x+playBtnXPos, y+playBtnYPos, playBtnWidth, playBtnHeight); [playBtn addTarget:self action:@selector(playBtnClicked:) forControlEvents:UIControlEventTouchUpInside]; if(playingButton &amp;&amp; streamer){ if(playingButtonTag == i &amp;&amp; [streamer isPlaying]){ [playBtn setBackgroundImage:[UIImage imageNamed:pauseBtnimgName] forState:UIControlStateNormal]; playingButton = playBtn; }else [playBtn setBackgroundImage:[UIImage imageNamed:playBtnimgName] forState:UIControlStateNormal]; }else [playBtn setBackgroundImage:[UIImage imageNamed:playBtnimgName] forState:UIControlStateNormal]; playBtn.tag = i; [cell.contentView addSubview:asyncImage]; [cell.contentView addSubview:label]; [cell.contentView addSubview:playBtn]; label = nil; asyncImage = nil; if(curCellNo == 0){ y += estCoverHeight; if(y&gt;=(estCoverHeight*noOfRowsInCell)){ col++; x += estCoverWidth; if(col&gt;=3) y=0; else y=yForFirst; } }else{ col =3; y += estCoverHeight; if(y&gt;=(estCoverHeight*noOfRowsInCell)){ x += estCoverWidth; y=0; } } } cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.contentView.transform = CGAffineTransformMakeRotation(M_PI/2); return cell; } </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.
 

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