I have a UIPicker that is holding titles. I would like it to when a row is tapped to open to a .xib view/ UIView and have a small textview in it. Is this possable?? If so please help!!
Thanks in advance for any help..
I have a UIPicker that is holding titles. I would like it to when a row is tapped to open to a .xib view/ UIView and have a small textview in it. Is this possable?? If so please help!!
Thanks in advance for any help..
I'm not exactly sure what you're asking, but it is possible.
When a UIPickerView has a row tapped, it tells its delegate via the -pickerView:didSelectRow:inComponent:
method.
So, you'll need to set the picker's delegate. You do this by dragging from the delegate outlet to your controller in Interface Builder, or by setting picker.delegate = someObject
in code.
Then, in the delegate:
- (void)pickerView:(UIPickerView *)pickerView
didSelectRow:(NSInteger)row
inComponent:(NSInteger)component {
// load xib or whatever you like
}
Edit with more info:
To load the XIB you will most likely want to use -initWithNibNamed:bundle:
on a view controller class. In that delegate function above, the number row
is the row which was selected. You can use that row to construct the nib name you want to use.
hey is there any code out there for this question?? I am looking to do the same thing. but cant seem to figure this one out. or even a tut on this??
This sounds like you want to create a subview. It's kinda like a dialog box.