Frage

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.

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top