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"]];
    }
    
    

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

  • 相关阅读:
    数据库链接字符汇总
    CSS 继承深度解析
    autofac
    SmartStoreNet解图
    RPM ,DPKG ,YUM ,APT-GET
    ubuntu中查看各种设备和资源的命令汇总
    linux中一些常用的命令总结
    latex 插图排版
    matplotlib 出图示例
    latex 生成pdf
  • 原文地址:https://www.cnblogs.com/66it/p/4981666.html
Copyright © 2011-2022 走看看