Note that there are some explanatory texts on larger screens.

plurals
  1. POPushing from One View to Another via UIButton (UINavigationController)
    text
    copied!<p>I've tried every solution on Google and nothing seems to work. So far I've implemented a UINavigationController with the App Delegate, now all I want to accomplish is changing to the <em>WebViewController</em> by clicking the UIButton I've created in the interface builder, but the button doesn't seem to do anything when I run the application. Keep in mind that I want it to <em>push</em> to my <em>WebViewController</em> view.</p> <p><strong>AppDelegate.m</strong></p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController]; [self.window addSubview:navigationController.view]; [self.window makeKeyAndVisible]; return YES; } </code></pre> <p><strong>ViewController.m</strong></p> <pre><code>- (IBAction)createFile:(id)sender { WebViewController *webViewController = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:NSBundle.mainBundle]; [self.navigationController pushViewController:webViewController animated:YES]; } </code></pre> <p><strong>Note:</strong> In the interface builder I've already connected <em>createFile</em> to the button.</p> <p>I understand that this is usually something that comes known as super easy but for some reason I've just never gotten it to work. Thanks in advance.</p> <p><strong>EDIT:</strong> I added the retaining property, sythesized it and added to my code in the ViewController.m file:</p> <pre><code>WebViewController *webViewController = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:NSBundle.mainBundle]; self.navigationController = [[UINavigationController alloc] initWithRootViewController:webViewController]; [self.navigationController pushViewController:webViewController animated:YES]; </code></pre> <p>But now the app crashes on the button click and returns with a SIGABRT: "<em>Pushing the same view controller instance more than once is not supported (WebViewController: 0x1ed70e80)</em>"</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload