O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Challenge: Draggable Divider

Now that you have the NerdSplitViewController working, worry about the draggable divider. You will need a way to receive mouse dragged events. You will then change out the constraints in response to the dragging.

As you will recall from Chapter 18, there are a few different ways to receive the mouse events. Because NSViewControllers are in the responder chain, you can simply implement mouseDragged(_:) and so forth in the NerdSplitViewController. Another option is to use an NSPanGestureRecognizer added to a view representing the divider.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required