Talha Aslam
Talha Aslam

Reputation: 51

Custom Cell image not properly aligned

enter image description here

Images constrain's :

enter image description here

Image is set to scale-fill.

I am using SDWebImage Library to load images from server..

When image is loaded it over lap's the text area which is exactly below my image.

Here are the screen shot's of main layout.. No issues from constrain's found.

Here is the image when it load's look like:

enter image description here

Here is the code:

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

   cell=[tableView dequeueReusableCellWithIdentifier:@"fiscocustomcell"];


    int i = (int) indexPath.row;
    Newsletter * newstemp = [newsposts objectAtIndex:i];

    //get a dispatch queue
    ;
    cell.Title.text=[newstemp title];
    cell.Title.numberOfLines=0;
    [cell.Title sizeToFit];
   cell.Postedby.text=@"Posted by";
    cell.Postedby.numberOfLines =0;
 [cell.Postedby sizeToFit];

    cell.NewsDesc.text=[newstemp desc];
    cell.NewsDesc.numberOfLines=0;
    [cell.NewsDesc sizeToFit];

    NSURL *urlimage = [NSURL URLWithString:[newstemp imagelink]];

    [cell.imageView sd_setImageWithURL:urlimage placeholderImage:[UIImage imageNamed:@"service-1.png"]];


    [cell setNeedsDisplay];
    [cell layoutIfNeeded];
return cell;
}

I am stucked from last 1 week with this issues used auto resolve constrain's etc as well nothing works.

It should be like this:

enter image description here

Upvotes: 0

Views: 68

Answers (1)

Talha Aslam
Talha Aslam

Reputation: 51

Solved Problem

The issue is cell.imageView, I am using custom cell so it must be custom uiimage naned there like:

 [cell.mycustomimage sd_setImageWithURL:urlimage placeholderImage:[UIImage imageNamed:@"service-1.png"]];

cell.imageView alway's place the image on the right of cell.

Thanks every one hope that bug will never happen's to any one again ever...

Upvotes: 1

Related Questions