当前位置:网站首页>[Swift] Customize the shortcut that pops up by clicking the APP icon
[Swift] Customize the shortcut that pops up by clicking the APP icon
2022-07-31 03:32:00 【The wind is light and the moon is bright】
开发中的APP,不做任何处理,Click the shortcut that pops up.
上线的APP,不做任何处理,Click the shortcut that pops up.
自定义快捷方式
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
setupShortcutItems()
}
import Foundation
extension AppDelegate {
func setupShortcutItems() {
let searchIcon = UIApplicationShortcutIcon(type: .search)
let searchItem = UIApplicationShortcutItem(type: "search", localizedTitle: "搜索", localizedSubtitle: nil, icon: searchIcon, userInfo: nil)
let messageIcon = UIApplicationShortcutIcon(type: .message)
let messageItem = UIApplicationShortcutItem(type: "message", localizedTitle: "消息", localizedSubtitle: "Message subtitle", icon: messageIcon, userInfo: nil)
UIApplication.shared.shortcutItems = [searchItem, messageItem]
}
func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
if (shortcutItem.type == "search") {
print("进入搜索")
} else if (shortcutItem.type == "message") {
print("incoming message")
}
}
}
边栏推荐
- The els block moves the boundary to the right, and accelerates downward.
- Detailed explanation of TCP and UDP
- Distributed locks and three implementation methods
- Unity2D 自定义Scriptable Tiles的理解与使用(四)——开始着手构建一个基于Tile类的自定义tile(下)
- QML的使用
- [Compilation principle] Lexical analysis program design principle and implementation
- IIR滤波器和FIR滤波器
- 【CocosCreator 3.5】CocosCreator get network status
- errno错误码及含义(中文)
- 日志级别 和 打印log注意
猜你喜欢

TCP和UDP详解

5. How does the SAP ABAP OData service support the $filter operation

IDEA comment report red solution

TCP详解(三)

7年经验,功能测试工程师该如何一步步提升自己的能力呢?
![[Compilation principle] Design principle and implementation of recursive descent parsing](/img/51/cd054a8246dc108520d6ff9ea26c60.png)
[Compilation principle] Design principle and implementation of recursive descent parsing

从滴滴罚款后数据治理思考

递归查询单表-单表树结构-(自用)

VS QT——ui不显示新添加成员(控件)||代码无提示

「 每日一练,快乐水题 」1331. 数组序号转换
随机推荐
Mysql 45 study notes (twenty-four) MYSQL master-slave consistency
Based on the local, linking the world | Schneider Electric "Industrial SI Alliance" joins hands with partners to go to the future industry
What is a system?
Database implements distributed locks
CloudCompare&PCL 计算两个点云之间的重叠度
进程间通信
web容器及IIS --- 中间件渗透方法1
SIP协议标准和实现机制
Redis implements distributed locks
7年经验,功能测试工程师该如何一步步提升自己的能力呢?
安全20220709
顺序表的实现
遗留系统的自动化策略
【编译原理】递归下降语法分析设计原理与实现
SocialFi 何以成就 Web3 去中心化社交未来
接口测试关键技术
【动态规划】连续子数组的最大和
2022 Nioke Multi-School League Game 4 Solution
RESTful api接口设计规范
SIP Protocol Standard and Implementation Mechanism