I have implemented below code but app has been crashed in iPad with iOS version 6.1.3,while running perfectly in iPad with iOS version 5.1.1. when I am scrolling table view continuously it is crashed in ios version 6.1.3. what could be the issue. The implemented delegate and data source methods for the table view are as given below.
#pragma mark - Table view data source
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [UserList count];
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 70;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell = nil;
if (cell == nil)
{
// cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
UIImageView *imgViweback;
imgViweback = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,0,0)];
imgViweback.image = [UIImage imageNamed:@"1scr-Student List Tab BG.png"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 10, 32, 32)];
UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(12, 5, 50, 50)];
UILabel *lblName = [[UILabel alloc] initWithFrame:CGRectMake(110, 5, 200, 40)];
//cell.backgroundColor = [UIColor clearColor]; //cell.alpha = 0.5f;
CountSelected = 0;
flagQuizEnabled = NO;
if ([[[checkedImages objectAtIndex:indexPath.row]
valueForKey:@"checked"] isEqualToString:@"NO"])
{
// cell.imageView.image = [UIImage imageNamed:@"Unchecked.png"];
//imageView.image = [UIImage imageNamed:@"Unchecked.png"];
} else
{
//imageView.image = [UIImage imageNamed:@"Checked.png"];
}
NSString *pathTillApp=[[self getImagePath] stringByDeletingLastPathComponent];
NSLog(@"Path Till App %@",pathTillApp);
NSString *makePath=[NSString stringWithFormat:@"%@%@",pathTillApp,[[UserList
objectAtIndex:indexPath.row ]valueForKey:@"ImagePath"]];
NSLog(@"makepath=%@",makePath);
imageView1.image = [UIImage imageWithContentsOfFile:makePath];
[cell.contentView insertSubview:imgViweback atIndex:0];
[cell.contentView insertSubview:imageView atIndex:0];
[cell.contentView insertSubview:imageView1 atIndex:2];
lblName.text =[NSString stringWithFormat:@"%@ %@",[[UserList
objectAtIndex:indexPath.row] valueForKey:@"FirstName"],[[UserList
objectAtIndex:indexPath.row] valueForKey:@"LastName"]];
lblName.backgroundColor = [UIColor clearColor];
lblName.font = [UIFont boldSystemFontOfSize:22.0f];
//lblName.font = [UIFont fontWithName:@"HelveticaNeue Heavy"
size:22.0f];
lblName.font = [UIFont fontWithName:@"Chalkboard SE" size:22.0f];
[cell.contentView insertSubview:lblName atIndex:3];
[imgViweback release];
[imageView release];
[imageView1 release];
[lblName release];
imgViweback = nil;
imageView = nil;
imageView1 = nil;
lblName = nil;
//cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
return cell;
}
#pragma mark - Table view delegate
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Values : %@", Val);
}