我在iOS的编程很新。视图切换到另一个视图上的故事板
我所试图做的是:
我有一个故事板的一些看法,我想通过程序的视图之间进行切换。例如,一个按钮被按下时,我调用一个方法,我想在这里更改视图(我可以调用成功的方法)。按钮也以编程方式在不同位置创建。
我已搜查,我想这与NavigationController
发生。我有一个我创建的导航控制器,如下所示:menu Editor -> Embed In -> NavigationController
。我怎么能用这个NavigationController
做这个?
@Madhu和@Dilip,我发现xib
递交类
icerik *secondViewController = [[icerik alloc] initWithNibName:@"icerik" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:secondViewController];
navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
navigationController.topViewController.title = @"SecondViewController";
//[self presentModalViewController:navigationController animated:YES];
if([self respondsToSelector:@selector(presentViewController:animated:completion:)])
[self presentViewController:navigationController animated:YES completion:^{/* done */}];
else if([self respondsToSelector:@selector(presentViewController:animated:)])
[self presentModalViewController:navigationController animated:YES];
的解决方案我有一个名为icerik XIB文件中的类,我解决了它这样的。它是开放的,但当我想回头时,我能做什么?
你想要的是,当用户点击btn时,他将从当前视图控制器转到另一个视图控制器,对吧? – Dilip 2013-02-19 12:25:18
是的,我想改变使用故事板的两个viewcontrollers。 – ozmuhammed 2013-02-19 19:18:58