Question

I am using iOS 7`s new Dynamic Text feature for the subtitle of a table view row. I have set the UILabel in IB as follows:

enter image description here

This is how I set the contents of the UILabel in code:

NSAttributedString *checkmarkAttributedString = [[NSAttributedString 
      alloc]initWithString:@"☑"];
[detailAttributedString appendAttributedString:checkmarkAttributedString];

This is the result which is not autoshrinked correctly (the font size should be scaled down and the "..." avoided):

enter image description here

How can I get autoshrink to work?

It seems that it works correctly when I do not add the special character (checkmark) at the beginning of the string.

Was it helpful?

Solution 2

Not sure but it looks like the Minimum Font Scale has a comma in it. Shouldn't it be 0.4?

Otherwise try this in your cellForRowAtIndexPath method.

MyCustomTableViewCell *cell = [tableview dequeueReusableCellWithIdentifier:identifier];
cell.detailLabel.adjustsFontSizeToFitWidth = YES;

OTHER TIPS

There is a bug in iOS 6 it works fine for iOS 7, In iOS 6 if the text is multilines then it will not shrink.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top