Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

GhostDZ9

macrumors regular
Original poster
Sep 13, 2010
118
0
Hey guys,

So im building another part to my app and i can't get it to display properly

What I have:

- I have a navigation bar at the top that has the app name
- I have a button to start the timer
- I have a UITableView to show 6 options
- A date picker at the bottom of the app in the form of a timer

My issue is:

When I create a new file without a subclass of a UITableView

I can edit the .xib file and put whatever I want on it but they array doesn't populate on the TableView

OR

When I create a new file with a subclass of UITableView

I can't edit the .xib file and put whatever i want but they array populates the UITableView


ANY SUGGESTIONS??????

Ghost
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Do you have a subclass of UIViewController for your view? You should. And when you do, you can make it the delegate and datasource for your UITableView.
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
Like Dejo said.

If u add a UITableView in a blank UIView Controller, u have to add delegates (Objective C thing.)

In your Header file, u can do like this

Code:
 blahblah : UIViewController <UITableViewDelegate, UITableViewDatasource>

Or something. Then in your XIB, add the tableview, control click it, drag it to files owner, show it the delegate/datasource. Then it will populate it accordingly, if u add the code right ;)
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
I think you're running into a limitation of UITableViewController. It requires that its table is fullscreen. If you want a tableview that is smaller than fullscreen you need to use your own subclass of UIViewController. What I usually do is create a new file and choose UITableViewController and then change the base class to UIViewController. In this way I get all of the tableviewcontroller methods in the .m file.
 

GhostDZ9

macrumors regular
Original poster
Sep 13, 2010
118
0
I think you're running into a limitation of UITableViewController. It requires that its table is fullscreen. If you want a tableview that is smaller than fullscreen you need to use your own subclass of UIViewController. What I usually do is create a new file and choose UITableViewController and then change the base class to UIViewController. In this way I get all of the tableviewcontroller methods in the .m file.

How would I go about doing that?
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
That's kind off how I said..
Add a new file, a UIVIewController, and then u can select if u want it to be a UIVIewController subclass or a UITableViewController. choose the latter, then, in the header file, change it to how i said it, u have the methods and the XIB to go on..
But create a new UIView, drag the existing tableview in there. and on the file's owner, instead of giving the tableview the "view" property, give it to the UIView.

Or grab a book if u didn't understand what we just proposed :p
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.