【问题标题】:PresentViewController: animated not displaying on iPadPresentViewController:动画不显示在 iPad 上
【发布时间】:2015-09-03 16:27:46
【问题描述】:

我正在将 SLService for Twitter 集成到应用程序中。它在 iPhone 上运行良好,但在 iPad 上消失了。

我已经在 iPad 上集成:

  [actionSheet showFromRect:self.myRect inView:self.tableView animated:YES];

而不是:

 [actionSheet showInView:[UIApplication sharedApplication].keyWindow];

iPad有没有类似的方法代替presentViewContoller: Animated:

    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController
                                               composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:self.textForTweet];

        [self presentViewController:tweetSheet animated:YES completion:nil];
    } else [self displayAlertBoxWithTitle:@"Tweet Failed" message:@"Please try again later" cancelButton:@"Close"];
}

我应该改用模态对话框吗?

【问题讨论】:

  • 从 ios8 开始不推荐使用操作表吗?
  • 是的,UIActionSheets 已被弃用,但 SLComposeViewController 不是,这似乎是问题所在。
  • 萨赫布,你可能是在正确的轨道上。在这里找到答案:stackoverflow.com/a/24854803/1422252
  • 当我看到操作表时我就知道有些问题,直接呈现 SLVC 会产生好的结果,但在操作表上呈现它不会

标签: ios ipad modal-dialog presentviewcontroller


【解决方案1】:

一开始我错过了这个错误信息:

Warning: Attempt to present <SLComposeViewController: 0x175d6560>  on <ScheduleTableViewController: 0x17538c20> which is already presenting (null)

这导致我在不同的上下文中讨论相同的问题here

通过建议的解决方法解决了该问题:

dispatch_async(dispatch_get_main_queue(), ^ {
            [self presentViewController:tweetSheet animated:YES completion:nil];
        });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多