IPhone: Controllers, Delagates, DataSources, etc all in one class?

Posted by MLS on Stack Overflow See other posts from Stack Overflow or by MLS
Published on 2010-05-20T20:05:36Z Indexed on 2010/05/20 21:00 UTC
Read the original article Hit count: 167

Filed under:
|
|
|

Hi All,

I am learning iPhone programming. I am starting with a simple example of displaying recently used documents in a UITableView.

What I am confused about is why do I need to have several classes and why cant I just use one?

Example, My class is called RecentFileList.

I need to implement controller, delegate and datasource as well as the actual table view. Can't I just do this all in my RecentFileList Class versus having to create a RecentFileListDelegate RecentFileListController, RecentFileListDataSource class, etc, etc.

Related to this can one define a class like:

@interface FileListView : NSObject <UITableViewDelegate> <UITableViewController> <UITableViewDataSource
{
    // code
}
@end

or would I just do the work to make my class a delegate and controller in init()?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about apple