Slide UIDatePicker like Keyboard

Discussion in 'iOS Programming' started by McBgnr, Aug 19, 2009.

  1. McBgnr macrumors regular

    Joined:
    Apr 13, 2009
    #1
    Hello,

    I have a few text boxes in my View, one of these requires date to be entered by the user.


    So I am trying this: I have taken a button which looks like textField.
    I have added a UIDatePicker to my View at the bottom. And am showing it when the user clicks on the button. and I am hiding it when the user clicks on the Save button (provided seperately). However I am not sure how to slide the DatePicker like the keyboard. Any ideas?
     
  2. Troglodyte macrumors member

    Joined:
    Jul 2, 2009
    #2
    Create it off screen, then change it's frame in an animation block.
     
  3. McBgnr thread starter macrumors regular

    Joined:
    Apr 13, 2009
    #3
    off screen... means out of view? Will try that out.

    Another thing, I am using the "Making content hidden by Keyboard visible" form iphoneProgrammingGuide, in an app. But it is not working? The control doesn't move at all... dont know why?
     
  4. Troglodyte macrumors member

    Joined:
    Jul 2, 2009
    #4
    There's some example code (I can't recall which one - sorry) on the Apple dev site that shows you how to scroll a view so the text fields aren't covered by the keyboard when it appears. Basically you need to use that idea to slide the picker on screen.
     
  5. McBgnr thread starter macrumors regular

    Joined:
    Apr 13, 2009
    #5
    Thanks for the quick responses this is working now.

    My view also has a TextField in it. When the user clicks on the ButtonforDatePicker the datePicker opens and before clicking on the done button (which has been added for DatePicker elsewhere), the user clicks on the TextField then the datePicker remains and gets covered by the KeyBoard. What would be the ideal way of solving this?
     

Share This Page