-2

Im trying to do this:
http://imgur.com/ujNDgQm

The separator needs to dynamically change with the length of the label. This is what i have now

UIImageView *separator = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"Shuffle"]];
separator.frame = CGRectMake(CGRectGetMaxX(cell.detailTextLabel.frame), CGRectGetHeight(cell.frame) / 2,200, 20);
[cell addSubview:separator];

The image is placed there but it doesn't dynamically change like I thought it would.

Larme
  • 24,190
  • 6
  • 51
  • 81
Mark Bourke
  • 9,806
  • 7
  • 26
  • 30
  • 1
    What's the separator in your image? – Larme Oct 26 '15 at 16:23
  • You could use "•" as your separator, or maybe `NSAttributedString` and `NSTextAttachment` . – Larme Oct 26 '15 at 16:56
  • By doing a research since there are question about that in StackOverFlow? – Larme Oct 26 '15 at 16:57
  • My mistake. I thought that by giving your two key words (`NSAttributedString` and `NSTextAttachment`), it would be enough. Here a link: http://stackoverflow.com/questions/22357171/how-to-resize-an-image-or-done-as-a-nsattributedstring-nstextattachment-or-set – Larme Oct 26 '15 at 17:21
  • where did u call the code ? – Teja Nandamuri Oct 26 '15 at 17:23

1 Answers1

1

If you only want a •, simply set the label text to

cell.detailTextLabel.text = [NSString stringWithFormat:@"ARTIST: %@ • LENGTH: %@", artistName, formattedTimeAsString];

Of course you might have to use NSLocalizedString in case you support more than one language

MarkHim
  • 5,686
  • 5
  • 32
  • 64