I have read the related answers but nothing is being worked. When table load for the first time, everything is ok but after I scroll the table everything's changed. If anyone can help please? here is my code.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [[arrReportList objectAtIndex:section]count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
SummaryReportTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"summaryCell"];
if (cell == nil) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"SummaryReportTableViewCell" owner:self options:nil] objectAtIndex:0];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell setCellLayoutWithArray:[[arrReportList objectAtIndex:indexPath.section]objectAtIndex:indexPath.row]];
...
...
}
SummaryReportTableViewCell.m
-(void)setCellLayoutWithArray :(NSMutableArray *)array {
[btnViewPieChart setImage:[CommonMethod createIconWithIconName:@"fa-pie-chart" ForegroundColor:kColorEnableIcon BGColor:[UIColor clearColor] size:CGSizeMake(25, 25)] forState:UIControlStateNormal];
btnDomain.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
btnDomain.titleLabel.textAlignment = NSTextAlignmentLeft;
btnDomain.contentEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
[btnDomain setTitle:[array valueForKey:@"DomainName"] forState:UIControlStateNormal];
[btnGoal setTitle:[array valueForKey:@"Goals"] forState:UIControlStateNormal];
[self UIButton:btnGoal withValue:btnGoal.titleLabel.text];
}
-(void)UIButton :(UIButton *)btn withValue:(NSString *)value {
if ([btn.titleLabel.text integerValue] > 0) {
[btn setBackgroundColor:kColorTabMenuBG];
btn.titleLabel.font = kFontBold(16);
btn.titleLabel.textColor = kColorTabDeActiveMenu;
btn.userInteractionEnabled = true;
} else {
[btn setBackgroundColor:[UIColor whiteColor]];
btn.titleLabel.font = kFontNormal(16);
btn.titleLabel.textColor = [UIColor blackColor];
btn.userInteractionEnabled = false;
}
}
Image for the first time
Same data after I scroll the table down and up again