刚刚下载了我的xcode 5副本,想知道是否有人知道如何更改日期选择器中字体的颜色或大小?
我一直在设置UIDatePicker 字体和颜色时遇到麻烦.我的应用程序中的其他所有内容都非常简单,除此之外.有人知道怎么做这个吗?我正在使用Swift for iOS8.

我有一个viewControllera UIPickerView和a UIDatePicker,storyboard如下面的截图所示.
我尝试添加属性运行时所解释这里.但是它只是改变了最初突出显示的文本的字体颜色.我想将pickerView和datePicker中的文本颜色更改为白色.我不知道如何实现它.
如何从 NSPopover 中删除箭头?
你能帮我个忙吗?
应用程序委托:
import Cocoa
import SwiftUI
@main
class AppDelegate: NSObject, NSApplicationDelegate {
var popover = NSPopover.init()
var statusBar: StatusBarController?
@Environment(\.colorScheme) var colorScheme
@ObservedObject var userPreferences = UserPreferences.instance
func applicationDidFinishLaunching(_ aNotification: Notification) {
let contentView = ContentView()
popover.contentSize = NSSize(width: 560, height: 360)
popover.contentViewController = NSHostingController(rootView: contentView)
statusBar = StatusBarController.init(popover)
DistributedNotificationCenter.default.addObserver(self, selector: #selector(interfaceModeChanged(sender:)), name: NSNotification.Name(rawValue: "AppleInterfaceThemeChangedNotification"), object: nil)
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
@objc func interfaceModeChanged(sender: NSNotification) …Run Code Online (Sandbox Code Playgroud) 我已UIDatePicker以编程方式创建并添加到UITableViewCell. 一切正常,但日期颜色即使在应用后也没有改变tintColor。
我的实现是:
var startDatePicker: UIDatePicker = {
let datePicker = UIDatePicker()
datePicker.timeZone = NSTimeZone.local
datePicker.backgroundColor = UIColor.clear
datePicker.layer.cornerRadius = 5.0
datePicker.datePickerMode = .date
datePicker.maximumDate = Date()
datePicker.isHidden = true
datePicker.tintColor = UIColor.white
datePicker.tag = 0
datePicker.addTarget(self, action: #selector(datePickerValueChanged(datePicker:)), for: .valueChanged)
return datePicker
}()
Run Code Online (Sandbox Code Playgroud)
我想以白色显示,但它以默认黑色 显示。另请参阅屏幕截图。
我看到了这个问题,但它在 SwiftUI 中不起作用。我使用了 .forgroundColor 和 .accentColor 但它们不会改变文本的颜色。
ios ×3
uidatepicker ×3
datepicker ×2
swift ×2
swiftui ×2
fonts ×1
ios7 ×1
macos ×1
nspopover ×1
popover ×1
swift3 ×1
swift4 ×1
uipickerview ×1
xcode5 ×1