Hi ,
I use the below code ,But its not working.
Can you please tell me what is the error in the code?
#import "TestViewController.h"
#import "Test2ViewController.h"
@implementation TestViewController
@synthesize view2Controller;
-(IBAction)display
id)sender
{
//Load the view controller from the HelloView nib file.
Test2ViewController *vController = [[Test2ViewController alloc]
initWithNibName
"Test2View" bundle:[NSBundle mainBundle]];
//set the view.
self.view2Controller = vController;
//release the view controller.
[vController release];
}
- (id)initWithNibName
NSString *)nibNameOrNil bundle
NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Initialization code
}
return self;
}
// If you need to do additional setup after loading the view, override viewDidLoad.
- (void)viewDidLoad {
Test2ViewController *view2 = [[Test2ViewController alloc] initWithNibName
"Test2View" bundle:[NSBundle mainBundle]];
self.view2Controller = view2;
[view2 release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation
UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[super dealloc];
}
@end
Thanks
judy