导航标题未显示在ResearchKit中

时间:2016-08-26 15:06:16

标签: ios swift researchkit

如何在Research Kit中显示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 个答案:

答案 0 :(得分:3)

您需要执行两个步骤:

1)关闭进度标题:

taskViewController.showsProgressInNavigationBar = NO;

2)为delegate实施并设置ORKTaskViewController

- (void)taskViewController:(ORKTaskViewController *)taskViewController stepViewControllerWillAppear:(ORKStepViewController *)stepViewController {
    stepViewController.title = @"Your title";
}