带有自定义 UIActivity 的 UIActivityViewController 将彩色图像显示为灰色 [英] UIActivityViewController with custom UIActivity displays color image as gray

查看:31
本文介绍了带有自定义 UIActivity 的 UIActivityViewController 将彩色图像显示为灰色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义 UIActivity 以显示在共享表中.我创建了一个全彩色的 60x60 图标(png 文件),但是当它显示时它只以灰色显示轮廓.我看不出我写错了什么.我希望有人看到我错过的东西.任何帮助将不胜感激.这是我的代码...

I created a custom UIActivity to display in a share sheet. I created an 60x60 icon (png file) in full color, but when it's displayed it only shows the outline in gray. I don't see what I've written incorrectly. I hope someone sees what I've missed. Any help will be greatly appreciated. Here is my code...

@implementation MyActivity

#pragma mark - Overrides
- (NSString *)activityType {
    return @"MyType";
}

- (NSString *)activityTitle {
    return @"ShareMe";
}

- (UIImage *)activityImage {
    return [UIImage imageNamed:@"MyIcon_60x60.png"];
}

- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems {
    return YES;
}

- (void)prepareWithActivityItems:(NSArray *)activityItems {
    // Do Something
}

+ (UIActivityCategory)activityCategory {
    return UIActivityCategoryShare;
}

@end

推荐答案

尝试在子类 UIActivity 类中的方法中添加下划线

Try adding an underscore to the method in the subclassed UIActivity class

- (UIImage *)_activityImage {}

虽然你失去了圆形的灰色边界框

You lose the rounded grey bounding box though

这篇关于带有自定义 UIActivity 的 UIActivityViewController 将彩色图像显示为灰色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆