iphone - Swapping views inside a tabview controller -


i have app based on tabbar controller. within view i'd add swipe gesture recognition , swap current view 1 (which not part of tabbarcontroller array). have tried:

- (ibaction)swipeleftdetected:(uigesturerecognizer *)sender { //does not work uiviewcontroller *desiredviewcontroller =[[uiviewcontroller alloc] initwithnibname:@"desiredviewcontroller" bundle:nil]; desiredviewcontroller.modaltransitionstyle = uimodaltransitionstylecrossdissolve; [self presentmodalviewcontroller:desiredviewcontroller animated:yes];  [self.view addsubview:desiredviewcontroller.view]; } 

but program crashes. error related segmentedcontrol present in next view absent in current one. views independently work perfectly!

*** terminating app due uncaught exception 'nsunknownkeyexception', reason:'[<uiviewcontroller 0xa355fb0> setvalue:forundefinedkey:]: class not key value coding-compliant key x_segmentedcontrol.' 

i don't understand doing wrong.. want swap views rather putting 1 on top of each other. advice please? thanks

the problem not transition.

you loading view controller nib.

a view controller subclassed, (assuming nib configured correctly , have .h , .m implementation file desiredviewcontroller subclass) should init this:

desiredviewcontroller *controllerinstance =[[desiredviewcontroller alloc] initwithnibname:@"desiredviewcontroller" bundle:nil]; 

the exception because have segmented control inside view controller subclass, xcode trying link control outlet on view controller, outlet doesn't exists (because allocating uiviewcontroller not subclass).


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -