New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add vertical scale answer format #33
Add vertical scale answer format #33
Conversation
…ted scale (Scale was being set to the maximumValue when you dragged the touch outside the segmented scale through the view's left bound)
…eSliderView: add vertical mode support
…rticalScaleAnswerFormat classes and factory methods Also: ORKAnswerFormat .h: make spacing coherent; add missing ORKContinuousScaleAnswerFormat initializer comment
…icalScaleQuestionStep examples to scaleQuestionTask
I tried to visually layout vertical scales so the scrolling is minimum on iPhone 4S sizes, but this produces somewhat short vertical scales. Maybe we should layout to iPhone 5 sizes and just have iPhone 4S users scrolling a bit. Also, I'm not happy by the fact I had to increase the Ideally, the height wouldn't increase for the horizontal scale cell (and vertical ones could be made even taller). But I couldn't figure a simple and sound way of doing this without a major refactor (since the |
ORK_CLASS_AVAILABLE | ||
@interface ORKVerticalScaleAnswerFormat : ORKScaleAnswerFormat | ||
|
||
@end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be much simpler to just add a vertical
boolean property on ORKScaleAnswerFormat
and ORKContinuousScaleAnswerFormat
?
Congratulations on the FIRST new feature PR for ResearchKit! To the visually layout of vertical scale, scale bar should has an adequate height to assist user to select on the bar easier.
|
One more comment - to accept this pull request, it will also need to work properly with VoiceOver enabled. The existing horizontal control has VoiceOver support, so this should be straightforward. |
Hi guys, thanks for the feedback! I'll look into the design changes. Definitely the range labels on the side of the slider is a good idea that would save some vertical space. I tried displaying Regarding the height of Regarding adding an |
…chezsaez-verticalscale
We've found the answer formats tend to be pretty static and think a property makes sense. Probably read-only, but could be convinced otherwise. |
A read-only property passed to the answer format initializers makes sense. I'll make the changes soon. Do you prefer Coding Guidelines for Cocoa naming conventions seem to recommend using the
|
Yep, the latter |
…fied 'isVertical' getter (Coding Guidelines for Cocoa)
…swerFormat classes by 'vertical' property in ORKScaleAnswerFormat and ORKContinuousScaleAnswerFormat Also: - Rename 'minValue' and 'maxValue' to 'minimumValue' and 'maximumValue' (Coding Guidelines for Cocoa) - Reorder 'defaultValue' before 'steps' in ORKScaleAnswerFormat initializers (for coherence with ORKContinuousScaleAnswerFormat)
…rveyAnswerCellForVerticalScale
I have added commits implementing the requested feedback. Regarding visual layout, I optimized it for iPhone 6 and up. I moved the range labels to the left side of the scale. I left the I think that VoiceOver should work straight away as well (I checked with the Accessibility inspector). I cannot test on an actual device right now, can anybody confirm that it works? Thanks. |
This is such a great read! And even greater to have Apple engineers on Github—never thought I'd see the day, but I'm glad I was wrong to doubt. |
One more thing, |
Excellent catch! Issue solved. |
Thanks, will review shortly. |
case ORKQuestionTypeVerticalScale:{ | ||
height = [ORKSurveyAnswerCellForVerticalScale suggestedCellHeightForView:tableView]; | ||
} | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than adding this question type, I'd prefer to change the logic for ORKQuestionTypeScale to interrogate the impliedAnswerFormat of the question step, cast appropriately, and check the vertical property. It might be best to add a method to questionStep like isFormatVertical, which makes the appropriate check. This would be in line with the above code for ORKQuestionTypeSingle/MultipleChoice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I never felt good about adding a new ORKQuestionTypeVerticalScale
value. I didn't realize ORKQuestionStep
had these helper methods. I'll improve it.
…cale' type by 'isVertical' method querying
…ead of 'self.bounds'
All feedback issues taken care of. |
With that one naming change I'll merge this. |
Done. |
Thanks, great job on this! |
Thanks for the thoughtful comments all along. 👍 |
Hey, I think I made a mistake in
(the property name) instead of:
(the getter name). If you clean the project and recompile, Xcode is not happy. I've fixed it in the latest commit in the corresponding branch. I think you can just do a fast-forward merge to keep GitHub clean, but tell me if you want me to submit a separate pull request. I spotted it when trying to compile the merged master branch. I'm not sure why Xcode was happily compiling on my separate branch. |
Oh, I figured why it doesn't compile now. Pull request #48 (fix double evaluation in ORKDynamicCast macro) makes the compiler to see the general Still, the fix to my code still applies, I think. |
Actually, my previous fix does not compile either. Explicitly calling the getter works:
I've overwritten my fixing commit to reflect this. Although I think we may want to go back to an Sorry about the confusion. |
Don't panic. I think the ORKDynamicCast() just needs extra parens. I'll fix it up. |
Just pushed my fix to master, thanks! |
Perfect. |
@jwe-apple 👍 Thanks for that fix! |
…-end-dates ORKResult start/end dates should not be nullable
I have implemented vertical scale support (issue #3).
ORKScaleSlider
now has theisVertical
property. When set toYES
, it internally uses theUIView
'stransform
property and some minor bounds and touch trickery to draw and work in vertical.ORKScaleSliderView
now has vertical support through the use of the newisVertical
method from theORKScaleAnswerFormatProvider
.New classes:
ORKVerticalScaleAnswerFormat
andORKContinuousVerticalScaleAnswerFormat
. The corresponding example steps have been added toORKCatalog
's Scale Question.