UIActivity activityViewController不会在iPad上解散 [英] UIActivity activityViewController not dismissing on iPad
问题描述
我有一个 UIActivity
子类,它创建了自己的 activityViewController
:
I have a UIActivity
subclass that creates its own activityViewController
:
- (UIViewController *)activityViewController {
WSLInProgressViewController* progressView = [[[WSLInProgressViewController alloc] init] autorelease];
progressView.message = [NSString stringWithFormat:NSLocalizedString(@"Posting to %@...",@"Posting to..."),
self.activityType];
return progressView;
}
我添加了一个完整的重新登录GitHub 。
根据文档,你不是'我应该手动解雇这个。相反,操作系统会在您调用 activityDidFinish:
时执行此操作。这在iPhone上运行时效果很好。
According to the documentation, you aren't supposed to dismiss this manually. Instead, the OS does that when you call activityDidFinish:
. This works fine when ran on an iPhone.
当我说工作时,这是我期待的事件序列(并在iPhone上看到):
When I say "works," this is the sequence of events that I'm expecting (and see on the iPhone):
- 显示
UIActivityViewController
- 用户按我的自定义活动
- 我的视图控制器出现
- 我打电话给
activityDidFinish:
- 我的自定义视图控制器被解除
-
UIActivityViewController
也被解雇
- Display the
UIActivityViewController
- User presses my custom activity
- My view controller appears
- I call
activityDidFinish:
- My custom view controller is dismissed
- The
UIActivityViewController
is also dismissed
然而,当我在iPad模拟器上运行相同的代码时 - 唯一的区别是我把 UIActivityViewController
在弹出窗口中,正如文档所说 - activityViewController
永远不会解散。
However, when I run this same code on the iPad Simulator -- the only difference being that I put the UIActivityViewController
in a popup, as the documentation says you should -- the activityViewController
never dismisses.
正如我所说,这是代码wo / popUP 在iPhone上工作,我已经完成了代码,所以我知道 activityDidFinish:
正在调用。
As I say, this is code wo/the popUP works on the iPhone and I have stepped through the code so I know that activityDidFinish:
is getting called.
我发现了他的雷达谈论 iOS6
beta 3 中的同样问题,但似乎这个基本功能,我怀疑我的代码而不是操作系统中的错误(也注意它与Twitter和Facebook功能正常工作!)。
I found this Radar talking about the same problem in iOS6
beta 3, but it seems such fundamental functionality that I suspect a bug in my code rather than OS (also note that it works correctly with the Twitter and Facebook functionality!).
我错过了什么吗?当它在 UIPopoverViewController
中运行时,我是否需要在activityViewController中做一些特殊的事情? iPad上的流假设是不同的吗?
Am I missing something? Do I need to do something special in the activityViewController when it's run in a UIPopoverViewController
? Is the "flow" supposed to be different on the iPad?
推荐答案
只会出现自动解雇当你的'活动'控制器被直接呈现而不包含在任何东西中时发生。所以在显示弹出窗口之前,添加一个完成处理程序
The automatic dismissal only appears to happen when your 'activity' controller is directly presented, not wrapped in anything. So just before showing the popup it's wrapped in, add a completion handler
activity.completionHandler = ^(NSString *activityType, BOOL completed){
[self.popup dismissPopoverAnimated:YES];
};
你会很好。
这篇关于UIActivity activityViewController不会在iPad上解散的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!