开发者

problem with IBoutlet UITableView connection

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 *addEditPro开发者_如何学CjectTable;

@end

My .m file:

- (void)viewWillAppear:(BOOL)animated {

(...)

[addEditProjectTable reloadData];

[super viewWillAppear:animated];

Thanks for any help! :)


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


Not sure if this is causing your problem, but

[super viewWillAppear:animated];

should be called before your own code.


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,


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜