This here is the last update. It is crashing when setting texts in indexpath.section ==0 and ==1 and ==2 with the error
[Home objectAtIndex:]: unrecognized selector sent to instance 0x109624f20 2014-07-30 12:03:24.732 TYM-APP[1704:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Home objectAtIndex:]: unrecognized selector sent to instance 0x109624f20'
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"wsolna hon");
static NSString *cellIdentifier = @"HomeTableViewCell";
HomeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
// Configure the cell...
int row= [indexPath row];
if (indexPath.section == 0){
homeObject = [homeArray[0] objectAtIndex:indexPath.row];
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[homeObject.News dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
cell.NewsDateLabel.text= homeObject.News_Date;
cell.NewsLabel.attributedText= attrStr;
NSLog(@"news: %@", attrStr);
}
if (indexPath.section == 1){
homeObject = [homeArray[1] objectAtIndex:indexPath.row];
NSLog(@"value of indexpath for library: %d",row);
NSLog(@"library: %@",homeObject.News);
cell.NewsLabel.text= homeObject.Library_text;
cell.TestimonialNameLabel.text= @"";
}
if (indexPath.section == 2){
homeObject = [homeArray[2] objectAtIndex:indexPath.row];
NSLog(@"news: %@",homeObject.Testimonial_Description);
cell.NewsLabel.text= homeObject.Library_text;
cell.TestimonialNameLabel.text = homeObject.Testimonial_Name;
}
return cell;
}