I have a custom subclass of a UITableViewController which has a editable cells in the table. I use the UITableViewController because I get all the nice code that moves the cells to be visible when the keyboard appears for free.
For one of my cell types I have a UIPicker that appears in place of the keyboard. All works well and I have a nice animation to slide it in and out just like the keyboard. The problem is, because I added the picker as a subview the UITableViewController’s view property it is possible for the user to scroll the UIPicker up and down.
I understand why this is happening (I assume the view property is assigned to the tableView property of the viewController and therefore my picker is being added on top of the tableView, which has a scroll view as its parent). What I am not sure is the best/recommendend way around this.
I tried adding the picker to the superView of the UIViewController’s view but no dice:
[myViewController.view.superView addSubView:myPicker];
I still want to keep all the nice keyboard effects but would like my picker to behave like the keyboard, slide up and stay fixed in position and then slide away when done.
Any help would be greatly appreciated.
Dave
If you are using UITextView for the UIPicker you can try and use the “inputView” and iOS will manage animation and view hierarchy for you.
You can also always create a containing UIView that will contain the TableViewController’s View property and add the UIPicker to him.
Good luck