当前位置: 首页 > news >正文

贵州网站制作设计公司哪家好铜铜铜铜铜铜铜铜好大好深色

贵州网站制作设计公司哪家好,铜铜铜铜铜铜铜铜好大好深色,给上市公司做网站有什么用,高职网站建设专业书本文介绍使用Xcode15 建立快捷指令的Extension#xff0c;并描述如何修改快捷指令的IntentHandler#xff0c;带参数跳转主应用#xff1b;以及展示多个选项的快捷指令弹框(配置intentdefinition文件)#xff0c;点击选项带参数跳到主应用的方法 创建快捷指令 快捷指令是…本文介绍使用Xcode15 建立快捷指令的Extension并描述如何修改快捷指令的IntentHandler带参数跳转主应用以及展示多个选项的快捷指令弹框(配置intentdefinition文件)点击选项带参数跳到主应用的方法 创建快捷指令 快捷指令是一个项目的extension所以先要有一个ios项目 新建扩展 搜索Intent字段点击下图选中的 左边箭头勾中就会额外自动给快捷指令UI扩展 右边箭头选None 另一个选项是Messaging选中会使得 自动创建message发送功能的相关代码 选中根目录新建文件 新建文件类型中搜索Intent新建唯一搜索结果类型文件 新建文件的target membership需要全部都勾选 在这个新建文件里面定义快捷指令支持的动作Action点击加号点击new intent 新建的Intent按照需要重命名双击名字重命名 还有标题描述修改 配置Intent展示的属性 确认主应用和扩展的info.plist文件有配置Intent没有的话加上build一下 build你的项目xcode会根据添加的Intent生成对应的如下后缀的代码Handle类、 intent类、 Handling协议、Response类。 快捷指令逻辑 修改默认生成的IntentHandler如下划线和框住的都是添加代码其中response的属性show_name为上面配的属性。 这里的continueInApp枚举表示快捷指令是打开主应用 主应用获取快捷指令传参 下面是主应用被快捷指令打开在SceneDelegate获取传过来的参数 func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {if userActivity.activityType NSStringFromClass(MyIntentIntent.self) {var msg: String?if let response userActivity.interaction?.intentResponse as? MyIntentIntentResponse {msg response.show_name}let alert UIAlertController(title: 提示, message: 从快捷指令传递的消息\(msg ?? ), preferredStyle: .alert)alert.addAction(UIAlertAction(title: 确定, style: .default, handler: nil))// 显示弹框self.window?.rootViewController?.present(alert, animated: true, completion: nil)}}展示多项的快捷指令弹窗 这个弹窗在快捷指令中心 点击快捷指令后弹出点击里面的项可以带着参数跳到主应用 在 Intents.intentdefinition文件中 新建一个类型Topping(名字随便) response里面加上这个刚才定义类型的一个参数toping intent里面也加一个参数 myParamter 需要注意的是快捷指令弹窗标题是这里配置 build你的项目。会生成对应类还有属性 出现ToppingResolutionResult类 MyIntentIntentResponse类中会多出属性toping MyIntentIntent类会多出属性myParamter 下面是IntentHandler适配修改 class IntentHandler: INExtension, MyIntentIntentHandling {func resolveMyParamter(for intent: MyIntentIntent, with completion: escaping (ToppingResolutionResult) - Void) {guard let myParamter intent.myParamter else {completion(ToppingResolutionResult.disambiguation(with: DataManager.allTops()))return}completion(ToppingResolutionResult.success(with: myParamter))}func provideMyParamterOptionsCollection(for intent: MyIntentIntent, searchTerm: String?, with completion: escaping (INObjectCollectionTopping?, Error?) - Void) {completion(INObjectCollection(items: DataManager.allTops()), nil)}func handle(intent: MyIntentIntent, completion: escaping (MyIntentIntentResponse) - Void) {let userActivity NSUserActivity(activityType: NSStringFromClass(MyIntentIntent.self))let response MyIntentIntentResponse(code:.continueInApp,userActivity: userActivity)response.toping intent.myParamtercompletion(response)}func confirm(intent: MyIntentIntent, completion: escaping (MyIntentIntentResponse) - Void) {let response MyIntentIntentResponse(code:.ready,userActivity: nil)completion(response)}override func handler(for intent: INIntent) - Any {// This is the default implementation. If you want different objects to handle different intents,// you can override this and return the handler you want for that particular intent.return self}}数据获取类DataManager class DataManager : NSObject {static func allTops()- [Topping] {var tops:[Topping] []for i in 0..3{let top Topping(identifier: \(i), display: 啦啦啦\(i))tops.append(top)}return tops} } 同样在主应用中可以获取传过来的response里的Toping对象依次来获得传参 func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {if userActivity.activityType NSStringFromClass(MyIntentIntent.self) {var msg: String?if let response userActivity.interaction?.intentResponse as? MyIntentIntentResponse { // msg response.show_namemsg response.toping?.displayString ?? }let alert UIAlertController(title: 提示, message: 从快捷指令传递的消息\(msg ?? ), preferredStyle: .alert)alert.addAction(UIAlertAction(title: 确定, style: .default, handler: nil))// 显示弹框self.window?.rootViewController?.present(alert, animated: true, completion: nil)}}参考文档 官方文档,官方demo也可从此下载 https://developer.apple.com/documentation/sirikit/soup_chef_accelerating_app_interactions_with_shortcuts
http://www.hkea.cn/news/14281492/

相关文章:

  • 网站开发团队如何接活seo程序
  • wordpress 百度 tagseo网站排名优化教程
  • 网站建设发布实训总结wordpress仪表盘模块
  • qq整人网站怎么做分类信息网站建设
  • 给女朋友做的网站ideas wordpress theme 2.0
  • 网站空间的根目录给自己企业怎么做网站
  • 两个网站如何做端口映射安徽安庆区号
  • 网站建设 2015年11月注册商标设计
  • 网站维护包括资料库网站开发报价
  • 大宗商品价格查询网站我的世界充钱网站怎么做
  • 商业网络大型网站技术架构演进与性能优化
  • 响应式网站制作软件唐河微网站建设
  • 小程序可以用手机网站吗谷歌企业网站seo
  • app应用网站单页模板网站开发模块的需求分析
  • 邢台做网站优化哪儿好动漫设计视频
  • 网站建设广告平台推广花店网站模板
  • 网站控制大型电子商务网站需要配服务器
  • 淘宝cms建站网站建设哪便宜
  • 网站首页推荐网站关键词分隔符
  • 上国外的网站很慢四川网站建设网站制作
  • 自动采集更新网站源码创新的医疗网站建设
  • 好看的网站设计深圳整装装修公司排名
  • 网站地图设计网站如何买空间
  • 餐饮公司网站模板下载网站自动提交收录
  • 刘家窑网站建设阿里巴巴运营教程
  • wordpress建站入门泗阳网站建设
  • 中小学校园网站建设html编辑器在线
  • 建设大淘客网站网页美工设计的四大原则
  • wordpress 修改入口文件博客可以做seo吗
  • 物流公司网站 源码视频网站前台怎么做