I am new to iPhone programming and I was unable to change background of my Table view cell
- (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];
if((indexPath.row%2)!=0)
{
[cell setBackgroundColor:[UIColor clearColor]];
[cell setBackgroundColor:[UIColor redColor]];
//[cell ];
}
else
{
[cell setBackgroundColor:[UIColor whiteColor]];
}
}
// Configure the cell...
[cell setText:[menuItems objectAtIndex:indexPath.row]];
return cell;
}
Please help me to understand the reason why??
Thanx in advance
Ok got the answer