Ios 如何在Research Kit中的Taskviewcontroller中添加背景图像?
它崩溃是因为“无法将自身添加为子视图”,我也尝试了其他方法,看到了一些链接,但无法设置背景图像答案,只有设置背景颜色的答案,但我想在taskviewController中添加背景图像Ios 如何在Research Kit中的Taskviewcontroller中添加背景图像?,ios,swift,researchkit,Ios,Swift,Researchkit,它崩溃是因为“无法将自身添加为子视图”,我也尝试了其他方法,看到了一些链接,但无法设置背景图像答案,只有设置背景颜色的答案,但我想在taskviewController中添加背景图像 func taskViewController(_ taskViewController: ORKTaskViewController, stepViewControllerWillAppear stepViewController: ORKStepViewController) { let backgro
func taskViewController(_ taskViewController: ORKTaskViewController, stepViewControllerWillAppear stepViewController: ORKStepViewController) {
let backgroundImage = UIImage(named: "setting_background_new")
let imageView = UIImageView(image: backgroundImage)
imageView.frame = CGRect(x: 0, y: 0, width: 100, height: 200)
UIView.appearance(whenContainedInInstancesOf: [ORKTaskViewController.self]).addsubview(imageview)
}