1

How do you display the title of a TaskViewController in Research Kit? I've been trying the following and it doesn't seem to be showing up, although other properties can be set in this way.

    let taskViewController = ORKTaskViewController(task: ConsentTask, taskRunUUID: nil)
    taskViewController.navigationBar.topItem!.title = "TITLE"
    taskViewController.restorationIdentifier = "1"
    taskViewController.delegate = self
    presentViewController(taskViewController, animated: true, completion: nil)

I have also tried taskViewController.title = "TITLE".

1 Answers1

2

You need to perform two steps:

1) Turn off the progress title:

taskViewController.showsProgressInNavigationBar = NO;

2) Implement and set a delegate for ORKTaskViewController:

- (void)taskViewController:(ORKTaskViewController *)taskViewController stepViewControllerWillAppear:(ORKStepViewController *)stepViewController {
    stepViewController.title = @"Your title";
}
Ricardo Sanchez-Saez
  • 9,466
  • 8
  • 53
  • 92
Yuan
  • 133
  • 4