【问题标题】:UIActionSheet messes up shaking detection (motionBegan: delegate) on iPadUIActionSheet 搞砸了 iPad 上的抖动检测(motionBegan:delegate)
【发布时间】:2012-12-19 10:47:33
【问题描述】:

在我的应用程序中,我使用 UIActionSheet(没什么花哨的)并使用 showFromBarButtonItem: 呈现它(标准)并使用它的委托 clickedButtonAtIndex: 将其关闭。一切都简单而美好。我还使用 motionBegan: 来检测摇晃来做各种事情。

我的应用在 iPhone 上运行良好。

但是,在 iPad 上,一旦出现 actionSheet(一次),motionBegan: 就停止工作了!设备(模拟器)的任何晃动都不会注册!在 actionSheet 演示之前,所有的震动都很好。一旦出现,它就会停止。

我添加了一个 [actionSheetNav resignFirstResponder];在 actionSheet:clickedButtonAtIndex: 委托(如果这是一个问题)但没有效果。

有什么想法吗? (我可以发布代码,但即使(每个相关的)方法的第一个命令是 NSLog 并且之后立即返回,也没有任何效果)

【问题讨论】:

    标签: ipad uiactionsheet shake


    【解决方案1】:

    找到了!

    我只需要添加一个

        [self becomeFirstResponder];
    

    之后

        [actionSheetNav resignFirstResponder];
    

    actionSheet 委托中的行

    -(IBAction)actionSheet:(UIActionSheet *)sender clickedButtonAtIndex:(NSInteger)myButton
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多