0

我有一个带有下一个按钮的视图(例如)“新游戏”和“与朋友分享”,如果用户点击“新游戏”运行“NewGameViewController”,并且当他点击“分享”ShareViewController 运行时,我想要。我已经阅读了 developer.apple 上的一些文档(TabBar 和 NavBar),但没有找到解决方案

4

3 回答 3

1
NewGameViewController *ngVC = [[NewGameViewController alloc] initWithNibName:@"SomeNib" bundle:nil];
[self.navigationController pushViewController:ngVC animated:YES];

另一个原则上相同。

于 2013-08-07T19:42:44.633 回答
0

你有更多的机会做到这一点。最简单的是使用 UIVIew 的 presentModalViewController 方法。或者您可以实例化一个导航控制器并使用 pushViewController:animated: 方法。

于 2013-08-07T19:44:39.710 回答
-1

如果您不使用情节提要或 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];
}

}
于 2013-08-07T20:08:58.363 回答