views:

245

answers:

3

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..

A: 

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. setting delegate

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.

jtbandes
I updated my question is this still the answer..
chris
Ok Awesome...man thanks!! although im still pretty new I follow you but like where i load the xib how do i need to call this function and tell witch row xib to load up?? I have messed aroung with tablw view and have them working mostly from tuts but still dragging my feet trying to learn. Thanks for help thus far!!
chris
A: 

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??

clad Davidson
A: 

This sounds like you want to create a subview. It's kinda like a dialog box.

Cancel