Item wouldn't appear in the list after insertion


The app on iOS simulator shows the text field and the insert button, but after typing task, it won’t show up in the list. The list is actually empty.

Anybody can help me on this issue ?

Hopefully you’ve solved your problem by now.
If there’s no compiler error, you’ve probably just forgotten to instantiate the tasks array at the top of application:didFinishLaunchingWithOptions

I ran into the same problem. But then I started looking over my code. In my case I had addSubview:self.taskField down two times when one of them should have been taskTable.

Check these lines and make sure they are correct:

 // Add our three UI elements to the window
    [self.window addSubview:self.taskTable];
    [self.window addSubview:self.taskField];
    [self.window addSubview:self.insertButton];

I had a similar problem, turned out to be the table view content mode was inadvetenly set to ‘view based’ instead of ‘cell based’ (look under attribute inspector). The documentation for the method:

- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex

specifically notes the following:

This method is intended for use with cell-based table views, it must not be used with view-based table views. In view-based tables, use target/action to set each item in the view cell.

I also ran into the same issue.Then I checked all the codes about datasource,like tasks and taskTable,I found the problem.
First,make sure to instantiate the tasks array at the top of application:didFinishLaunchingWithOptions,self.tasks = [NSMutableArray array];
Then,check the - (void)addTask:(id)sender method.DO NOT forget [self.tasks addObject:text] and [self.taskTable reloadData].I just forgot the last sentence,so the taskTable can’t reload to show the list.
At the end,implement the two require method of UITableViewDataSource protocol.

Can you show a more explicit example? Can’t understand what you mean. Thanks!:grin: