简体   繁体   中英

UITableViewController Methods are not being called

As the title says none of my tableview controller methods are being called.

The steps I went through to create my table view are as follows.

1) I created a new file based on UITableViewController and selected the create with xib option. I Named my file myStuffViewController.

2) I have a rootview controller which is a UIViewController. In this view I have a navigation controller that I want to push my tableview controller onto at a certain point.

3) I setup my tableview and nav controller like so

mystuff = [[MyStuffViewController alloc]initWithNibName:@"MyStuffViewController"bundle:[NSBundle mainBundle]];
    accountView = [[AccountView alloc] initWithNibName:@"Login" bundle:[NSBundle mainBundle]];




    accountViewNavController = [[UINavigationController alloc] init];
     accountViewNavController.delegate = self;


    NSArray *ar= [NSArray arrayWithObjects:accountView,mystuff, nil];
    [accountViewNavController setViewControllers:ar animated:NO];
    [accountViewNavController popToRootViewControllerAnimated:NO];
    accountView.title=@"Login";

4) Then when a user pushes a button I want to push the table view controller onto the stack like this.

[accountViewNavController pushViewController:mystuff animated:YES];

I've even tried calling [self.tableView reloadData] but none of the methods get called.

Could somebody propose why my table view methods are not being called?

EDIT 1

Just so I'm being as clear as I can be here is what my header file looks like. To be it doesnt seems like I'm missing anything.

@interface MyStuffViewController : UITableViewController<UITableViewDataSource,UITableViewDelegate> {
    RemixView *remixView;
    NSMutableArray *remixListArray;
    TBXML*tbxml;


}
@property(nonatomic,retain)NSMutableArray *remixListArray;
@property(nonatomic,retain)RemixView *remixView;
@property(nonatomic ,retain)TBXML *tbxml;

-(void)fetchRemixList:(NSString *)uid key:(NSString *)k1;
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath;
@end

Check

  1. You declare in the .h file that you implement the two table view delegates UITableViewDelegate & UITableViewDatasource

  2. In the NIB make sure you link to your delegate in file owner OR if you have created the TableView programmatically make sure you set the delegate ivar also.

Then see if the delegate methods start getting called

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM