last day (15 days later) » 

10:56 PM
0
Q: UILabel that is part of custom UITableViewCell text not updating in cellForRowAtIndexPath

ewizardThe text for my UILabels will not update. Here are the UITableViewController delegate functions: #import "PoolsTableViewController.h" @interface PoolsTableViewController () @end @implementation PoolsTableViewController -(instancetype)initWithCoder:(NSCoder *)aDecoder { self = [super init...

 
Have you connected the labels in your nib to the outlets in your cell class
 
yes ill post a screenshot
 
what do you actually see when you run your code? Do you see the placeholder "label" text? Try lines = 1, if that works, check your constraints.
 
yes I see the placeholder "Label" text, so that means the constraints are ok correct? and numberOfLines=0? I believe i tried = 1 already.
 
Set a breakpoint in cellForRowAtIndexPath and step through to make sure nothing is nil, unlike Swift, Objective-C happily does nothing if you send a message to nil
 
10:56 PM
with setting the breakpoint am i checking that cell != nil for the condition? I'm not exactly sure how to interpret the output when it hits the breakpoint, the cell doesn't load and in the code it has Thread 1: breakpoint 1.1 just below the line I set the breakpoint on, for the breakpoint condition i used cell != nil although im not really sure what im doing with these settings
posting a picture of my screen
if I do cell == nil for the condition it gets through...so it seems that the Cell that it dequeues is not nil?
this is also my first time really trying to use storyboards instead of doing everything programatically and i just noticed that if I remove the item from self.items it still renders the cell, am i doing something wrong in my main.storyboard? I remember skimming over making a "prototype" cell, but I thought that just meant making one cell as a xib and inserting it into the main.storyboard to be referenced.
do i even need the PoolsTableViewCell in the main.storyboard? or is my code referencing the custom PoolsTableViewCell nib?
hi thanks for helping
 
If you are using a storyboard then you don't use a nib file. You add a prototype cell to your tableview in the storyboard
 
what if i want to use the nib file?
dont use dequeue?
 
Yes, you can still dequeue from a registered nib file, but storyboards and protype cells simplify al of that and keep all of your UI design in the same file.
What I meant by using the debugger was to check your cell's outlets to make sure the labels weren't nil. You don't need a condition on the breakpoint. You can just use an unconditional breakpoint
 
sorry had some internet problems
how do i dequeue from the nib file?
and is a "prototype" cell something different than just adding my custom PoolsTableViewCell to the main storyboard as part of the UITableView?
because thats what i did
i will update my question with a screenshot of my main storyboard
 
That is what you are doing; you register the nib file against a reuse identifier.
 
11:05 PM
ok so doing it how i am doing it now i dont need to add anything to the storyboard
 
Normally, if you are using a storyboard, then you simply add a prototype cell in your storyboard's tableview, set its class and reuse identifier and then you can just dequeue it without needing to register anything.
 
ah ok
so then that means the row just isn't being created
oh i have an idea
 
The separate nib approach is "the old way" before storyboards.
 
ok thanks
it was just that i was adding [self.items addObject:@"Hello"]; in initWithCoder instead of viewDidLoad thanks so much for the direction and info!
 

last day (15 days later) »