Perhaps someone can point out what I am doing wrong...
When I execute the above code in my cellForRowAtIndexPath method, the slider is properly displayed in section 2 row 1 but is also showing up in Section 0 row 1. Also the accessoryDisclosure Indicator is showing up in Section 2 row 1, but I did not ask for one there.
Code:
if (indexPath.section == 0) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.text = [travelerInfoLabel objectAtIndex:indexPath.row];
cell.detailTextLabel.text =[travelerInfo objectAtIndex:indexPath.row];
}else if (indexPath.section == 1){
if(indexPath.row != 2) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
cell.textLabel.text =[travelerHomeInfoLabel objectAtIndex:indexPath.row];
cell.detailTextLabel.text =[travelerHomeInfo objectAtIndex:indexPath.row];
}else if (indexPath.section == 2) {
if(indexPath.row == 1) {
UISlider *mySlider = [[UISlider alloc] init];
mySlider.maximumValue = 9;
mySlider.minimumValue = 0;
mySlider.continuous = YES;
mySlider.value = [[travelerSleepCycle objectAtIndex:indexPath.row] floatValue];
cell..accessoryView = mySlider;
[mySlider addTarget:self action:@selector(sleepSliderChanged:) forControlEvents:(UIControlEventValueChanged | UIControlEventTouchDragInside)];
[mySlider release];
cell.detailTextLabel.text =[NSString stringWithFormat:@"%@hrs ", [travelerSleepCycle objectAtIndex:indexPath.row]];
}else {
cell.detailTextLabel.text =[travelerSleepCycle objectAtIndex:indexPath.row];
}
cell.textLabel.text =[travelerSleepCycleLabel objectAtIndex:indexPath.row];
}
When I execute the above code in my cellForRowAtIndexPath method, the slider is properly displayed in section 2 row 1 but is also showing up in Section 0 row 1. Also the accessoryDisclosure Indicator is showing up in Section 2 row 1, but I did not ask for one there.