iOS - UILabel in UITableViewCell erroneously truncates text

I have a weird issue:

I'm using a UIPickerView to pick some values. When a value is picked I want to update a row in a UITableView with that value from the pickerview. So I have saved a reference to the particular cell.

So when I select a row in the pickerview I do this in the pickerview delegate method - didSelectRow...

self.pickerviewCell.textLabel.text = [self.pickerViewDataSource objectAtIndex:row];

And then I dismiss the pickerview with an animation. But for some reason after the pickerview is off the screen I see the label in the row being updated with three dots ... which would indicate that the text is too long for the label and then a second after the dots disappears and the full text of the label is displayed. The text strings are not too long, they are between 3 and 5 characters long and should fit perfectly in the textLabel of a UITableViewCell.

Anyone have a clue?

Answers


For me, the problem was that my strings ended with \n. That worked with UITableViewCellStyleDefault, but when changing to UITableViewCellStyleSubtitle, the strings were truncated (no matter how long the string was, the three last characters where changed to ...). Removing \n from the strings fixed it.


Need Your Help

Assign a remote for Git Push

git

I've been developing in a local repository for a while and just set up a git server.

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.