PDA

View Full Version : Error when display the second view




iphonejudy
Sep 25, 2008, 07:50 AM
Hi,


I got error in the following code.

//This code is used to display the view2 when click the button.

-(IBAction)display:(id)sender
{



Test2ViewController *vController = [[Test2ViewController alloc]
initWithNibName:@"Test2View" bundle:[NSBundle mainBundle]];


//I got error in this line only.The simulator stops in tis line
self.view2Controller=vController;


[vController release];


[window addSubview:[view2Controller view]];


[window makeKeyAndVisible];

}
Can anybody please tell me the reason for the error?

Thanks
judy



robbieduncan
Sep 25, 2008, 07:55 AM
Use code tags. It makes the code you post more readable
What, exactly, is the error?

iphonejudy
Sep 25, 2008, 08:46 AM
Hi,


When i run the application.The simulator stops and it highlight the below line

self.view2Controller=vController;

Thanks
judy

robbieduncan
Sep 25, 2008, 08:49 AM
Hi,


When i run the application.The simulator stops and it highlight the below line

self.view2Controller=vController;

Thanks
judy

Yes, but it will post an error, either on screen somewhere or in the logs. Without that we are all just guessing at what we are supposed to be looking for.

iphonejudy
Sep 25, 2008, 08:56 AM
When i run the application .When i am pressing the button,it stopped and it highlight that line in the screen.The error shows below the window like

GDB:Stopped at brekpoint 1(hit count:1)-'-display:-Line 24'


Thanks
judy

robbieduncan
Sep 25, 2008, 09:00 AM
Have you set a breakpoint on that line?

iphonejudy
Sep 26, 2008, 01:01 AM
No.I did not set any breakpoint


Thanks
judy