ios - 在菜单 View 中排序项目后丢失的项目
<p><p><code>UIActivity</code> 函数有问题。</p>
<p>首先,我创建了3个事件项:</p>
<ol>
<li><code>activityDownload</code></li>
<li><code>activityTrash</code></li>
<li><code>activityMove</code>.</li>
</ol>
<p>并添加到 <code>UIActivityViewController</code>
然后,当我展示包含上述 3 项的 <code>UIActivityViewController</code> 时。好的,这里没问题。
然后,当我单击“更多”按钮并对项目进行排序时,例如,我将“移动”按钮移到顶部,
单击“完成”按钮后,我不知道为什么下载,垃圾邮件丢失了?
移动项目仅显示在 AirDrop 菜单 View 中。</p>
<pre><code>NSURL *url = ;
NSArray *objectsToShare = @;
AirDropActivityView *activityDownload = [ init];
activityDownload.airDropType = 0;
AirDropActivityView *activityTrash = [ init];
activityTrash.airDropType = 1;
AirDropActivityView *activityMove = [ init];
activityMove.airDropType = 2;
NSArray *uiActivitys = @;
UIActivityViewController *controller = [ initWithActivityItems:objectsToShare applicationActivities:uiActivitys];
// Exclude all activities except AirDrop.
NSArray *excludedActivities = @;
controller.excludedActivityTypes = excludedActivities;
// Present the controller
;
</code></pre>
<p> <a href="https://gist.github.com/tranhieutt/f73999234339f31aa86c" rel="noreferrer noopener nofollow">https://gist.github.com/tranhieutt/f73999234339f31aa86c</a> </p>
<p>请看截图:</p>
<p> <a href="/image/yeRen.png" rel="noreferrer noopener nofollow"><img src="/image/yeRen.png" alt="enter image description here"/></a> </p>
<p> <a href="/image/w4AvB.png" rel="noreferrer noopener nofollow"><img src="/image/w4AvB.png" alt="enter image description here"/></a> </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>这可能是您使用的所有自定义 UIActivityView 具有相同的 <code>activityType</code> 会导致此问题。</p>
<p>所以我建议为您要使用的每个 View 创建更多的自定义 <code>UIActivity</code>。像这样:</p>
<p>创建<code>AirDropActivityView1</code>;
在<code>AirDropActivityView1.m</code>中,实现:</p>
<pre><code>#import "AirDropActivityView1.h"
@implementation AirDropActivityView
- (NSString *)activityType
{
return @"youapp.Activity1";
}
- (NSString *)activityTitle
{
return @"Activity1";
}
- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems
{
return YES;
}
@end
</code></pre>
<p>与 <code>AirDropActivityView2.m</code></p>
<pre><code> #import "AirDropActivityView2.h"
@implementation AirDropActivityView
- (NSString *)activityType
{
return @"youapp.Activity2";
}
- (NSString *)activityTitle
{
return @"Activity2";
}
- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems
{
return YES;
}
@end
</code></pre>
<p>最后:</p>
<pre><code> AirDropActivityView1 *activity1 = [ init];
AirDropActivityView2 *activity2 = [ init];
NSArray *uiActivitys = @;
</code></pre>
<p>现在您可以重新排序。
希望对您有所帮助。</p></p>
<p style="font-size: 20px;">关于ios - 在菜单 View 中排序项目后丢失的项目,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/34894040/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/34894040/
</a>
</p>
页:
[1]