iphone - 如何更改 Root View Controller
<p><p>我想在 authenticationViewController <img src="/image/c5M0c.png" alt="enter image description here"/> 之后更改 rootViewController </p>
<pre><code>-(IBAction)LoginButtonPushed:(id)sender {
if ([(VerifyId)isEqual:@"C"]){
CondidatsViewController *condidatsViewController = [[initWithNibName:@"CondidatsViewController" bundle:nil]autorelease];
UINavigationController *navController = self.navigationController;
NSMutableArray *controllers = [ autorelease];
;
navController.viewControllers = controllers;
;
} else {
RecruteursViewController *recruteursViewController = [[initWithNibName:@"RecruteursViewController" bundle:nil]autorelease];
UINavigationController *navController = self.navigationController;
NSMutableArray *controllers = [ autorelease];
;
navController.viewControllers = controllers;
;
}
}
</code></pre>
<p>这段代码是当我按下登录按钮时,我希望 CondidatsViewController 或 RecruteursViewController 将成为 rootView </p>
<pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[ initWithFrame:[ bounds]] autorelease];
// Override point for customization after application launch.
AcceuilViewController *viewController =[[
initWithNibName:@"AcceuilViewController" bundle:nil]autorelease];
self.navController = [[initWithRootViewController:viewController]
autorelease];
self.window.rootViewController = self.navController;
;
return YES;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以尝试 UINavigationController 的以下方法,其中包含一组新的所需 ViewController ,例如</p>
<pre><code> animated:NO];
</code></pre>
<p>它会做的伎俩;)</p></p>
<p style="font-size: 20px;">关于iphone - 如何更改 Root ViewController ,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/17960034/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/17960034/
</a>
</p>
页:
[1]