Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8455491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:17:58+00:00 2026-06-10T12:17:58+00:00

So i have my main viewController and all i have is a single button

  • 0

So i have my main viewController and all i have is a single button inside.
The code of the button is :

- (IBAction)eventsButton:(id)sender {
self.eventsViewController =[[EventsViewController alloc]initWithNibName:@"EventsViewController" bundle:nil];
[self.navigationController pushViewController:eventsViewController animated:YES];}

where EventsViewController is another controller where i want to navigate when this button is clicked. But when i click it nothing happens.. I dont navigate to the other controller.

ViewController.h
-------------------
#import <UIKit/UIKit.h>

@class EventsViewController;

@interface ViewController : UIViewController <UIActionSheetDelegate>

- (IBAction)eventsButton:(id)sender;

@property (strong, nonatomic) EventsViewController *eventsViewController;


@end




ViewController.m
-----------------
#import "ViewController.h"
#import "EventsViewController.h"

@implementation ViewController

@synthesize eventsViewController;


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

- (IBAction)eventsButton:(id)sender {
    self.eventsViewController =[[EventsViewController alloc]initWithNibName:@"EventsViewController" bundle:nil];
    [self.navigationController pushViewController:eventsViewController animated:YES];
}

@end

I put a breakpoint in the IBACTION and i see that the code is executed , but it never navigates me to the other controller. The other controller is just a simple controller i created with Xcode , it has all the code Xcode gives and nothing mine.
Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:17:59+00:00Added an answer on June 10, 2026 at 12:17 pm

    My guess is you didn’t put ViewController inside UINavigationController. First you have to alloc and init UINavigationController. So inside application: didFinishLounchingWithOptions:

    ViewController *viewController = [[ViewController alloc] init];
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]
    [self.window setRootViewController:navigationController];
    [self.window makeKeyAndVisible]
    

    It should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a main view controller that consists of 1 button that when tapped,
I have main window which has inner grid components. When I press a button
I have a app with a main viewcontroller that loads a first page viewcontroller.
I have a typical UITableViewController set of views. On all views is a button,
I have 4 buttons on main screen, each one sends me to a viewController.
I have ViewController and then two different ViewControllers that extend that main ViewController ,
I have one mainViewController and I have a UIPickerView. Now all is set up
I have the following piece of code in my MainViewController. Is that the best
I have a problem with the function call: [self dismissModalViewControllerAnimated:YES]; In MainViewController, I can
I have main categories and sub categories. I want to be able to sort

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.