I'm using AutoLayout, and for some reason as soon as the Table View loads:
- the first couple table view cells on screen aren't layed out correctly
- but the table view cells off screen when scrolled to are layed out correctly
- but when I scroll back up to the original table view cells that weren't laying out correctly, once they go off screen and then back on screen all of the sudden are layed out correctly
Any help would be appreciated, thanks!
cellForRowAtIndexPath:
if ([model isKindOfClass:[FRSS self]]) {
FRSS *fDan = (FRSS *)model;
// configure cell
MRWebListTableViewCell *api1Cell = [tableView dequeueReusableCellWithIdentifier:@"YourAPI1Cell"];
// RSS
NSString *title = [NSString stringWithFormat:@"%@", fDan.title];
// Get string from XML
NSString *dateString = [self timeSincePublished:fDan.pubDate];
// Get description without tags
NSString *description = [self removeHTMLTags:fDan.description];
NSString *link = [NSString stringWithFormat:@"%@", fDan.link];
api1Cell.labelHeadline.text = title;
api1Cell.labelDescription.text = description;
api1Cell.labelPublished.text = dateString;
// Top Image View
UIImageView *imv = [[UIImageView alloc]initWithFrame:CGRectMake(15, 20, 50, 50)];
imv.image=[UIImage imageNamed:@"e_r.png"];
[api1Cell.contentView addSubview:imv];
return api1Cell;
UPDATE: Had a lot of problems with AutoLayout even after trying a bunch of different things.
This had a lot to do with heightForRowAtIndexPath
. Ended up needing to manually set this by adding the function into ViewController code. Manually set it for any cells that were going to be way larger than a normal estimated cell would be (i.e. if it had any images in it).