zoukankan      html  css  js  c++  java
  • 自定义iWatch App点击Glance后的跳转页

    最新版的在iWatch2.0中的点击Glance自定义的界面跳转

    到今天为止(2015年11月20日)的官方给出的方法是:

    当你的手表app上显示的快速信息浏览界面(Glance界面的时候),如果用户点击了这个界面,默认是跳转到手表app的主界面(也就是默认的InterfaceController界面的),但当你需要重新定义这个过程,希望可以跳转到你指定的界面的时候,按照下面的步骤:

    在Glance控制器中:

    • 定义glance,在init和willActivate方法
    • 在Glance被点击的时候(在willActivate方法中),调用updateUserActivity:userInfo:webpageURL:方法,并通过userInfo参数指定传输的信息,在界面跳转的时候,app就会跳转到你指定的界面

    例如:

    - (void)willActivate {
        // This method is called when the controller is about to be visible to the wearer.
        NSLog(@"%@ will activate", self);
    
        // Use Handoff to route the wearer to the image detail controller when the Glance is tapped.
        [self updateUserActivity:@"com.example.apple-samplecode.WatchKit-Catalog" userInfo:@{@"controllerName": @"imageDetailController", @"detailInfo": @"This is some more detailed information to pass."} webpageURL:nil];
    }
    
    

    在主控制器(InterfaceController)

    • 实现handleUserActivity:方法,使用提供的userInfo字典定义UI。
      例如:
    - (void)handleUserActivity:(NSDictionary *)userInfo {
        // Use data from the userInfo dictionary passed in to push to the appropriate controller with detailed info.
        [self pushControllerWithName:userInfo[@"controllerName"] context:userInfo[@"detailInfo"]];
    }
    
    

    好了,你再次运行试试看吧。

  • 相关阅读:
    ubuntu 下安装memcache 以及php扩展
    js控制页面显示和表单提交
    phpcms--使用添加php原生支持
    phpcms v9 升级视频云问题推荐位不能添加
    phpcms—— 内容中的附件调用和添加远程地址的调用
    phpcms--模型管理,推荐位管理,类别管理
    linux shell 编程
    css中的定位和框模型问题
    php生成静态文件
    打印机问题win7 和xp
  • 原文地址:https://www.cnblogs.com/66it/p/4981666.html
Copyright © 2011-2022 走看看