当前位置:网站首页>[Swift]自定义点击APP图标弹出的快捷方式
[Swift]自定义点击APP图标弹出的快捷方式
2022-07-31 03:21:00 【风浅月明】
开发中的APP,不做任何处理,点击弹出的快捷方式。
上线的APP,不做任何处理,点击弹出的快捷方式。
自定义快捷方式
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: "消息子标题", 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("进入消息")
}
}
}
边栏推荐
- [C language] General method of expression evaluation
- Day32 LeetCode
- With 7 years of experience, how can functional test engineers improve their abilities step by step?
- SQL injection Less46 (injection after order by + rand() Boolean blind injection)
- Thesis framework of the opening report
- 想从手工测试转岗自动化测试,需要学习哪些技能?
- 安全20220715
- $attrs/$listeners
- Why SocialFi achievement Web3 decentralized social in the future
- Difference between unallocated blocks and unused blocks in database files
猜你喜欢
![[C language] Three-pointed chess (classic solution + list diagram)](/img/64/18ed08b64f9618bbd7f24ee16e6a6f.jpg)
[C language] Three-pointed chess (classic solution + list diagram)

Problems that need to be solved in distributed system architecture

LeetCode每日一练 —— 138. 复制带随机指针的链表
![[C language] General method for finding the sum of the greatest common factor and the least common multiple of two integers m and n, the classical solution](/img/60/fa75e06af4d143ee3fb493221fa3d9.jpg)
[C language] General method for finding the sum of the greatest common factor and the least common multiple of two integers m and n, the classical solution

【C语言】预处理操作

Redis实现分布式锁

刚出道“一战成名”,安全、舒适一个不落

STM32问题合集

Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢

What is a system?
随机推荐
beforeDestroy与destroyed的使用
立足本土,链接全球 | 施耐德电气“工业SI同盟”携手伙伴共赴未来工业
SonarQube的BUG定义
Database implements distributed locks
浅识Flutter 基本组件之CheckBox组件
【异常】The field file exceeds its maximum permitted size of 1048576 bytes.
Addition and Subtraction of Scores in LeetCode Medium Questions
LocalDate加减操作及比较大小
Just debuted "Fight to Fame", safety and comfort are not lost
Redis 统计用户新增和留存
C primer plus学习笔记 —— 8、结构体
Redis implements distributed locks
LeetCode每日一练 —— 138. 复制带随机指针的链表
QML的使用
Annotation usage meaning
Difference between unallocated blocks and unused blocks in database files
Office automation case: how to automatically generate period data?
SIP Protocol Standard and Implementation Mechanism
【AUTOSAR-RTE】-4-Port和Interface以及Data Type
数据库文件中的未分配的块和未使用的块的区别