尤里卡表格:如何更改表格的整体色彩

时间:2018-08-10 03:29:02

标签: ios swift eureka-forms

我正在使用Eureka在我的项目中实现一个简单的表单。键盘上方的色带按钮中的表单似乎带有蓝色,我不确定如何更改它。

enter image description here

有没有办法像我的UI其余部分一样使“完成”标签变为绿色?

4 个答案:

答案 0 :(得分:3)

更新了Eureka 4.3.x

您应该在控制器中覆盖变量 customNavigationAccessoryView

override var customNavigationAccessoryView: (UIView & NavigationAccessory)? {
    // The width might not be correctly defined yet: (Normally you can use UIScreen.main.bounds)
    let navView = NavigationAccessoryView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 44.0))
    navView.barTintColor = UIColor.MaterialColors.category3
    navView.tintColor = UIColor.white
    return navView
}

在这里,您要修复完成标签的颜色。 将NaviagtionAccessoryView实例替换为下面的navigationAccessoryView

navigationAccessoryView.tintColor = "Your Colour"
navigationAccessoryView.backgroundColor = "Your Colour"
navigationAccessoryView.doneButton.tintColor = "Your Colour"

More Here

答案 1 :(得分:0)

您可以通过以下方式为所有UIView实例设置默认的颜色:

UIView.appearance().tintColor = .red

appearance()是UIAppearance协议中的一种方法。 UIView及其子类对此协议进行了确认。您也可以

UIButton.appearance().tintColor = .green

答案 2 :(得分:0)

在AppDelegate中添加以下行

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool 
{
   self.window?.tintColor = UIColor.black // You can set it to which color you want.
   return true
}

整个应用程序的所有色调都会更改为给定的颜色。

答案 3 :(得分:0)

这完全适合我:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    NavigationAccessoryView.appearance().tintColor = /* your color here */
}