iOS 共享扩展未显示我的自定义 ShareViewController
<p><p>我似乎无法展示我的自定义 ShareViewController。我继承了 UIViewController,而不是 SLComposeViewController,将它添加到 Storyboard,但是当我选择要共享的图像时,ShareViewController 不显示。这是我的完整代码:</p>
<p>头文件:</p>
<pre><code>#import <UIKit/UIKit.h>
#import <Social/Social.h>
@interface ShareViewController : UIViewController
@end
</code></pre>
<p>实现文件:</p>
<pre><code>@implementation ShareViewController
- (void)viewDidLoad{
;
self.view.alpha = 0;
}
- (void)viewWillAppear:(BOOL)animated
{
;
self.view.transform = CGAffineTransformMakeTranslation(0, self.view.frame.size.height);
[UIView animateWithDuration:0.25 animations:^
{
self.view.transform = CGAffineTransformIdentity;
}];
}
- (void)dismiss
{
[UIView animateWithDuration:0.20 animations:^
{
self.view.transform = CGAffineTransformMakeTranslation(0, self.view.frame.size.height);
}
completion:^(BOOL finished)
{
;
}];
}
-(void)viewDidAppear:(BOOL)animated {
;
for (NSItemProvider* itemProvider in ((NSExtensionItem*)self.extensionContext.inputItems).attachments )
{
if()
{
[itemProvider loadItemForTypeIdentifier:@"public.image" options:nil completionHandler:
^(id<NSSecureCoding> item, NSError *error)
{
UIImage *sharedImage = nil;
if([(NSObject*)item isKindOfClass:])
{
sharedImage = ];
}
if([(NSObject*)item isKindOfClass:])
{
sharedImage = (UIImage*)item;
}
}];
}
}
}
@end
</code></pre>
<p>Breakpoint 表示运行时确实执行代码,甚至抓取图像,但由于某种原因没有呈现自定义 ViewController 。有什么帮助吗?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>这太愚蠢了,我花了一段时间才弄明白,但由于某种原因,默认情况下,自定义 ShareViewControllerView 的背景颜色设置为 。非常愚蠢的苹果:),但我解决了这个案子</p></p>
<p style="font-size: 20px;">关于iOS 共享扩展未显示我的自定义 ShareViewController,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/37326643/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/37326643/
</a>
</p>
页:
[1]