ユーザーが述語ナビゲーション ルールのステップで「スキップ」ボタンをクリックしたときにリダイレクトされるステップを指定するにはどうすればよいですか?
今のところ、タスクの開始にリダイレクトされます。
オプションの手順は次のとおりです。
// multiple choices question
let multipleQuestionsStepTitle = "what is your gender ?"
let textChoices = [ORKTextChoice(text: "Female", value: 0),
ORKTextChoice(text: "Male", value: 1),
ORKTextChoice(text: "idk", value: 2)]
let multipleQuestionsAnswerFormat: ORKTextChoiceAnswerFormat = ORKAnswerFormat.choiceAnswerFormatWithStyle(.SingleChoice, textChoices: textChoices)
let multipleQuestionsStep = ORKQuestionStep(identifier: "TextChoiceQuestionStep", title: multipleQuestionsStepTitle, answer: multipleQuestionsAnswerFormat)
multipleQuestionsStep.optional = true
steps += [multipleQuestionsStep]
ナビゲーション ルールは次のとおりです。
let task = ORKNavigableOrderedTask(identifier: "SurveyTask", steps: steps)
var predicateRule: ORKPredicateStepNavigationRule
let predicateFemale: NSPredicate = ORKResultPredicate.predicateForChoiceQuestionResultWithResultSelector(ORKResultSelector(resultIdentifier: "TextChoiceQuestionStep"), expectedAnswerValue: 0)
// invert of previous predicate
let predicateNotFemale: NSPredicate = NSCompoundPredicate.init(notPredicateWithSubpredicate: predicateFemale)
predicateRule = ORKPredicateStepNavigationRule.init(resultPredicates: [predicateNotFemale], destinationStepIdentifiers: ["IntroStep"], defaultStepIdentifier: "ImageChoiceQuestionStep", validateArrays: false)
task.setNavigationRule(predicateRule, forTriggerStepIdentifier: "TextChoiceQuestionStep")
このステップをスキップすると、 にリダイレクトされると思いますが、defaultStepIdentifier
ここではそうではありません。
ナビゲーション ルールがある場合にオプションを false に設定することに関するドキュメントは何も見つかりませんでした。