如何在 ResearchKit 调查中删除 'cancel button'
How to remove 'cancel button' in a ResearchKit survey
我做了一个包含 11 个步骤的 ResearchKit 调查,但我想删除每个问题底部的默认取消按钮。
我遇到过这个命令:
stepViewController.cancelButtonItem = nil;
但是我好像找不到合适的地方。
谢谢。
正确的位置应该在委托回调中。文档说明 "The cancel button item is updated during view loading and when the value of the step
property is changed, but is safe to set in the taskViewController:stepViewControllerWillAppear:
delegate callback."
举个例子:
func taskViewController(_ taskViewController: ORKTaskViewController, stepViewControllerWillAppear stepViewController: ORKStepViewController) {
stepViewController.cancelButtonItem = nil
}
话虽如此,根据其回购中的这些问题,目前最新版本的 ResearchKit 中的功能似乎已被破坏。
https://github.com/ResearchKit/ResearchKit/issues/1273
它目前会禁用取消按钮的功能,但不会从 ORKNavigationContainer 中正确删除该按钮。如果您找到解决方案,请告诉我,这个问题已经在他们的回购协议以及其他一些地方发布了一段时间但没有成功。
我做了一个包含 11 个步骤的 ResearchKit 调查,但我想删除每个问题底部的默认取消按钮。
我遇到过这个命令:
stepViewController.cancelButtonItem = nil;
但是我好像找不到合适的地方。
谢谢。
正确的位置应该在委托回调中。文档说明 "The cancel button item is updated during view loading and when the value of the step
property is changed, but is safe to set in the taskViewController:stepViewControllerWillAppear:
delegate callback."
举个例子:
func taskViewController(_ taskViewController: ORKTaskViewController, stepViewControllerWillAppear stepViewController: ORKStepViewController) {
stepViewController.cancelButtonItem = nil
}
话虽如此,根据其回购中的这些问题,目前最新版本的 ResearchKit 中的功能似乎已被破坏。
https://github.com/ResearchKit/ResearchKit/issues/1273
它目前会禁用取消按钮的功能,但不会从 ORKNavigationContainer 中正确删除该按钮。如果您找到解决方案,请告诉我,这个问题已经在他们的回购协议以及其他一些地方发布了一段时间但没有成功。