Add a UIPicker on a UIScroll View?
I designed an app with mainly uses UIPicker, but I don't have space to use more then 10 pickers.
Of course, all the pickers are connected to a UITextField. So if you press a TextField a Picker will show. I'm Trying to add a UIScrollView so I can add more TextField which when pressed shows a UIPicker.
Is it Possible? Can I view two views at the same time? I would really appreciate it, if someone can give me a hand.
T开发者_如何学Chank you
Yes you can have more than one view onscreen at a time. Simply make the UIPickerView as subview of the UIScrollView:
UIScrollView* scroll = [[UIScrollView alloc] init];
UIPickerView* picker = [[[UIPickerView alloc] init] autorelease];
[scroll addSubView: picker];
This certainly seems possible. You just need a scroller which will accomodate all your clickable-textFields AND will scroll at the same time right?
Add a scrollView to your main view, and add all your textFields as subviews of the scrollView. Make sure the contentSize of the scrollView is set to accomodate all the textFields. The UITextField will working for the tap, and it will not interfere in any way with the swipe of the scroller.
I assume you're trying to create a sort of data entry form here? Where the data values are discrete and must be chosen from a picker? If so, we've done this sort of thing plenty of times, so yeah, its totally doable.
精彩评论