reload problem

IB Elements:
One tableView
One button

IB Connections:
table View x Controller delegate:
table View x Controller datasource:
Button x Controller changetheInt:

When button is pressed, the value of theInt changes as I observe it in Console but it does not change in tableView.
Only when I click on the row of tableView, the value is updated. As you can see above i am already using tableView reloadData.

If you subclass a class, even if it is NSObject, you have to assign self to the super-call, not just call [super init], this will generate a memory leak.

I also don’t understand why you are using setValue:ForKey:. Isn’t it easier to just use the instance variable?

Hope it helps,

Thanks for the suggestions.
However, it does not solve the problem. There is no change in the result.

Try calling needsDisplay.

  • (IBAction)changetheInt:(id)sender {
    NSLog(@“theInt is now %d”, ++theInt);
    [tableView reloadData];
    [tableView setNeedsDisplay: YES];


only binding works as desired.

I’m not sure you should be changing the ivar directly, but if you do, you’ll have to include willChangeValueForKey and didChangeValueForKey.

Are you sure you’ve set the data source and IBOutlet thru IB? The code in this project works fine for me:

Hope it helps,

Sorry for the delay in replying.

I had mentioned the above connections in my first post.

Instead of
table View x Controller delegate:
the connection
table View x Controller
was required.

Thanks for the help.