0

I have 2 view controllers, the first with a button (taking me to the pickerview view controller)and an output label, the second with a pickerview (which I have filled with selections using an NSMutableArray) and a done button. Once i've made a selection in the picker view and clicked the done button, how do I get the choice to display in the output label of the first view controller? Hope that makes sense, I am very new to this.

2 Answers 2

1

If I'm understanding this correctly, it sounds like you click the button on View1 and are taking to View2 with a pickerview. Then you want to display the selection in pickerview in the label on View1.

If so, you should use delegation. Make View1 View2's delegate and then have View2 communication to the delegate upon hitting done.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your reply Mike. I have managed to get it to work with just the two view controllers but I actually want this to be part of a tabbed application. When I implement it in a tabbed app I get the following error messages:int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } and Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TopFilmsController firstselectionLabel]: unrecognized selector sent to instance 0x6b96860'
To be clear, the picker view on the second view controller displays it's selection in an output label, when I then dismiss this view controller by pressing the done button, I want the selection to be displayed on the initial view controller. It works perfectly until I include these two view controllers in a tabbed application, when I then receive the errors.
0

http://www.techotopia.com/index.php/An_iOS_4_iPhone_UIPickerView_Example

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.