views:

423

answers:

4

Hi,I'm having a problem with IBoutlet UITableView connection. It seems that the IBOutlet isn't connected to the TaleView. I set the delgate and the datasource to the files owner and set the iboutlet to the tableview in the nib. The tableview is well initialized. I just want to do some reloadData and it's not working. I try to do some deselectRow just to see if it isn't reloadData problem but it doesn't deselect so i assume that the iboutlet isn't associated with my tableview. This table view is in a viewcontroller that is called as a modalViewController.

Here is some code: My .h file:

@interface AddEditProjectsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UIActionSheetDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITextViewDelegate, UIAlertViewDelegate>{

IBOutlet UITableView *addEditProjectTable;
}

@property (nonatomic, retain) IBOutlet UITableView *addEditProjectTable;

@end

My .m file:

- (void)viewWillAppear:(BOOL)animated {

(...)

[addEditProjectTable reloadData];

[super viewWillAppear:animated];

Thanks for any help! :)

A: 

Have you actually implemented the data source and delegate methods such as cellForRowAtIndexPath?

David Kanarek
Yes I implemented the datasource and delegate methods. I wanna do the reload Data to change the Header and footer titles.
ideafactory
A: 

Not sure if this is causing your problem, but

[super viewWillAppear:animated];

should be called before your own code.

Joe Cannatti
I tried that but it doesn't work :(thanks anyway!
ideafactory
A: 

You said, "It seems that the IBOutlet isn't connected to the TaleView." Then you said, "and set the iboutlet to the tableview in the nib." After you "set the iboutlet to the tableview in the nib", is it still not connected? You can verify this by looking at the 'Connections' tab in the Inspector in IB while the tableview is selected. You should see all the connections (data source, delegate, and outlet). If it is not connected and it won't let you connect the tableview to your outlet, try restarting IB and Xcode.

If the connection is there, then you have some other problem. In that case, try creating a new project from the 'Navigation-based Application' template and see if it works as expected. Then compare your code to that and the problem should emerge.

Best regards,

Matt Long
I looked to the connections in the IB and it's all connected, the delegate, datasource and my outlet.My project is Navigation-Based Application but i set this viewcontroller as modalview cause i don't want to set this to the navigation controller.Thanks
ideafactory
I was merely suggesting you look at the template to make sure you're setting it up the same. How are you setting "this viewcontroller as modalview"? Are you calling presentModalViewController:animated:? Can you show your modal view presentation code? Have you set a breakpoint in viewDidLoad to make sure it is getting called?
Matt Long
A: 

I'm calling the modalview this way:

if (self.addEditTasksController == nil) {
        AddEditTasksViewController *addEditTaskCont = [[AddEditTasksViewController alloc] initWithNibName:@"AddEditTasksViewController" bundle:nil];
        self.addEditTasksController = addEditTaskCont;
        [addEditTaskCont release];
    }
    [self presentModalViewController:addEditTasksController animated:YES];

The viewdidload is called everytime as the viewWillAppear.

Thanks.

ideafactory