UICell problem iPhone while Scrolling tableView
<p>My Current Problem Related links are one of below.
<hr>
http://www.freeimagehosting.net/image.php?a65dae5f4a.png>http://www.freeimagehosting.net/uploads/th.a65dae5f4a.png alt="Free Image Hosting by FreeImageHosting.net"></p>

<p>[url=<a href="http://www.freeimagehosting.net/image.php?a65dae5f4a.png" rel="nofollow">http://www.freeimagehosting.net/image.php?a65dae5f4a.png][img]<a href="http://www.freeimagehosting.net/uploads/th.a65dae5f4a.png" rel="nofollow">http://www.freeimagehosting.net/uploads/th.a65dae5f4a.png[/img][/url]</p>

<p>[url=<a href="http://www.freeimagehosting.net/image.php?a65dae5f4a.png" rel="nofollow">http://www.freeimagehosting.net/image.php?a65dae5f4a.png][img=<a href="http://www.freeimagehosting.net/uploads/th.a65dae5f4a.png" rel="nofollow">http://www.freeimagehosting.net/uploads/th.a65dae5f4a.png</a>][/url]</p>

<p>http://www.freeimagehosting.net/</a>>http://www.freeimagehosting.net/uploads/a65dae5f4a.png</a> border=0 alt="Free Image Hosting"></a></p>

<p>[url=<a href="http://www.freeimagehosting.net/" rel="nofollow">http://www.freeimagehosting.net/</a>][img]<a href="http://www.freeimagehosting.net/uploads/a65dae5f4a.png" rel="nofollow">http://www.freeimagehosting.net/uploads/a65dae5f4a.png</a>[/img][/url]</p>

<p>[url=<a href="http://www.freeimagehosting.net/" rel="nofollow">http://www.freeimagehosting.net/</a>][img=<a href="http://www.freeimagehosting.net/uploads/a65dae5f4a.png" rel="nofollow">http://www.freeimagehosting.net/uploads/a65dae5f4a.png</a>][/url]
<hr></p>

<p>I have implemented following code, to my Table view,</p>

<pre><code>enter code here
</code></pre>

<p>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {</p>

<pre><code>static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

// customizing cell
student *t=[studentsList objectAtIndex:indexPath.row];
cell.backgroundColor=[UIColor lightGrayColor];
CGRect label1Frame=CGRectMake(10, 10, 290, 25);
CGRect label2Frame=CGRectMake(10, 33, 290, 25);
CGRect label3Frame=CGRectMake(10, 56, 290, 25);
UILabel *lbltmp;
lbltmp=[[UILabel alloc] initWithFrame:label1Frame];  // name
lbltmp.font=[UIFont boldSystemFontOfSize:15];
lbltmp.backgroundColor=[UIColor clearColor];
lbltmp.textColor=[UIColor blackColor];
lbltmp.text=t.stuName;
[cell.contentView addSubview:lbltmp];
[lbltmp release];

lbltmp=[[UILabel alloc] initWithFrame:label2Frame]; // roll no &amp; address
lbltmp.font=[UIFont systemFontOfSize:13];
lbltmp.backgroundColor=[UIColor clearColor];
lbltmp.text=[NSString stringWithFormat:@"%i - %@",t.stuNo,t.stuAddress];
lbltmp.textColor=[UIColor grayColor];
[cell.contentView addSubview:lbltmp];
[lbltmp release];

lbltmp=[[UILabel alloc] initWithFrame:label3Frame]; // city &amp; pin
lbltmp.font=[UIFont systemFontOfSize:13];
lbltmp.backgroundColor=[UIColor clearColor];
lbltmp.text=[NSString stringWithFormat:@"%@ - %@",t.stuCity,t.stuPin];
lbltmp.textColor=[UIColor grayColor];
[cell.contentView addSubview:lbltmp];
[lbltmp release];
//----------------------------------
cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;
return cell;
</code></pre>

<p>}</p>

<p>If I implement the code as described above, problem occurs as described in above images.</p>

<p>If I implement following code, no problem occurs.</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] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

// customizing cell
student *t=[studentsList objectAtIndex:indexPath.row];
cell.backgroundColor=[UIColor lightGrayColor];
CGRect label1Frame=CGRectMake(10, 10, 290, 25);
CGRect label2Frame=CGRectMake(10, 33, 290, 25);
CGRect label3Frame=CGRectMake(10, 56, 290, 25);
UILabel *lbltmp;
lbltmp=[[UILabel alloc] initWithFrame:label1Frame];  // name
lbltmp.font=[UIFont boldSystemFontOfSize:15];
lbltmp.backgroundColor=[UIColor clearColor];
lbltmp.textColor=[UIColor blackColor];
lbltmp.text=t.stuName;
[cell.contentView addSubview:lbltmp];
[lbltmp release];

lbltmp=[[UILabel alloc] initWithFrame:label2Frame]; // roll no &amp; address
lbltmp.font=[UIFont systemFontOfSize:13];
lbltmp.backgroundColor=[UIColor clearColor];
lbltmp.text=[NSString stringWithFormat:@"%i - %@",t.stuNo,t.stuAddress];
lbltmp.textColor=[UIColor grayColor];
[cell.contentView addSubview:lbltmp];
[lbltmp release];

lbltmp=[[UILabel alloc] initWithFrame:label3Frame]; // city &amp; pin
lbltmp.font=[UIFont systemFontOfSize:13];
lbltmp.backgroundColor=[UIColor clearColor];
lbltmp.text=[NSString stringWithFormat:@"%@ - %@",t.stuCity,t.stuPin];
lbltmp.textColor=[UIColor grayColor];
[cell.contentView addSubview:lbltmp];
[lbltmp release];
//----------------------------------
cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;
}
return cell;
</code></pre>

<p>}</p>

<p><b>Implementing the above code means, recreating the each table cell while user scrolls the tableView. It may slow down your application &amp; it isn't the correct solution,</p>

<p>Because In my application I have thousands of students &amp; if I create each cell while scroll My Application may hang. What Should be the solution? Help me....</b></p>
