Hi ! I'm trying to have 2 views in my app, using 2 buttons on my home screen. For each of these buttons i've created a new class and added the following code to my view controller :
ViewController.h :
#import <UIKit/UIKit.h>
@interface Gallerie2ViewController : UIViewController {
}
- (IBAction)switch2class1:(id)sender; // 1st button
- (IBAction)switch2class2:(id)sender; // 2nd one
@end
ViewController.m :
#import "ViewController.h"
#import "class1.h"
#import "class2.h"
@implementation ViewController
- (IBAction)switch2class1:(id)sender
{
Class1 *Class1view = [[Class1 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:Class1view animated:YES];
}
- (IBAction)switch2class2:(id)sender
{
Class2 *Class2View = [[Class2 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:Class2View animated:YES];
}
Class1.h/.m has the same content than Class2.h/.m , but when running my app, the 1st button works fine (opens the Class1 view) but the 2nd button crashes the app !!
What am I doing wrong ?