how to deal with the need of multiple interfaces?
Hello I recently posted this question but very badly explained the problem, but i'll hopefully explain it better this time.
I have made this past project before with a Tab Bar, which one of the tabs lead to a UITableViewController
, through @interface
like so:
@interface NewsViewController : UITableViewController <MWFeedParserDelegate> {
Now I am doing a similar project where I am using a lot of the same code but it isn't using tabs, it uses UIButtons
on a UIViewController
to navigation around, and on one of my i want it to load the same UITableView
, So i added the tableView
to my project using IB, and now i have the p开发者_如何学Pythonroblem as my original @interface
for this particular header is a UIViewController
like so:
@interface NewsViewController : UIViewController
So now i need my interface to load the UIViewController
, and the UITableViewController
under the same @interface
, so then they both load and the same time, and that the tableView
is then inside of the view.
Or is there something i should of probably changed in the .m file, which will tell it to load tableView
as right now if i use:
@interface NewsViewController : UIViewController <MWFeedParserDelegate> {
I get errors saying i haven't declared tableView
, and if i change it to UITableViewController
, it obviously doesn't load the view.
Any ideas?
Can't you just change the "original @interface
" to be a subclass of UITableViewController
, then connect the proper outlets in Interface Builder:
@interface NewsViewController : UITableViewController
If you load just the NewsViewController
which is a subclass of UIViewController
, it doesn't recognize tableView
because it doesn't have a table view, it's not a subclass of UITableViewController
.
I think you are getting confused between UITableView
and UITableViewController
. A UITableViewController
is simply a subclass of UIViewController
that manages a UITableView
and adds some standard behaviour you might like for table views. It is all written in the Apple UITableViewController Docs.
精彩评论