質問

My setup is

I have nib file consisting of an NSpanel, with an NSOutlineView.

The outline view is populated via bindings and NSTreeController, I have the NSOutlineView subclassed where I have some delegate and drag and drop methods.

My Problem

I'm trying to implement the delegate method

- (void)textDidEndEditing:(NSNotification *)aNotification

I can edit any item in the NSOutlineview, once I hit "return" the delegate method is called, however the window is no longer active. And the item is left in "edit mode" I have to have to click an item above or below the edited item to terminate the edit mode. I included a couple images to illustrate

Currently I don't have anything in the textdidendediting other than a NSlog to see if it was getting called. If I remove the method it performs as expected, editing is completed, window is still active.

Editing item

Editing item

Once I hit "return" window loses focus and item is still in edit mode.

Hit enter

役に立ちましたか?

解決

If overriding the NSOutlineView's textDidEndEditing: is changing the tableview's behavior, try adding a call to -[super textDidEndEditing:].

What's going on here is that NSOutlineView (or one of its super classes) is doing some important things in textDidEndEditing:, and by overriding that method in your child class, the parent class's method is never getting called.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top