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?