PFQueryTableViewController ignores most settings of a custom PFTableViewCell in storyboard

107 views Asked by At

I have a TableViewController that is a subclass of PFQueryTableViewController.
It displays dynamic TableViewCells that are subclasses of PFTableViewCell, and have 2 custom properties of type IBOutlet UILabel.
Both are set up in storyboard, as in the following picture.
enter image description here
The backgrounds of the different views have been colored to make the views visible. Please note that the text size of both labels is set the same, 12pt.
In tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object I set both labels by

cell.dateLabel.text = stringFromDate; // the date is set earlier
cell.activityLabel.text = @"Test";

Now when I run the app, the following picture is displayed:
enter image description here
Please note that 1) the text is written correctly, but 2) the backgrounds are not colored, 3) only the date field has a text size of 12 pt whereas the activity label has a size of 17 pt, 3) the height of the activity label is not as defined in storyboard but smaller.

Of course, the cell label is set correctly and the „right“ cell is dequeued (otherwise I could not access the custom properties). Also the properties are linked correctly (otherwise the text would not be displayed correctly).
In my table view controller, I don’t have any delegate methods that overwrite the storyboard settings of the table view cell.

So my question is:

Why are the storyboard settings for my table view cell only partly used (the text size of the 1st label) but most of them ignored (the background colors, the height and the text size of the 2nd label), and what do I have to do to make it work correctly?

1

There are 1 answers

0
Reinhard Männer On BEST ANSWER

Problem solved! Seems to be a Xcode6 bug:

Since I had the impression that an old version of the storyboard was used, I deleted the app from the simulator, and launched the app again. The app crashed immediately with the error „Could not find a storyboard named 'Main' in bundle NSBundle...“.
Then I realized that there were 2 references to the same storyboard in the project navigator, and deleted one.
I looked up the file path given in the error message and realized that the storyboard was no longer included in the target.
To include it again in the target, I opened the storyboard in the project navigator as source code - only then shows the identity inspector the properties of this file (when one opens it as usual as an interface builder file, the identity inspector window is empty). And indeed, the target membership checkbox was unchecked. After checking it again, the crash no longer happened, and the correct table view cell settings were used.

So the problem was that the simulator used an old version of the storyboard, since the new storyboard was not included in the target, and the old storyboard was thus not updated.