iOS UIActivityViewController自定义分享配置

iOS 7

  1. Image background:

Image background should be transparent.

  1. image opaqueness

The "visible part" of the icon should be non transparent aka opaque. Note that any color informationwon't be preserved:

  1. image size

Because the image won't be scaled by the system if too small/big, you have to provide appropriately sized image. I found image size 120px x 120px to fit perfectly.

Note: this size also takes icon padding into account.


iOS 8

  1. Image background:

Image background should be white to match the system UIAction icons.

  1. image opaqueness

Same as in iOS 7, "visible" part of the icon should be non transparent aka opaque, however in iOS 8color information will be preserved.

  1. image size

I am using image with size 240px x 240px, but you can apply custom sized image because system will automatically scalle-to-fill image if too small/big.


Wrap up

That said, if you want to support both iOS 7 and iOS 8, you have to have 2 versions of custom UIActivity icon image.

For iOS 7 you should use 120px x 120px sized image with transparent backgroundNote: find the size that best suits your needs.

For iOS 8 you should use custom sized square image with white background and "visible" part of an arbitrary colour.

Code example

#define isAtLeastiOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)


- (UIImage *)activityImage
{
    if (isAtLeastiOS8)
    {
        return [UIImage imageNamed:@"activity_icon_ios8"];
    }
    else
    {
        return [UIImage imageNamed:@"activity_icon"];
    }
}

Hope that helps!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值