iphone - Pop a UIViewController containing a UITabBarController off of a UINavigationController -


i have uinavigationcontroller(a) pushes uiviewcontroller(b) onto stack. (b) contains uitabbarcontroller(c). (c) has 5 tabs , of these viewcontrollers(d,e,f,g,h) needs able pop (b) off stack.

i've tried [[self.parentviewcontroller navigationcontroller] popviewcontrolleranimated:yes]; among many other things, none of seem work. ideas?

edit:

.h file:

@interface matabviewcontroller : uiviewcontroller<uitabbarcontrollerdelegate> { uiviewcontroller *ref; }  @property (nonatomic, retain) iboutlet uitabbarcontroller *tabbarcontroller; @property (nonatomic, retain) iboutlet uiimageview *imgviewfooter;  @end 

.m:

#import "matabviewcontroller.h"  @implementation matabviewcontroller @synthesize tabbarcontroller = _tabbarcontroller; @synthesize imgviewfooter;  - (void)viewdidload { [super viewdidload];  self.view = self.tabbarcontroller.view;  self.tabbarcontroller.delegate = self; self.imgviewfooter.frame = cgrectmake(0.0f, 395.0f, 320.0f, 64.0f); [self.tabbarcontroller.view addsubview:self.imgviewfooter]; self.tabbarcontroller.selectedindex = 0;  ref = [[self.tabbarcontroller viewcontrollers] objectatindex:0]; }  -(bool)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller shouldselectviewcontroller:(uiviewcontroller *)viewcontroller {  nsinteger index = [[tabbarcontroller viewcontrollers] indexofobject:viewcontroller];  switch (index) {     case 0:         self.imgviewfooter.image=[uiimage imagenamed:@"footer_full.png"];         break;     case 1:         self.imgviewfooter.image=[uiimage imagenamed:@"footer_full.png"];         break;     case 2:         self.imgviewfooter.image=[uiimage imagenamed:@"footer_full.png"];         break;     case 3:         self.imgviewfooter.image=[uiimage imagenamed:@"footer_full.png"];         break;     case 4:         self.imgviewfooter.image=[uiimage imagenamed:@"footer_full.png"];         break;      default:         break; } return yes; }  -(void)tabbarcontroller:(uitabbarcontroller *)tabbarcontroller didselectviewcontroller:(uiviewcontroller *)viewcontroller { if (ref != viewcontroller) {     [ref viewdiddisappear:yes];     ref = viewcontroller;     [viewcontroller viewdidappear:yes]; } }  @end 

notice how have major hack in line:

self.view = self.tabbarcontroller.view; 

i experienced similar problem (if question). may declare uiviewcontroller (b) subclass of uitabbarcontroller? notice uitabbarcontroller subclass of uiviewcontroller, can keep using normal uiviewcontroller. way you'll have (b) , (c) in single controller.
now [self.navigationcontroller popviewcontroller]; should work.
@ least, that's way solved it.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -