Espina
Espina

Reputation: 83

Make custom item in UIActivityViewController icon colorful?

I follow the steps in How can I create a custom UIActivity in iOS? It works as expected. It looks like iOS force a metallic look&feel for all custom icons as well as its own "Bookmark", "Print", etc. Anyway to make my icon colorful?

Upvotes: 3

Views: 1847

Answers (2)

Paul
Paul

Reputation: 11

In iOS 10, set the activityCategory class property to .share. This will cause the activity icon to appear in color in the top row of the UIActivityViewController.

In your UIActivity subclass:

In iOS 10, set the activityCategory class property to .share. This will cause the activity icon to appear in color in the top row of the UIActivityViewController.

In your UIActivity subclass:

class MyCustomActivity: UIActivity
{
    ...

    override open class var activityCategory: UIActivityCategory
    {
        get
        {
            return UIActivityCategory.share;
        }
    }

    ...
}

Upvotes: 1

Bryan Luby
Bryan Luby

Reputation: 2567

As of iOS 6, it is not possible to do this.

All color data for the UIImage that is returned by UIActivity's activityImage method will be ignored.

Upvotes: 2

Related Questions