Currently i am working in iPhone application, using tableview to develop the tables and its style like grouped, No.of section like 2, then the 1st section has separator color like lightgray color and the 2nd section has separator color like clearColor. but when i scrolled the table view, sometimes 2nd section active at the time 1st section also clear a separator color, How to fix this? Please any one help me
Thanks in Advance
-(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.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.section == 0 && indexPath.row == 0)
{
studentUpdateTable.separatorColor = [UIColor lightGrayColor];
cell.backgroundColor = [UIColor whiteColor];
}
else if(indexPath.section == 1 && indexPath.row == 0)
{
studentUpdateTable.separatorColor = [UIColor clearColor];
cell.backgroundColor = [UIColor clearColor];
}
}
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
you can just set to to None instead of trying to set it to clearColor
This did works
cell.backgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
Added a custom UIView (newly allocated UIView) as the cell's background view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With