Re: Strange behavior of view based NSTableView with NSTextView
Re: Strange behavior of view based NSTableView with NSTextView
- Subject: Re: Strange behavior of view based NSTableView with NSTextView
- From: Jonathan Mitchell <email@hidden>
- Date: Sat, 18 Jul 2015 18:50:44 +0100
> On 18 Jul 2015, at 14:37, Nick <email@hidden> wrote:
>
>
> here. Could you suggest me what am i doing wrong?
> Thanks
>
>
> if([[tableColumn identifier] isEqualToString:@"FirstColumn"]) {
>
> NSTableCellView *tableCellView = [tableView makeViewWithIdentifier:
> @"FirstColumnCellView" owner:tableView];
>
> NSTextView *view = [[[tableCellView subviews][0] subviews][0]
> subviews][0];
>
> view.string = [NSString stringWithString:self.entries[row]];
>
> view.delegate = self;
>
>
> return tableCellView;
>
> }
>
>
Not sure but try this.
In the call to -makeViewWithIdentifier:owner: try setting the owner to nil (I tend to do this) or the table delegate (the default superclass implementation does this).
The owner receives an -awakeFromNib: call each time -makeViewWithIdentifier:owner: is issued which can cause unexpected behaviour
> [[[tableCellView subviews][0] subviews][0]
> subviews][0];
Your code will be a lot more maintainable if you declare an NSTableCellView subclass here with proper outlets.
Do you really need an NSTextView rather than an NSTextField?
Jonathan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden