When pick&pop view is presented, custom actions (UIPreviewAction
objects) are shown in default iOS blue color.
Is there any way they can be tinted in different color?
For iOS 11, what seems to work is adding in didFinishLaunchingWithOptions
:
UIApplication.sharedApplication.delegate.window.tintColor = MY_COLOR
I'm not sure if the same approach would work for pre-iOS11 versions, but here is what worked for me for pre-iOS11:
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 = YOUR_COLOR;
}
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;
}