iOS 研究工具包调查 (swift) [英] iOS research kit survey (swift)

查看:27
本文介绍了iOS 研究工具包调查 (swift)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为 ResearchKit 调查添加自定义背景?

how can I add a custom background to my ResearchKit survey?

我试过了:

taskViewController.view.backgroundColor = UIColor(patternImage: UIImage(named:imageName))

还有:

    taskViewController.view.backgroundColor = UIColor.clearColor()
    let backgroundImage = UIImage(named: "Background")
    let imageView = UIImageView(image: backgroundImage)
    taskViewController.view.addSubview(imageView)
    taskViewController.view.sendSubviewToBack(imageView)

推荐答案

各个步骤视图控制器都需要添加背景.有一个委托方法 taskViewController:stepViewControllerWillAppear:,您可以使用它在呈现之前拦截步骤视图控制器并根据需要修改其视图层次结构.很多步骤在其视图层次结构中包含表视图或滚动视图,您需要考虑这些.

The individual step view controllers will each need the background added. There is a delegate method taskViewController:stepViewControllerWillAppear:, which you can use to intercept the step view controller before presentation and modify its view hierarchy as needed. Nite that many of the steps include a table view or scroll view in their view hierarchy, which you would need to take into account.

如果您只想要背景颜色,您可以尝试使用 UIView AppearanceWhenContainedIn 来更改每个步骤视图控制器下方整个层次结构的背景颜色.

If all you want is background color, you could try using UIView appearanceWhenContainedIn to change background color on the whole hierarchy below each step view controller.

这篇关于iOS 研究工具包调查 (swift)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆