Ios 管理多个viewconroller
我正在查看“下一步”按钮(例如“新游戏”和“与朋友共享” 我想知道用户是否点击运行“NewGameViewController”的“新游戏”,以及当他点击“共享”运行的ShareViewController时。 我已经阅读了developer.apple上的一些文档(TabBar和NavBar),但没有找到解决方案Ios 管理多个viewconroller,ios,objective-c,uiviewcontroller,Ios,Objective C,Uiviewcontroller,我正在查看“下一步”按钮(例如“新游戏”和“与朋友共享” 我想知道用户是否点击运行“NewGameViewController”的“新游戏”,以及当他点击“共享”运行的ShareViewController时。 我已经阅读了developer.apple上的一些文档(TabBar和NavBar),但没有找到解决方案 NewGameViewController *ngVC = [[NewGameViewController alloc] initWithNibName:@"SomeNib" bun
NewGameViewController *ngVC = [[NewGameViewController alloc] initWithNibName:@"SomeNib" bundle:nil];
[self.navigationController pushViewController:ngVC animated:YES];
另一个原则上也是一样。你有更多的机会这样做。最简单的方法是使用UIVIew的presentModalViewController方法。或者,您可以实例化一个导航控制器并使用pushViewController:animated:方法。如果您不使用故事板或Xib,则
if you have button New Game and Share than used tag value 0 for new Game and 1 for share with friend.
than follow button action method
-(void)buttonActionMethod:(UIButton *)btn{
if(btn.tag==0)
{
NewganeViewController *newGameController =[[NewGameViewController alloc]int];
[self.navigationController pushViewController:newGameController animation:YES];
}
if(btn.tag==1){
ShareViewContoller *shareViewControler =[[ShareViewController alloc ]init];
[self.navogationController pushViewController:shareViewController animation:YES];
}
}
你在用故事板吗?