PDA

View Full Version : UIView Issue




GhostDZ9
May 20, 2011, 12:55 PM
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
May 20, 2011, 02:11 PM
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
May 21, 2011, 03:07 PM
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

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
May 21, 2011, 06:30 PM
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
May 21, 2011, 10:45 PM
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
May 22, 2011, 04:12 AM
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