ios - 更改研究套件的 UILabel 颜色

标签 ios swift uiview healthkit researchkit

我正在尝试更改 Apple Research 套件的标签、图像等的默认颜色,但没有取得任何成功。

有配置吗?我需要在 AppDelegate.h 中更改它吗?您能否分享一个代码示例。

我不确定如何使用“appearanceWhenContainedInInstancesOfClasses”。

Set tint color at UIView
UIView.appearanceWhenContainedInInstancesOfClasses([ORKTaskViewController.self]).tintColor = UIColor().darkPurple

最佳答案

对用于调用任务的 View Controller 使用以下内容。色调颜色应相应改变。要更改配色方案,请在任务完成执行后调用它。您的 ORKConsentDocument 动画和其他任务现在将具有与您选择的颜色相同的色调。

    UIView.appearance().tintColor = UIColor.blue 

    // Code to do present task 

    present(taskViewController, animated: true, completion: nil)

  // in extension 

   func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskViewControllerFinishReason, error: Error?) {

    //Handle results with taskViewController.result

    taskViewController.dismiss(animated: true, completion: nil)

    UIView.appearance().tintColor = UIColor.red 

假设红色是您的默认颜色。

关于ios - 更改研究套件的 UILabel 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46946176/

相关文章:

ios - UIPageControl 中的 pageIndicatorTintColor 在 iOS7 中保持半透明白色

arrays - Swift:改变结构中的数组

ios - 图像未显示在表格 View 中

ios - 如何将百分比值精确舍入到小数点后两位双倍?

ios - 在动画完成之前调用 UIView 动画完成

iphone - View 层次结构刷新时序

ios - UIButton 宽度是 UIView 宽度的 50% iOS

android - 如何在 React Native 中的两点之间画一条线?

ios - 使用 AFNetworking 在异步模式下调整 UIImage 的大小

iOS 本地通知在锁屏时不播放声音