Iphone: Problem with moving back and forth between two UIViewController
Posted
by Harry Pham
on Stack Overflow
See other posts from Stack Overflow
or by Harry Pham
Published on 2010-04-07T05:13:10Z
Indexed on
2010/04/07
6:23 UTC
Read the original article
Hit count: 322
Let me first describe the context of the problem. I have 2 UIViewController
call AdminViewController
and ButtonReorderViewController
. AdminViewController
contain 1 button. ButtonReorderViewController
contains 1 button and 1 picture. Button in AdminViewController
tie to an event call goToReorderButton
. The content of goToReorderButton
are below:
ButtonReorderViewController *buttonReorder = [[ButtonReorderViewController alloc] initWithNibName:@"ButtonReorderViewController" bundle:[NSBundle mainBundle]];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:buttonReorder]; //Add a Navigation Controller to the root view
[navController setNavigationBarHidden:TRUE];
buttonReorder = (ButtonReorderViewController *) navController;
[[buttonReorder view] setFrame:CGRectMake(0, -20, 320, 470)];
[self.view addSubview:buttonReorder.view];
I use UINavigationController
to allow me to swipe left and right.So I am in AdminViewController
, and I click on goToReorderButton
, it load ButtonReorderViewController
. I am able to swipe left and right (awesome !!!) So I click the button in ButtonReorderViewController
call goToAdmin
, simply to go back to the AdminViewController
-(void) goToAdmin{
[self.view removeFromSuperview];
}
However, as soon as I go back to AdminViewController
, I cant click anything at all. The program does not seg fault, it just that I cant click the button at all. if I remove the line buttonReorder = (ButtonReorderViewController *) navController;
inside goToReorderButton
, then everything work fine. Any idea how to fix this?
© Stack Overflow or respective owner