I am new in iOS and I am facing problem regarding to scroll table view.When I scroll table view selected cell get disselect As shown in the image I select P on the first cell.
But when I scroll the table it get removed. I am using button and image to select one button at I time.I am using custom table view cel. My code is like this
In Custom Table View cell
-(IBAction)passbtnClick:(id)sender
{
Passimage.image =[UIImage imageNamed:@"Pass.png"];
Failimage.image=[UIImage imageNamed:@"FailGray.png"];
WIPimage.image =[UIImage imageNamed:@"WIPGray.png"];
NotApplicableimage.image=[UIImage imageNamed:@"NAGray.png"];
}
-(IBAction)failbtnClick:(id)sender
{
Passimage.image =[UIImage imageNamed:@"PassGray.png"];
Failimage.image=[UIImage imageNamed:@"Fail.png"];
WIPimage.image =[UIImage imageNamed:@"WIPGray.png"];
NotApplicableimage.image=[UIImage imageNamed:@"NAGray.png"];
}
-(IBAction)wipbtnClick:(id)sender
{
Passimage.image =[UIImage imageNamed:@"PassGray.png"];
Failimage.image=[UIImage imageNamed:@"FailGray.png"];
WIPimage.image =[UIImage imageNamed:@"WIP.png"];
NotApplicableimage.image=[UIImage imageNamed:@"NAGray.png"];
}
-(IBAction)nabtnClick:(id)sender
{
Passimage.image =[UIImage imageNamed:@"PassGray.png"];
Failimage.image=[UIImage imageNamed:@"FailGray.png"];
WIPimage.image =[UIImage imageNamed:@"WIPGray.png"];
NotApplicableimage.image=[UIImage imageNamed:@"NA.png"];
}
In viewcontroller.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *STI=@"STI";
AuditTableViewCell *cell = (AuditTableViewCell *)[tableView dequeueReusableHeaderFooterViewWithIdentifier:STI];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"AuditTableViewCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.accessoryType=UITableViewCellAccessoryNone;
}
cell.audittitlelbl.text=[NSString stringWithFormat:@"%@",[idarray objectAtIndex:indexPath.row]];
cell.auditdesclbl.text=[NSString stringWithFormat:@"%@",[namearray objectAtIndex:indexPath.row]];
return cell;
}
My question is how to set it value even I scroll tableview.Thanks in Advance!