![]() Begin by finding the NSTouchBar Button in the Objects pane, then dragging and dropping it into our Touch Bar. Now that we have the controller ready for our Touch Bar, we can start adding buttons, sliders, and more through the storyboard. You can do this by selecting the Identity Inspector in the Utilities pane of the storyboard, then choosing our new class as the custom class for the Window Controller. We need to tell Xcode that this class is going to be used by the Window Controller in our storyboard. Add a Cocoa class for the controller to the project, making sure to select NSWindowController as the subclass. Now, in order to add any functionality to the Touch Bar, we’ll need to add a corresponding class to the project for the Window Controller. This should snap it into place between the Window Controller and the View Controller. Select the NSTouchBar object, and drag it onto the Window Controller. This will bring up all the objects you can add, as well as the Touch Bar itself: NSTouchBar. Starting in Main.storyboard, search for “Touch Bar” in the Object Library pane. ![]() I chose to use storyboards so I could see all of my options for objects I could add to the Touch Bar. Once you’ve got your Touch Bar simulator up and running, it’s time to work on what you want to add to it. To access this, select Window -> Show Touch Bar or Shift+Command+5. Having a MacBook with a Touch Bar is not necessary for adding Touch Bars to your applications, as Xcode 8.1 includes a Touch Bar simulator. MacOS 10.12.2 or later Using the Touch Bar Simulator In this post, I’ll show you how to get started with NSTouchBar using storyboards. Using storyboards, I was able to see what types of functionality I could add to my Touch Bar and test out the new features available to me. I spent some time getting familiar with NSTouchBar by playing around with storyboards. From simply adding buttons to incorporating sliders or color pickers, programming the Touch Bar is a new, creative way to add shortcuts and other functionality into your Mac app. With the addition of the Touch Bar comes the ability to customize it for your own applications. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |