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?
Found the solution after some trial and error.
Turned out that since the cell was a custom subclass of
UITableViewCellI needed to reference the instance variable to that custom subclass and not theUITableViewCellsuperclass.So all I did was go from:
@property (nonatomic, strong) UITableViewCell *cellto
@property (nonatomic, strong) MyCell *cellAnd it worked out flawlessly. Pretty weird behaviour though. But it works.
EDIT:
Actually I was too quick there. It didn’t work by just changing the class to my subclass. What I instead noticed worked was that if after setting the
self.pickerviewCell.textLabel.textproperty I call[self.pickerviewCell.textLabel sizeToFit]But what is weird is that in another View Controller in my application I can do the above without needing to call- sizeToFiton theUILabelfor it to display properly.