Closed Geosef closed 8 years ago
@Geosef Assume you had some customization, can I see them in some sample code?
I'm using ORKTaskViewController
as a part of the Symptom tab in CareKit, per the CareKit sample application.
In OverviewViewController
, I've added extensions for delegates for the symptom tracker and the task view.
extension OverviewViewController: OCKSymptomTrackerViewControllerDelegate {
func symptomTrackerViewController(_ viewController: OCKSymptomTrackerViewController, didSelectRowWithAssessmentEvent assessmentEvent: OCKCarePlanEvent) {
// Lookup the assessment the row represents.
guard let activityType = ActivityType(rawValue: assessmentEvent.activity.identifier) else { return }
guard let sampleAssessment = sampleData.activityWithType(type: activityType) as? Assessment else { return }
/*
Check if we should show a task for the selected assessment event
based on its state.
*/
guard assessmentEvent.state == .initial ||
assessmentEvent.state == .notCompleted ||
(assessmentEvent.state == .completed && assessmentEvent.activity.resultResettable) else { return }
// Show an `ORKTaskViewController` for the assessment's task.
let taskViewController = ORKTaskViewController(task: sampleAssessment.task(), taskRun: nil)
taskViewController.delegate = self
symptomTrackerNavController.pushViewController(taskViewController, animated: true)
}
}
extension OverviewViewController: ORKTaskViewControllerDelegate {
func taskViewController(_ taskViewController: ORKTaskViewController, didFinishWith reason: ORKTaskViewControllerFinishReason, error: NSError?) {
guard reason == .completed else { return }
guard let event = symptomTrackerViewController.lastSelectedAssessmentEvent,
activityType = ActivityType(rawValue: event.activity.identifier),
sampleAssessment = sampleData.activityWithType(type: activityType) as? Assessment else {return}
let carePlanResult = sampleAssessment.buildResultForCarePlanEvent(event, taskResult: taskViewController.result)
symptomTrackerViewController.store.update(event, with: carePlanResult, state: .completed) { (success, _, error) in
if !success {
print(error)
}
}
symptomTrackerNavController.popViewController(animated: true)
}
}
This is the only reference to the ORKTaskView
in our app. No attempts for customization.
@Geosef taskViewController
is supposed to be presented, instead of being pushed.
We have changed taskViewController
to now be presented/dismissed rather than pushed/popped; however, this did not affect the layout issue.
@Geosef That's weird. Are you using ResearchKit master or stable releases? Can you reproduce that in any of the ResearchKit sample/test apps?
@YuanZhu-apple We are using 1.3.1 via CocoaPods. I could not reproduce the issue in either the ResearchKit sample app nor the CareKit sample app; however, our project is in iOS10 which could result in autolayout issues that I'm not 100% aware of. I tried converting the CareKit sample app to Swift 3/iOS 10, but it wasn't playing nice so I really couldn't test it.
@YuanZhu-apple any update?
@Geosef ResearchKit is not officially support iOS 10 yet.
1) you can try the branch: https://github.com/ResearchKit/ResearchKit/tree/stable_xcode80_candidate 2) If you don't mind, please share a minimum iOS 10 project using RK 1.3.1, I can try to play it.
@YuanZhu-apple We tried using both the CareKit and ResearchKit 'stable_xcode80_candidate' branches to no avail. We were able to reproduce the issue in a minimum project and have attached it.
@YuanZhu-apple any update?
@Geosef I confirm that this is an issue.
Caused by
https://github.com/ResearchKit/ResearchKit/blob/master/ResearchKit/Common/ORKVerticalContainerView.m#L655
It get fixed, once I change it to UILayoutPriorityDefaultHigh
.
Can you verify that, and make a pull request for me?
My team and I noticed issues with the layout of ORKTasks within ORKTaskViews in both sliders and text inputs. We have not tried other inputs to verify if they are affected or not.
This is text input prior to being tapped in the field:
Once tapped for input, the field and title both shrink: The placeholder text is cut off already.
This is after "12" has been entered: The field is so small you cannot see any input and the title is also cut off.
And after a medium length string of numbers: The title has reappeared, but the first few characters of the input are still cut off.
This is a slider with very short descriptions for min/max:
This is the same slider after being tapped for input: The slider is so small you can't change the value.
Finally, a slider with really long descriptions:
We believe a minimum width should be in place to handle text input and short descriptions on sliders. It may also be worthwhile looking into other inputs and seeing how they are affected.