【问题标题】:Force Touch Menu Action not firing强制触摸菜单操作未触发
【发布时间】:2016-08-18 21:49:10
【问题描述】:

我在 Storyboard 中添加了一个菜单,但由于某种原因,当我连接 IBActions 并进行深按时,控制台上绝对没有任何记录

- (IBAction)doMenuItemAction 
{
 NSMutableArray *smallArray = [self.Array objectAtIndex:0];
 [self.dataArray addObject:smallArray];
 NSLog(@"%d", self.dataArray.count);
 [self sendDataArrayToTheWatch]; 
}

【问题讨论】:

  • 您在IBAction 中有NSLog 或类似名称吗?需要一些代码,最好是用最少的代码复制问题的新项目。
  • @4oby 这是我的代码 - (IBAction)doMenuItemAction { NSMutableArray *smallArray = [self.Array objectAtIndex:0]; [self.dataArray addObject:smallArray]; NSLog(@"%d", self.dataArray.count); [self sendDataArrayToTheWatch]; }
  • 你的数组可以是self.dataArray == nil,确保IBAction被调用,添加断点,或者NSLog(@"TheMenuItemActionHappened"),还有一件事,手表是否显示强制触摸菜单?
  • @4oby 它甚至没有记录 nil
  • @4oby 成功了!只是浅按和深按之间的混淆。

标签: objective-c watchkit apple-watch watchos-2


【解决方案1】:

好的,这是一个工作示例项目

https://github.com/4oby/AppleWatchForceMenuExample

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-08
    • 2021-11-01
    • 1970-01-01
    相关资源
    最近更新 更多