UIActivityViewController上没有关闭按钮 [英] Lack of a close button on UIActivityViewController
问题描述
我目前正在为iOS应用程序做一些更新。对于更新,我将利用iOS6功能。我正在使用UIActivityViewController完成此操作以及一些自定义UIActivity活动。我遇到的主要问题是没有取消或关闭按钮。退出活动视图的唯一方法是,您要么将某些内容发布到社交网络,要么就像您要去的那样然后取消。
I am currently doing some updates for an iOS application. For the update I am going to take advantage of iOS6 capabilities. I am using a UIActivityViewController to get this done as well as some custom UIActivity activities. The main issue I am having is that there is no "Cancel" or "Close" button. The only way you can exit out of the activity view is if you either post something to a social network, or act like you are going to and then cancel.
NSArray* dataToShare = [[NSArray alloc] initWithObjects:@"blah", nil];
// Custom activities are allocated here
NSArray* customActivities = [[NSArray alloc] initWithObjects:activities, nil];
NSArray* excludedActivities = [[NSArray alloc] initWithObjects:exclusions, nil];
activityController = [[UIActivityViewController alloc] initWithActivityItems:formatArray applicationActivities:customActivities];
activityController.excludedActivityTypes = excludedActivities;
activityController.modalPresentationStyle = UIModalPresentationFormSheet;
[[UIApplication sharedApplication].keyWindow addSubview:self.view];
[[UIApplication sharedApplication].keyWindow bringSubviewToFront:activityController.view];
[self presentViewController:activityController animated:YES completion:^{ closureCode
}];
在网络内容方面,我做了活动控制器内部所需的一切,我只是不喜欢我有一个关闭按钮。我不知道它是否是同一个问题,但当视图消失时,如果我再试一次我的分享菜单,它会告诉我
This does everything that I need inside of the activity controller in terms of networking content, I just don't have a close button. I don't know if it is the same issue but when the view disappears if I try to bring one up my "Share" menu again it tells me
<UIActivityViewController: 0x1e0db7d0> on <ShareDelegate: 0x1e048490> which is already presenting <UIActivityViewController: 0x21b1d4f0>
想法?提前致谢!
*我正在使用:
- iPad 2
- Objective-C / C ++
- XCode 4.5
- iOS6
- iPad 2
- Objective-C/C++
- XCode 4.5
- iOS6
推荐答案
来自 UIActivityViewController
的文档(重点是我的):
From the docs for UIActivityViewController
(emphasis is mine):
在呈现视图控制器时,必须使用适当的方法为当前设备执行此操作。 在iPad上,您必须在弹出框中显示视图控制器。在iPhone和iPod touch上,您必须以模态方式显示它。
When presenting the view controller, you must do so using the appropriate means for the current device. On iPad, you must present the view controller in a popover. On iPhone and iPod touch, you must present it modally.
在iPad上,用户点击弹出窗口将取消弹出框。
On the iPad, the popover will be cancelled by the user tapping outside of the popover.
在iPhone / iPod touch上,模态视图控制器将用取消按钮显示。
On the iPhone/iPod touch, the modal view controller will be shown with a cancel button.
简而言之,不要在iPad上使用表格。
In short, don't use a form sheet on the iPad.
这篇关于UIActivityViewController上没有关闭按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!