0

I have literally tried everything.. and im sure my problem is probably something really stupid.

I have look at Apple's Doc on how to set this up, but yet it doesn't seem to be working.

Can someone please tell me what i did wrong? The App has one table, with one object in it, with bindings setup.. Here is the link for the code --> https://github.com/patchthecode/SimpleViewbasedBindings.git

[EDIT] The Problem is that the CellViews are blank.

Community
  • 1
  • 1
Just a coder
  • 15,480
  • 16
  • 85
  • 138

1 Answers1

0

A couple problems,

1) In IB you bind your array controller to a array, however your array is empty.

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    array = [NSMutableArray array];
    [arrayController addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"bob", @"name", nil]];
}

Try something like this

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    self.array = [NSMutableArray array];

    for (int i=0 ; i <= 10 ; i++)
    {
        NSMutableDictionary *myDic = [NSMutableDictionary dictionary];
        [myDic setObject:[NSString stringWithFormat:@"Bob %d",i] forKey:@"name"];
        [self.array addObject:myDic];
    }

    [[self arrayController] rearrangeObjects];

}

2)When binding the textfield to the Table Cell View the model path should be objectValue.name

Cory
  • 2,302
  • 20
  • 33
  • 1
    Yes it works for me [GitHub](https://github.com/Sully73/SimpleViewbasedBindings.git) – Cory Oct 25 '13 at 02:49
  • ok.. #2 was accidentally uploaded incorrectly, but i already had the correct local copy. and in #1, the array isnt empty. When you add an object using the arrayController, it updates the array automatically. You can put my code in your didFinishLaunching and you'll see that it works. HOWEVER, what i am totally confused about now is that now, my code and connections match yours EXACTLY (i just double checked), and im still seeing blank cells in mines, but yours works! I will flag your answer as correct, but could you look into the my repo link above again? i just updated my code to match yours – Just a coder Oct 25 '13 at 04:39
  • Hey Dude, i believe this is an error with my XCode. Thanks for the help. flagging as correct. I just did it from scratch as it worked. Note, your connections are correct, however, i would use my code. You should not manipulate the array directly when you already have the arrayController controlling the array – Just a coder Oct 25 '13 at 05:11