Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
EDIT: Opps. I posted this in the Mac section and not the IOS section. sorry

I created my first popover for an iPad app. I need to return a value back from it when it is pressed. But in making it I can see that I am basically creating a new UIViewController class and it is easy to push information to it while you are.

So getting the info back to my first view controller I would use NSUserDefaults or a Singleton which I have never experimented with yet as a global variable?

I am wondering what is the best way if anyone can recommend something for returning data to the first ViewController?

Thanks.
 
Last edited:

MattInOz

macrumors 68030
Jan 19, 2006
2,760
0
Sydney
What about a delegate protocol on the view controller in the popover.
If the base view controller implements the protocol then sets itself as delegate the your picker so your picker can message back results.

Have a look at UIPickerView as an example.
 

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
I have not looked at that. But I will. I looked at something like that a little but looked kind of confusing. I will check out the picker you recommended. I can always go back to using plists for data transfer but wanted to learn something new.

Thanks for the help.
 

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
I ended up passing this data with a singleton. I learned how to create and use them today, a very handy tool. I used the popoverControllerDidDismissPopover: in the first view controller to fetch the data from the singleton and assign it to the UILable in the first viewController.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.