mixtly87 mixtly87 - 1 year ago 132
iOS Question

How to tint peek&pop custom actions?

When pick&pop view is presented, custom actions (

objects) are shown in default iOS blue color.
Is there any way they can be tinted in different color?

Answer Source

Here's how I solved it in the end:

in viewWillAppear method of a preview controller (viewController which implements previewActionItems method add:

- (void) viewWillAppear:(BOOL)animated
    [super viewWillAppear:animated];
    UIView* container = [self.view superviewOfClass:NSClassFromString(@"_UIVisualEffectContentView")];
    container.tintColor = [CDThemeManager sharedTheme].colorPrimaryActive;

The superviewOfClass method is implemented in UIView+MyUtils category:

- (UIView*) superviewOfClass:(Class)c
    UIView* parent = self;
    while ((parent = parent.superview))
        if ([parent isKindOfClass:c])
            return parent;
    return nil;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download