![]() ![]() My experience with the API has been somewhat mixed. So for example, in viewDidLoad:įunc contextMenuInteraction ( _ interaction : UIContextMenuInteraction, configurationForMenuAtLocation location : CGPoint ) -> UIContextMenuConfiguration ? ![]() To enable context menus you create a UIContextMenuInteraction, specifying the delegate, and add it to a view. Try to add contextual menus to every object in your App. It seems like a tall order but Apple were pushing context menus hard in the iOS design session at WWDC 2019: (If you port your iOS App to the Mac using Catalyst the context menus are automatically converted). That makes it much more likely a user will learn to right-click and discover the actions. It’s interesting to compare iOS to macOS where almost all items have a context menu. I recommend spending a minute to read the relevant section of the iOS Human Interface Guidelines before you start. You cannot rely on a user realizing a context menu exists. The layout automatically adapts to the available space shifting the preview to the side of the menu if necessary.Ĭontext menus, like all features accessed with a gesture, suffer from a lack of discoverability. You can create submenus though Apple recommends limiting them to one level. ![]() The contextual menu presents a menu of actions and a preview of the affected item. This makes it available on all devices running iOS 13 or later. You access contextual menus using a touch and hold gesture or 3D Touch if you have it. Introducing Contextual MenusĬontextual menus replace Peek and Pop and change the focus from previewing to providing actions. In my limited testing, it seems that if you have both registered with a view the context menu wins on iOS 13. You’ll see warnings and suggestions to replace it with UIContextMenuInteraction when your minimum deployment target is iOS 13.0. Starting with iOS 13, the UIViewControllerPreviewing protocol used for peek and pop is deprecated. Apple never managed to add 3D Touch to the iPad and has dropped it from recent iPhone models. Unfortunately 3D Touch turned out to be a bit of a hardware dead-end. Actions are accessible by swiping up from the preview. The focus was on previewing (peeking at) content prior to transitioning (popping) to the destination view controller. Why The Change?Īpple introduced Peek and pop in iOS 9 with the launch of the iPhone 6S and 3D Touch. Here’s my guide to adding context menus to your App. They don’t depend on hardware support for 3D Touch so are available on all devices running at least iOS 13. Apple replaced Peek and Pop with context menus in iOS 13. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |