【问题标题】:Changing UILabel color for Research kit更改研究套件的 UILabel 颜色
【发布时间】:2017-10-26 05:03:01
【问题描述】:

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

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

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

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

【问题讨论】:

    标签: ios swift uiview healthkit researchkit


    【解决方案1】:

    对用于调用任务的视图控制器使用以下内容。色调颜色应相应改变。要更改配色方案,请在任务完成后调用它。您的 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 
    

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

    【讨论】:

      猜你喜欢
      • 2015-12-29
      • 2013-05-17
      • 1970-01-01
      • 1970-01-01
      • 2015-09-01
      • 1970-01-01
      • 2011-02-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多