0

I am writing an app where people are displayed in a table view.

This is the code in PictureListMainTable.m

// Get the core data object we need to use to populate this table cell
Pictures *currentCell = [pictureListData objectAtIndex:indexPath.row];

UIImageView *myImg = (UIImageView *)[cell viewWithTag:100];




//  Fill in the cell contents
cell.textLabel.text = [currentCell title];
cell.detailTextLabel.text = [currentCell desc];
cell.imageView.contentMode = UIViewContentModeScaleAspectFit;
cell.imageView.image = [UIImage imageWithData:[currentCell smallPicture]];



cell.telephoneNumber = [currentCell desc];

cell.delegate = self;

return cell;

I am trying to achieve something like this:

Dynamic name and Image

Any ideas on what I should do?

Ids Surrrrr
  • 49
  • 1
  • 6
  • What specific problem are you having? – rdelmar Aug 07 '13 at 01:31
  • Im not sure on how to achieve this positioning, at the moment the image and title are placed side by side – Ids Surrrrr Aug 07 '13 at 11:23
  • 1
    You just position them in IB the way you want. Both the image view and the label should have a centerX constraint. The image view would need a constraint to the top of the cell and probably height and width constraints. The label should have a constraint to the bottom of the cell. – rdelmar Aug 07 '13 at 14:17
  • Could you give me an example because I'm new to this? – Ids Surrrrr Aug 07 '13 at 17:16
  • Sorry, this isn't something easy to write up since you do it all in IB. If you don't know how to work with auto layout, you should watch the 3 videos from the 2012 WWDC on this subject. – rdelmar Aug 07 '13 at 17:33
  • whats ib? ok ill take a look – Ids Surrrrr Aug 07 '13 at 20:14
  • and also do you know how to just align the image to the center of the cell? – Ids Surrrrr Aug 07 '13 at 20:17
  • You just drag it to the center -- when you get it there you will see a vertical line telling you that you're are at centerX. – rdelmar Aug 07 '13 at 22:39
  • I do that but the image still Is positioned to the left – Ids Surrrrr Aug 07 '13 at 23:28
  • You must have missed it then. Look at the Size Inspector for the image view. Do you see a constraint that says "Align Center X to: superview"? – rdelmar Aug 07 '13 at 23:31
  • No i dont, but will this make all the dynamic images align to the center? – Ids Surrrrr Aug 08 '13 at 10:06
  • @IdsSurrrrr may this will give you some idea about the poisoning of image in custom cell. have a look on this https://github.com/romaonthego/RETableViewManager – sandy Aug 08 '13 at 10:24

0 Answers0