Заголовок навигации не отображается в ResearchKit

Как вы отображаете заголовок TaskViewController в наборе исследований? Я пробовал следующее, и это, кажется, не появляется, хотя другие свойства могут быть установлены таким образом.

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

Я также попробовал taskViewController.title = "TITLE".

1 ответ

Решение

Вам нужно выполнить два шага:

1) Отключить заголовок прогресса:

taskViewController.showsProgressInNavigationBar = NO;

2) Внедрить и установить delegate за ORKTaskViewController:

- (void)taskViewController:(ORKTaskViewController *)taskViewController stepViewControllerWillAppear:(ORKStepViewController *)stepViewController {
    stepViewController.title = @"Your title";
}
Другие вопросы по тегам