Search code examples
objective-cosx-mountain-lionnstextfield

NSTextField will not show


I've tried many of the answers that I've found here. I must be doing something dumb and could use help.

  1. in .h: @property (strong) IBOutlet NSTextField *title;

  2. in .m:

    title = [[NSTextField alloc] init];
    [title setStringValue:@"test"];
    NSLog(@"title is %@", [title stringValue]);
    
  3. In IB, the title field is set up like this:

enter image description here

and it's class is NSTextField.

I can get the data to show in the tableview, but I cannot link it to the textfield. Thanks for any help...

I do log the title field and that shows content:

  title is test

Solution

  • After looking some more on SO, I came up with this, that works as I need it:

    NSInteger row =  [[notification object] selectedRow];
        currentItem = [itemArray objectAtIndex:row];
    
        [self.itemTitle setStringValue:
         [NSString stringWithFormat: @"%@", [currentItem valueForKey:@"title"]]];
    

    Thanks