views:

666

answers:

2

I'm working in the 3.0 SDK so I can't use specifics, but anyone who is using it might understand, I hope.

I have been trying to load a view that allows you pick from a particular list of items...but I can't get it to work here's the code I'm using, made to be generic:

M**********Controller *newpicker = [[M**********Controller alloc] init];

I've tried using variations of the above, but I just can't seem to get it to work. I'm not sure if I'm calling this in the right place in my code or if this is even the right way to do it. The documentation is here(only registered developers can view it). It sounds to me like it's similar to using UIAlertView, but it doesn't seem to work like that. This may be too obscure, but if anyone can help it would be appreciated.

+1  A: 

It's a UIViewController subclass, so you show it in the same way you would any other UIViewController, which is to say, you've got a couple of options:

If you're in a navigation hierarchy, you'd do this:

[self.navigationController pushViewController: newpicker animated: YES];

Or possibly this:

[self.navigationController presentModalViewController: newpicker animated: YES];

If the current controller isn't inside a navigation controller, you'd just place the new controller's view inside another; use newpicker.view to access it for that purpose.

Jim Dovey
YES! I've been stuck on that way to long. I don't know what I was thinking. It's works great. Now to actually do something with the list.....hmmm.
Bryan Cimo
+1  A: 

To add to Jim,

All UIViewControllers also have a view property. Inside whatever viewController is on screen, you can simply:

[self.view addSubview:newPicker.view];
Corey Floyd