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

bboyjayz

macrumors member
Original poster
Mar 20, 2009
55
0
hi,
i try for 3 days, to change my viewController added into the MainWindow, with another viewController, i've already done that before, and it work very well.
Whereas, for the app I try to make now, when i push the button to change the view, it doesn't work, and my application send me an exception :

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString setViewController:]: unrecognized selector sent to instance 0x7160'

Do you know what can cause this error ?
Thank youuu
 
Are these view controllers part of a navigation controller?

Do you have an instance variable named viewController?

Does that instance variable have a setter named setViewController: ?
 
my application is a simple Window Base Application (no naviguation bar or other), I want to swith my View with a simple UIButton.

I have a viewController instance on my myApplicationAppDelegate ..
And i don't have created a setViewController methodS...:s
 
Well, the UIButton is going to be part of a view, so you are going to switch *that* view to something else (another button in the new view)?

What kind of a switch are you talking about? Animation? You might want to just use a navigation controller.
 
Yes my switch is an animation, and, i've a view, which has a UIButton, and when i touch it, a new view appear
 
view != view controller

If you want to change views, make a new view (rather than a new view controller), and add that view to the current view controller.

If you want to change view controllers, you need to use a navigation controller or tab bar controller.
 
Usualy, i change my ViewController, without Naviguation Bar or Other, i don't know if it's the best way .... but it works. ..
It's just for this project, it doesn't work and i don't know why...
Even if in my First ViewController, I create a view same than the View of my Second ViewController, i've se same error...
 
i'm just realizing on,e thing: me app is a game, when, during the game, i ask for a new Game, i removeFromSuperView of my delegate.window the current view, i create a new instance of myGameViewController, and add the View of this of my window...first point: it works.

Seconde point, the bad one: when i'm on the menuViewController, and i want to change my viewController, i use the same peace of code, and i've the exception.... wird. ..
 
Magic: IT'S WORK :) thank you for your help, copy past my own code ... and it's work...lame
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.