Mouse and Trackpad
- Hello and welcome to WWDC. I'm Steve Moseley, a UIKit engineer, and this is 'Handle Trackpad and Mouse Input.' In this video, we're going to talk about ways to make your app feel responsive to the indirect input mechanisms like trackpads and mice introduced in macOS Catalina and iPadOS 13.4.
- The Magic Mouse connects to computers via Bluetooth, but it only works with Apple computers running Mac OS X version 10.5.8 or later, and you must install the Wireless Mouse Software update 1.0.
A mouse or trackpad provides a way to activate interface elements and initiate actions using clicks and fluid, intuitive finger gestures to supplement keyboard input.
Sep 16, 2020 Apple Magic Mouse and Magic Trackpad should be ready to pair at this point. If you're pairing a third-party accessory that you've used with another device, follow the pairing-mode steps from its manufacturer. Open the Settings app on your iPad.
Clicks and Gestures
macOS supports a wide range of standard mouse and trackpad clicks and gestures that people can customize. Individual clicks and gestures that aren’t primary ways of interacting with content can be enabled and disabled based on their applicability to the current workflow. People can even choose specific regions of a mouse or trackpad for invoking secondary clicks, and select specific finger combinations and movements for certain gestures.
Click or gesture | Expected behavior | ||
---|---|---|---|
Primary click | Select or activate an item, such as a file or button. | ||
Secondary click | Reveal contextual menus. | ||
Scrolling | Move content up, down, left, or right within a view. | ||
Smart zoom | Zoom in or out on content, such as a web page or PDF. | ||
Swipe between pages | Navigate forward or backward between individually displayed pages. | ||
Swipe between full-screen apps | Navigate forward or backward between full-screen apps and spaces. | ||
Mission Control (double-tap the mouse with two fingers or swipe up on the trackpad with three or four fingers) | Activate Mission Control. | ||
Lookup and data detectors (force click with one finger or tap with three fingers) | Display a lookup window above selected content. | ||
Tap to click | Perform the primary click action using a tap rather than a click. | ||
Force click | Click then press firmly to display a Quick Look window or lookup window above selected content. Apply a variable amount of pressure to affect pressure-sensitive controls, such as variable speed media controls. | ||
Zoom in or out (pinch with two fingers) | Zoom in or out. | ||
Rotate (move two fingers in a circular motion) | Rotate content, such as an image. | ||
Notification Center (swipe from the edge of the trackpad) | Display Notification Center. | ||
App Exposé (swipe down with three or four fingers) | Display the current app’s windows in Exposé. | ||
Launchpad (pinch with thumb and three fingers) | Display the Launchpad. | ||
Show Desktop (spread with thumb and three fingers) | Slide all windows out of the way to reveal the desktop. |
Use standard controls and views. The standard controls and views automatically respond to most standard clicks and gestures. For example, a scroll view that implements a semantic layout and enables magnification automatically responds to the smart zoom gesture.
![Apple Com Mouse Apple Com Mouse](https://wordsofhisheart.files.wordpress.com/2013/08/abcmouse2.jpg?w=300)
Respond to clicks and gestures based on context and meaning. Based on their configuration, people make various physical movements to perform gestures. As a result, your app should pay attention to meaningful events instead of monitoring specific device interactions. For example, instead of watching for a two-finger swipe, your app might watch for a “Swipe between pages” event.
In general, respond to gestures in a way that’s consistent with other apps. People expect most gestures to work the same throughout the system, regardless of the current app. For example, the “Swipe between pages” gesture should behave the same way regardless of whether people are browsing individual document pages, webpages, or images. On a system with a Force Touch trackpad, people expect apps to behave predictably and consistently when they force click a control to get more information or accelerate an action.
Avoid redefining systemwide, inter-app gestures. Even in a game that uses app-specific gestures in a custom way, people expect systemwide gestures be available for things like revealing Mission Control and switching between full-screen windows. Remember that people can customize the gestures for performing systemwide actions.
Handle gestures as responsively as possible. Gestures should enhance the experience of direct manipulation and provide immediate, live feedback. To achieve this, minimize other operations while gestures are being performed.
Make sure gestures apply to the appropriate content. In general, gestures should apply to the content on which people are currently focused, such as a selected element or active view in a window. Start by identifying the most specific content people are likely to be manipulating and make it the target of the gesture. If the content doesn’t respond to the gesture, then consider targeting higher content levels and containers.
Define custom gestures cautiously. A custom gesture can be difficult to discover and remember. If a custom gesture seems gratuitous or awkward to perform, people are unlikely to use it. If you must define a custom gesture, make sure it’s easy to perform and not too similar to the gestures people already know.
Don’t rely on the availability of specific devices and gestures. You can’t be sure that everyone has a mouse or trackpad, or that they want to use it. In addition, people can disable and redefine gestures without your knowledge. For these reasons, it’s best to offer multiple ways to initiate actions.
For developer guidance, see NSResponder.
Pointers
The system offers a variety of standard pointer styles, which your app can use to communicate the interactive state of an interface element or the result of a drag operation.
Pointer | Name | Meaning | AppKit API |
---|---|---|---|
Arrow | Standard pointer for selecting and interacting with content and interface elements. | arrow() | |
Closed hand | Dragging to reposition the display of content within a view—for example, dragging a map around in Maps. | closedHand() | |
Contextual menu | A contextual menu is available for the content below the pointer. This pointer is generally shown only when the Control key is pressed. | contextualMenu() | |
Crosshair | Precise rectangular selection is possible, such as when viewing an image in Preview. | crosshair() | |
Disappearing item | A dragged item will disappear when dropped. If the item references an original item, the original is unaffected. For example, when dragging a mailbox out of the favorites bar in Mail, the original mailbox isn’t removed. | disappearingItem() | |
Drag copy | Duplicates a dragged—not moved—item when dropped into the destination. Appears when pressing the Option key during a drag operation. | dragCopy() | |
Drag link | During a drag and drop operation, creates an alias of the selected file when dropped. The alias points to the original file, which remains unmoved. Appears when pressing the Option and Command keys during a drag operation. | dragLink() | |
Horizontal I beam | Selection and insertion of text is possible in a horizontal layout, such as a TextEdit or Pages document. | I beam() | |
Open hand | Dragging to reposition content within a view is possible. | openHand() | |
Operation not allowed | A dragged item can’t be dropped in the current location. | operationNotAllowed() | |
Pointing hand | The content beneath the pointer is a URL link to a webpage, document, or other item. | pointingHand() | |
Resize down | Resize or move a window, view, or element downward. | resizeDown() | |
Resize left | Resize or move a window, view, or element to the left. | resizeLeft() | |
Resize left/right | Resize or move a window, view, or element to the left or right. | resizeLeftRight() | |
Resize right | Resize or move a window, view, or element to the right. | resizeRight() | |
Resize up | Resize or move a window, view, or element upward. | resizeUp() | |
Resize up/down | Resize or move a window, view, or element upward or downward. | resizeUpDown() | |
Vertical I beam | Selection and insertion of text is possible in a vertical layout. | iBeamCursorForVerticalLayout() |
Use system-provided pointers as intended. People are accustomed to the meaning of the standard pointer styles. If you change the meaning of one, people can’t predict the results of their actions.
Prefer system-provided pointers because they're familiar. If you must design a custom pointer, make sure it improves the usability of your app and isn’t confusing. For example, your custom pointer should make it easy for people to know which part of the pointer to position over an element. If you customize the arrow pointer, create custom versions of the related arrow pointers too, such as copy and disappearing item.
For related guidance, see Drag and Drop. For developer guidance, see NSCursor.
Haptic Feedback
When running on a device that’s equipped with a Force Touch trackpad, your app can provide haptic feedback in response to a drag operation or force click in certain situations. There are three specific haptic feedback patterns your app can adopt.
Haptic feedback pattern | Description |
---|---|
Alignment | Indicates the alignment of a dragged item. For example, this pattern could be used in a drawing app when the people drag a shape into alignment with another shape. Other scenarios where this type of feedback could be used might include scaling an object to fit within specific dimensions, positioning an object at a preferred location, or reaching the beginning/minimum or end/maximum of something, such as a track view in an audio/video app. |
Level change | Indicates movement between discrete levels of pressure. For example, as people press a fast-forward button on a video player, playback could increase or decrease and haptic feedback could be provided as different levels of pressure are reached. |
Generic | Intended for providing general feedback when the other patterns don’t apply. |
Use haptics judiciously. Overuse diminishes the feedback's significance and can cause confusion.
Provide haptic feedback in response to user-initiated actions. People easily correlate haptics with actions they initiate. Haptics that occur at other times can seem arbitrary, which can lead to confusion and a disconnected user experience.
Don’t redefine feedback types. To ensure a consistent experience, use feedback types as intended. Alignment and level Change feedback patterns are for very specific use cases and should be used consistently throughout the system. If the use cases for these patterns don’t apply to your app, use the generic pattern.
Fine-tune your visual experience for haptics. Provide visual and haptic feedback together to create a deeper connection between actions and results. Make sure animations are sharp and precise, to visually match what people feel through the Force Touch trackpad.
Don’t rely on a single mode of communication. Not all devices support the full range of haptic feedback, and people can disable the feature entirely in Settings if they choose. In addition, haptic feedback occurs only when the device is active and your app is frontmost. Supplement haptics with visual and audible cues to ensure that important information isn’t missed.
Apple Mouse And Keyboard
Synchronize haptics with accompanying sound. Haptics don’t automatically synchronize with sounds. If you want an audible cue, you synchronize the sound with the haptic.
For developer guidance, see NSHapticFeedbackPerformer.
Before you begin
Connecting a Bluetooth accessory to your iPad requires iPadOS 13.4 or later. These iPad models support iPadOS 13 and later:
- iPad (5th generation) or later
- iPad mini 4 or later
Learn how to identify your iPad and update your software.
How to connect a Bluetooth mouse or trackpad to your iPad
- Turn on your Bluetooth accessory and place it near your iPad.
- Make sure that your accessory is in pairing or discovery mode.
- Apple Magic Mouse and Magic Trackpad should be ready to pair at this point.
- If you're pairing a third-party accessory that you've used with another device, follow the pairing-mode steps from its manufacturer.
- Open the Settings app on your iPad.
- Tap Bluetooth.
- Look under Other Devices for your Bluetooth accessory, then tap its name to pair it with your iPad.
Depending on the accessory that you're connecting, you might need to take extra steps. Follow any onscreen instructions that appear. If you're pairing with Apple Magic Mouse or Magic Trackpad and you're asked to provide a code, use 0000 (four zeros).
If you're having trouble connecting your accessory, try these tips.
iPadOS doesn't support scrolling or other gestures with Apple Magic Mouse (1st generation) or Magic Trackpad (1st generation).
If you see a connectivity alert
Apple Com Mouse Pad
When using a Bluetooth mouse or trackpad with your iPad, you might see an alert that says 'Using this accessory may affect Wi-Fi and Bluetooth connectivity.'
Cleanmymac x 4 4 0 (update).
Cleanmymac x 4 4 0 (update).
Wireless interference can happen when you use a Bluetooth accessory with some iPad models. The more Bluetooth accessories that are connected to your iPad and active, the more likely you are to experience wireless performance issues.
If this happens, and you have connectivity issues, try disconnecting any Bluetooth accessories that you're not using. In Settings > Bluetooth, tap the information button next to the accessory's name, then tap Disconnect.
Apple Commission Wenatchee
Reconnect, disconnect, or forget the Bluetooth accessory
After it pairs with your iPad for the first time, your accessory appears under My Devices in Settings > Bluetooth. Tap your accessory's name to reconnect it to your iPad when it's not connected.
To disconnect the accessory or have your iPad forget the accessory, tap the information button next to its name.
Learn more
- Using a wireless accessory with your iPad is similar to using one with a desktop or notebook computer. But there are some features that make the experience unique to iPad. Learn how to use a Bluetooth mouse or trackpad with your iPad.
- You can see the battery percentage of your connected Bluetooth mouse or trackpad in the Batteries widget. Learn how to add widgets in the Today View on your iPad.
- Don't see the onscreen keyboard when you have a trackpad or mouse connected? Tap the keyboard button in the lower-right corner of the screen. In the menu that appears, tap the show keyboard button . To hide the software keyboard, tap the dismiss button .