要在应用内添加这些快速操作,您可以在应用中实现Peek and Pop
功能。
要集成qazxsw opi,您可以按照此tutsplus教程进行操作。
Peek and Pop
希望能帮助到你
您可以尝试我自己的库https://code.tutsplus.com/tutorials/ios-9-an-introduction-to-3d-touch--cms-25115,其外观和感觉与Apple的Quick Actions菜单相同。
它还没有3D Touch支持,但它可以帮助您呈现与提供者屏幕截图相同的操作列表。
首先你应该创建列表。
如果你想从ActionsList,UIButton
的UIBarButtonItem
展示它,有内置的方法来创建列表:
UITabBarItem
否则你应该使用// element is UIButton, UIBarButtonItem or UITabBarItem
let list = element.createActionsList()
结构:
ActionsListModel
然后向列表添加操作
let list = ActionsListModel(senderView: viewThatInitiatedListPresenting,
sourceView: viewToPresentListFrom,
delegate: listDelegate)
之后,您可以列出清单
list.add(action: ActionsListDefaultButtonModel(localizedTitle: "Create Alarm",
image: UIImage(named: "Alarm clock"),
action: { action in
// You can use action's list property to control it
// - To dismiss
action.list?.dismiss()
// - To update action appearance
action.appearance.//anything
// Do not forget to reload actions to apply changes
action.list?.reloadActions()
}))
list.present()
// Save list or it will be deallocated and not reachable outside of the scope it was created in
self.list = list