iphone - Set root ViewController in a UISplitViewController from the detail view -


i have uisplitviewcontroller, , i'd change root view controller (on left side of screen) when click button in detail view (the right side of screen).

if in detail view:

nextgameviewcontroller *newtableviewcontroller = [[nextgameviewcontroller alloc] init]; nsarray *newvcs = [nsarray arraywithobjects:newtableviewcontroller, self, nil]; splitviewcontroller.viewcontrollers = newvcs; 

it crashes error:

-[nextgameviewcontroller setparentviewcontroller:]: unrecognized selector sent instance 0x4938a50 

nextgameviewcontroller subclass of uitableviewcontroller, why happening? if push onto view controller stack root view works fine.

uitableviewcontroller's parentviewcontroller read property. see this question more discussion. sounds want push new table view on left side of detail view, still under root view, not replace root view controller itself, describing.

you use array trying replace @ information. see this link viewcontrollers property more information.

also app delegate should have access root , detail view both. app delegate , use delegate.root property push onto controller stack you've described. this:

myappdelegate* del = (myappdelegate*)[[uiapplication sharedapplication] delegate]; // want del.root controller here 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -