【问题标题】:WKInterfaceButton IBAction is sending nil senderWKInterfaceButton IBAction 正在发送 nil 发件人
【发布时间】:2023-03-14 03:15:01
【问题描述】:
2015-05-02 23:56:34.047 TapIt WatchKit Extension[1398:18615] b: <WKInterfaceButton: 0x6080000580c0>
2015-05-02 23:56:34.048 TapIt WatchKit Extension[1398:18615] sender: (null)

- (IBAction)tapped:(id)sender {
    bool success = false;
    NSLog(@"b: %@", b);
    NSLog(@"sender: %@", sender);

为什么这是零?

【问题讨论】:

    标签: ios watchkit wkinterfaceobject


    【解决方案1】:

    WatchKit 操作不包含发送者作为参数。这就是您看到nil 的原因。在这种情况下,您的方法实际上应该只是 - (IBAction)tapped

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 2023-03-26
      • 2014-11-18
      • 2012-12-24
      • 1970-01-01
      • 1970-01-01
      • 2020-06-14
      相关资源
      最近更新 更多