NSSplitViewController on OSX 10.10 using Xcode 6

According to the documentation for the NSSplitViewControllers, the associated NSSplitView uses the NSSplitViewController as its delegate. In particular, in the documentation "The shared view controller serves as a delegate of its shared view object (the object that controls the delimiters). If you override the delegation method of the split view, your override should call super.

I implemented NSSplitViewController in the interface builder and gave it a class. However, none of the splitView delegates are ever called. Also, if I just do something like a hoot delegated by the splitView delegate [NSLog (@ "% @", self.splitView.delegate); ], the result is null. However, if I assign a delegate either to IB itself (by dragging the delegate output to the NSSplitViewController) or inside the code ([self.splitView setDelegate: self];), I get the following error:

An uncaught exception was raised
SplitViewController splitView cannot use autorun because SplitViewController overrides an incompatible delegation method.

I am completely confused.

+6
source share
1 answer

If a delegate with a split view implements one of the following methods, it becomes incompatible with the auto route.

splitView:constrainMinCoordinate:ofSubviewAt: splitView:constrainMaxCoordinate:ofSubviewAt: splitView:resizeSubviewsWithOldSize: splitView:shouldAdjustSizeOfSubview: 

https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/#10_8AutoLayout


And since the NSSplitViewController requires the use of an automatic layout (mentioned in the documentation), these methods are incompatible with the NSSplitViewController and should not be implemented in a subclass.

+17
source

Source: https://habr.com/ru/post/978299/


All Articles