UITableView superClass for delegate?

Posted by fuzzygoat on Stack Overflow See other posts from Stack Overflow or by fuzzygoat
Published on 2010-05-11T09:46:30Z Indexed on 2010/05/11 9:54 UTC
Read the original article Hit count: 257

Filed under:
|
|

A quick question, I am setting a delegate for UITableView and I have a question regarding setting the delegate and dataSource properties. I have noticed that the properties for delegate and dataSource are not available, I was thinking that adopting the protocols would make them available. But I am now thinking that I maybe have the superclass for my delegate class wrong.

Currently I have:

-(void)viewDidLoad {
    TestDelegate *tempDelegate = [[TestDelegate alloc] init];
    [self setMyDelegate:tempDelegate];
    // setDelegate
    // setDataSource
    [tempDelegate release];
    [super viewDidLoad];
}

My interface for TestDelegate looks like:

@interface TestDelegate : NSObject <UITableViewDelegate, UITableViewDataSource> {
    NSArray *listData;
    int myCounter;
}

Can I ask if the above should be:

@interface TestDelegate : UITableView <UITableViewDelegate, UITableViewDataSource> {
    NSArray *listData;
    int myCounter;
}

gary

EDIT: I think it might be right as NSObject, I have a view>tableView in IB, thats what I will need to connect my delegate class to. I added to tableView in IB so maybe I just need to make it available in Xcode.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa-touch