唯一的选项是:是否可以更改UIPreviewAction颜色?对于造型我在API中看到
- UIPreviewActionStyleDefault
- UIPreviewActionStyleSelected,
- UIPreviewActionStyleDestructive
是否有可能以某种方式绘制的按钮另一种颜色?我们的设计师真的不喜欢默认的蓝色按钮
唯一的选项是:是否可以更改UIPreviewAction颜色?对于造型我在API中看到
是否有可能以某种方式绘制的按钮另一种颜色?我们的设计师真的不喜欢默认的蓝色按钮
否视图 - 控制,它是无法在UIPreviewAction中更改按钮颜色。即使您添加彩色图像,它也会切换为默认的蓝色。
您可以在下方加入这些片段为它实现UIPreviewAction
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
UIView *containerView = [self.view superviewOfClass:NSClassFromString(@"_UIVisualEffectContentView")];
containerView.tintColor = YOUR_CUSTOM_COLOR;
}
在一个UIView类
- (UIView *)superViewOfClass:(Class)class {
UIView *parent = self;
while ((parent = parent.superview)) {
if ([parent isKindOfClass:class]) {
return parent;
}
}
return nil;
}
呀,我想我宁愿不使用这些解决方案。 iOS更新很容易中断。但是,谢谢 –
试试这个:
myPreviewAction.tintColor = myColor
有了这个UIPreviewAction扩展:
extension UIPreviewAction {
var tintColor: UIColor? {
get {
return value(forKey: "_color") as? UIColor
}
set {
setValue(newValue, forKey: "_color")
}
}
}
我认为这是回答[这里](http://stackoverflow.com/a/26770557/790842) – iphonic