【问题标题】:Displaying previously selected answers in the survey questionnaire created using ResearchKit在使用 ResearchKit 创建的调查问卷中显示先前选择的答案
【发布时间】:2016-10-25 05:34:49
【问题描述】:

我正在使用研究工具包框架在 Swift 中开发应用程序。用户在进行调查时给出的答案被保存在本地数据库中。需要在应用程序中实现一个功能,这样当用户再次开始调查时,他可以查看之前选择的答案。 我们可以为创建的 ORKOrderedTask 设置默认选择值吗?

下面是sn-p使用的代码:

var steps = [ORKStep]()
let questQuestionStepTitle = "What is your quest?"
let textChoices = [
    ORKTextChoice(text: "Create a ResearchKit App", value: 0),
    ORKTextChoice(text: "Seek the Holy Grail", value: 1),
    ORKTextChoice(text: "Find a shrubbery", value: 2)]
let questAnswerFormat: ORKTextChoiceAnswerFormat =     ORKAnswerFormat.choiceAnswerFormatWithStyle(.SingleChoice, textChoices: textChoices)
let questQuestionStep = ORKQuestionStep(identifier: "TextChoiceQuestionStep", title: questQuestionStepTitle, answer: questAnswerFormat)
steps += [questQuestionStep]
return ORKOrderedTask(identifier: "SurveyTask", steps: steps)

我们可以为选项设置默认选择值吗?

【问题讨论】:

    标签: ios swift researchkit


    【解决方案1】:

    https://github.com/ResearchKit/ResearchKit/issues/689

    使用解决方案 2。 具体来说,继承有序类并覆盖 stepAfterStep。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-03
      • 2021-05-05
      • 1970-01-01
      • 2018-09-15
      • 1970-01-01
      • 2012-07-24
      相关资源
      最近更新 更多