-2

I would like to make a custom data input field similar to the Datepicker function. However, I would like the input field to display different height selections. This same effect/function is mimicked in the IOS 9 health app - Height and Weight entry pages.

So essentially I am making a datePicker style input view only it displays measurements instead of the date.

How can I achieve this, and do I need to use the Health Kit framework for this?

Thanks

Community
  • 1
  • 1
TheHoop
  • 365
  • 1
  • 3
  • 8
  • 2
    You are looking for `UIPicker`: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPickerView_Class/ – Larme May 13 '16 at 13:24
  • You should refer [Tutorial point's tutorial](http://www.tutorialspoint.com/ios/ios_ui_elements_picker.htm) or [Techotopia's tutorial] (http://www.techotopia.com/index.php/An_iOS_7_UIPickerView_Example). You need to just `UIPickerView` to get desired output. Hope this will help :) – Ketan Parmar May 13 '16 at 13:39

1 Answers1

0

A UIDatePicker is a specialized example of a UIPickerView. (For reasons I've never fully understand, it doesn't inherit from UIPickerView. It seems like it should.)

Anyway, what you want to do is to set up a UIPickerView that has entries for as many components as you need (If you want the user to be able to enter feet an inches, for example, you would create a component for feet and another component for inches. If you were using the Metric system it would probably make sense to just let the user input a measurement as a pure number of meters, since any metric measurement can be cleanly expressed in meters.)

You should be able to find a sample of using UIPickerView online somewhere.

Duncan C
  • 128,072
  • 22
  • 173
  • 272