I´m new to iOS development and am facing what to me seems to be a trivial task: open view controller 2 when pushing a button in view controller1. No storyboard and xib files involved, so the methods I found by web search like initWithNibName, usage of segue e.a. are not applicable.
Update:
Still struggling with this issue. When switching to ViewController2 by pushing a button in ViewController1 a blank (white) view opens in the app. I meanwhile switched to using a storyboard as I need navigation control. But still no xib files in use.
Here the relevant code from ViewController1.m:
#import "ViewController2.h"
@interface ViewController1 ()
@property (strong, nonatomic) IBOutlet UIButton *GoToViewController2;
@end
@implementation ViewController1
- (IBAction)GoToViewController2:(id)sender
{
ViewController2* vc2 = [[ViewController2 alloc] init];
[self.navigationController pushViewController:vc2 animated:YES];
NSLog(@"Went to ViewController2");
}