iOS XCode 4 + Custom UITableViewCell Problem

CBX

macrumors regular
Original poster
May 15, 2007
232
0
Hi:

Im totally new to Xcode but not new to software development. Im currently looking at the Storyboard option to create a new screen using a UITableViewController.

My TableView has 1 section and 2 rows which I want to store settings from NSUserDefaults. Each row has a label and a textbox.

I have labeled the rows so they can be uniquely identified, however when I run I get no errors but the label and text box's don't show.

However, if I change the controller to be a TableUIViewController (rather than using my subclass) it works fine...

I subclass is just a standard subclass.

Anyone help?
 
Last edited:

CBX

macrumors regular
Original poster
May 15, 2007
232
0
Not sure what code I could show to help as everything is done through the storyboard resulting in no code?

My screen doesn't populate the cells yet. There's just labels and text fields which don't show unless I change the view controller to the actual tvc rather than my subclass.
 

dejo

Moderator
Staff member
Sep 2, 2004
15,981
447
The Centennial State
Not sure what code I could show to help as everything is done through the storyboard resulting in no code?

My screen doesn't populate the cells yet. There's just labels and text fields which don't show unless I change the view controller to the actual tvc rather than my subclass.
Cell population is done via code, regardless of whether you're using storyboards or not. And your concern seems to be with the labels and textfields not showing. So, perhaps the code that does this in your subclass compared to the code that does this in your tvc would be a good place to start.
 

CBX

macrumors regular
Original poster
May 15, 2007
232
0
Appreciate what your saying. Maybe I have the wrong idea.

The only code in my sub class is the auto generate sub class code. The only change I made is to the two methods which return num of rows and num of sections.

I'm not populating the text boxes at this stage but would still expect to see my labels show up as in the storyboard.

Perhaps I'm missing a bit of knowledge. However it does work if I use a tvc rather than a sub class of it.
 

CBX

macrumors regular
Original poster
May 15, 2007
232
0
My understanding is if I drop a static element on to a ui designer it should appear when I run it.

I would not expect to see dynamic content.

What am I missing in my understanding?
 

dejo

Moderator
Staff member
Sep 2, 2004
15,981
447
The Centennial State
My understanding is if I drop a static element on to a ui designer it should appear when I run it.

I would not expect to see dynamic content.

What am I missing in my understanding?
Perhaps I'm not understanding. By static element, do you mean a UILabel? Where in your UI are you dropping this label? Does this label have a text value?

Could you perhaps include a screenshot of your UI setup?
 

CBX

macrumors regular
Original poster
May 15, 2007
232
0
Static element, yes a ui label set to a value.

Sorry. Away from MacBook at moment so can't screen shot.

Thanks for help with this.
 

CBX

macrumors regular
Original poster
May 15, 2007
232
0
Resolved!! :)

Thanks for your help with this, refocusing be back to the code.

It turns out that the auto generate code when I subclassed the TVC was the issue.

Commenting out

- (NSInteger)tableView: (UITableView *)tableView numberOfRowsInSection: (NSInteger)section

now allows my static rows with custom cells to display.

I assumed that the stub code would not be the issue.