2016-10-25 8 views
0

私は、リサーチキットフレームワークを使用してSwiftでアプリを開発しています。アンケートに回答したユーザーは、ローカルデータベースに保存されています。ユーザが再びサーベイで開始したときに、以前に選択された回答を見ることができるように、アプリケーションに機能を実装する必要があります。 作成されたORKOrderedTaskのデフォルトの選択値を設定できますか?以下ResearchKitを使用して作成したアンケートアンケートで以前に選択した回答を表示

は、使用するコードスニペットです:

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) 

は、我々はオプションのデフォルト選択された値を設定することはできますか?

答えて

関連する問題