UIImageView inside tableview changing frame position while scrolling

I'm doing a instagram like have a table view whose cells contains an UIImageView. When it appears the first time the image views are positioned correctly, but after scrolling to next cells the image view's frame Y origin is moved from 0 to 15 pixels. I already tried to force the frame to the correct position without success. here's my cellForRowAtIndexPath: code.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

    MITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kMITableViewCellID];
    MIPhoto *photo = [self.fetchedResultController objectAtIndexPath:indexPath];

    if (!photo.imageData) {
        if (self.tableView.dragging == NO && self.tableView.decelerating == NO) {
            [self startDownloadImage:photo forIndexPath:indexPath];
        cell.imageView.image = [UIImage imageNamed:@"ImageViewBackGround.png"];
    } else {

        cell.imageView.image = [UIImage imageWithData:photo.imageData];

    return cell;

And here are the screeshots with correct and incorrect cell layouts

Correct layout screen: https://www.dropbox.com/s/t3r7w2wp6k8kot4/Photo%2008-12-13%2022%2046%2055.png

wrong layout screen: https://www.dropbox.com/s/na7cb4a8shwc6mf/Photo%2008-12-13%2022%2047%2008.png


Solved the issue setting the cell's contentView frame programmatically to desired values.

EDIT: I tried to figure out why the cell's content view was having it's frame changed, and I found what appears to be a bug at layoutSubViews method because the bug happens when this method is called by my custom UITableViewCell subclass.

Need Your Help

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.