If the current is a VC, then it is too simple, you can push directly to the next VC
Addshopviewcontroller *controller = [[Addshopviewcontroller alloc] Init];controller.view.backgroundcolor = [ Uicolor whitecolor];//Set the background color to white, eliminating the residual shadow [Self.navigationcontroller Pushviewcontroller:controller Animated:YES];
Sometimes need to pushviewcontroller from modal view, this is certainly not, because you do not have NC, can nslog a try to know.
NSLog (@ "viewcontrollers before pushing:%@", self.navigationController.viewControllers);
At this point you want to add a Viewcontroller view on your self.view, what you have to do is: [self addchildviewcontroller:xxx]; or Addsubview. Because there is no nav, if you want to use the NAV to control the VC, the general is the first nav, and then the VC into NAV, if itself is a VC so direct
Uinavigationcontroller *navcontroller = [[Uinavigationcontroller alloc]initwithrootviewcontroller:self]; [Self Presentviewcontroller:navcontroller animated:yes completion:nil];
So that your modal have an NV, then you can in this modal inside with [Self.navigationcontroller Pushviewcontroller:controller Animated:yes]; The complete one is this way, storyboard is very clear.
Myviewcontroller *myviewcontroller = [Myviewcontroller alloc] init]; Uinavigationcontroller *navcontroller = [Uinavigationcontroller alloc] Initwithrootviewcontroller:myviewcontroller] ;//Presuming a view controller is asking for the modal transition in the first place. [Self Presentviewcontroller:navcontroller animated:yes completion:nil];
Uinavigation,uiview,modalview the relationship between controllers