Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
I tried doing the multive example from book "Begining Iphone Development"(chapter 6) by Dave Mark.

When I run the application all I get is iphone simulator with blank(black) screen. I have colored the view..but still does not show up. I checked for any error in console application and found none. When run the project, I do get the message in the status bar as "MultiviewProject launched". My project name for this example is Miltiview.Project. I confirmed the steps with book couple of times, but no use yet. Has anyone being through similar problem..?? What could be reason for getting a black screen..?? I can post the whole project in compressed form if this forum has any option...!!! I am frustrated with this problem after having checked the code and steps many times with book.


Thanks in advance for help...
 

CocoaPuffs

macrumors 68020
Aug 23, 2008
2,005
3
I tried doing the multive example from book "Begining Iphone Development"(chapter 6) by Dave Mark.

When I run the application all I get is iphone simulator with blank(black) screen. I have colored the view..but still does not show up. I checked for any error in console application and found none. When run the project, I do get the message in the status bar as "MultiviewProject launched". My project name for this example is Miltiview.Project. I confirmed the steps with book couple of times, but no use yet. Has anyone being through similar problem..?? What could be reason for getting a black screen..?? I can post the whole project in compressed form if this forum has any option...!!! I am frustrated with this problem after having checked the code and steps many times with book.


Thanks in advance for help...
Copy and paste the codes, and you probably missed linking the nibs to view.
 

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
Hey Thanks for the help. I was missing the connection from file's owner to App delegate in MainWindow.xib(is this told in the book..??). However I am now able to get to display the view of MainWindow.xib(this gets created when we chose window based application).

But I am unable to get the other nib file open on above view. Here is the code which is in swithViewController. Instead of BlueViewController I am using MainViewController. I also have nib file MainView.xib created. I did all the changes to MainView.xib as explained in page 130 to make sure that class which will load the MainView.xib file is MainViewController.When I run the project, I get to see what is in View of MainWindow.xib only...!!!! Any suggestions...???

.
Code:
- (void)viewDidLoad {

	MainViewController *mainController = [[MainViewController alloc]  initWithNibName:@"MainView"  bundle:nil];
	self.mainViewController = mainController;
	[self.view insertSubview:mainController.view atIndex:0];
	[mainController release];
	NSLog(@"Reached here too.....!!!");


}

Thanks in advance....
 

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
I have not yet implemented swithView method. I would like to go in steps so that I could catch any problem(like this) before it gets too complicated to find.

I am now trying to find when the project is executed ..does it open the MainView.xib which needs to be the first View to display.
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
I have not yet implemented swithView method. I would like to go in steps so that I could catch any problem(like this) before it gets too complicated to find.

I am now trying to find when the project is executed ..does it open the MainView.xib which needs to be the first View to display.
So, what is BlueView in the book you are calling MainView? Is that right?

Also, switchViews is added on page 127. But you haven't implemented it yet?

I guess I'm a little confused. What are you expecting to happen and what are you seeing instead?
 

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
You are right..BlueView in Book is MultiView in my project. So far I have implemented ViewDidLoad in SwitchViewController which assignes the View of MultiView.xib.

Switch view is not yet impelemnted as I don't like to see the switch in action now. According what I have implemented, I should be seeing the view of MultiView.xib as it should get loaded from viewDidLoad of SwitchViewController. But I see view of MainWindow.xib..... !!!

Why is it so..???
 

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
Here is what I observed..thought it might help you in figuring out the problem...

Looks like the view of MainWindow.xib is not getting replaced by the view of MainView.xib. When I run the project I get to see the view of MainWindow.xib. I changed the name for MainView.xib to some random name in code..
Code:
MainViewController *mainController = [[MainViewController alloc]  initWithNibName :@"MainView"  bundle:nil];
To
Code:
MainViewController *mainController = [[MainViewController alloc]  initWithNibName :@"MainXXXX"  bundle:nil];

When I executed the project I again saw View of MainWindow.xib..this means ViewDidLoad of SwitchViewController is not getting called..means …MainWindow.xib is not set to receive objects from SwitchViewController. But I made all the required changes to MainWindow.xib as given in page 124. I accept the error is in my part..but I am unable to trace it.

Help is much appreciated…
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
When I executed the project I again saw View of MainWindow.xib..this means ViewDidLoad of SwitchViewController is not getting called
Are you sure about that? You've put an NSLog or breakpoint in it to verify?

P.S. If you're able, attach a zip of your project to your post so we can examine it as well.
 

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
dejo,

Greatly apprecite for trying to help me out. I am unable to attach the file as the size of zip file is more than max allowed in forum.

Can you send me a private message with your email adress.I will mail you..???
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Greatly apprecite for trying to help me out. I am unable to attach the file as the size of zip file is more than max allowed in forum.
Seriously? The zip file would be bigger than 1.14 MB? Wow, what do you have in this project? The zip file for the project for Chapter 6 weighs in at 16 KB.
 

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
Yup its a too much difference.

I compared chp 6 and my file..I have zipped build file also.

I am totaly new to mac..started using from past 1-2 weeks and was not sure what all needs to be zipped. Thanks for informing me...!!!

So, I take it you added some stuff other than what is covered in the Chapter 6 code. Cuz 16 KB vs. 1.4 MB is a huge difference.
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Dejo...I emailed the file to you...any luck on it ...!!!
Still investigating...

I did notice you had:
Code:
MainViewController *mainController = [[MainViewController alloc]  initWithNibName:@"MaiVew"  bundle:nil];
where you want:
Code:
MainViewController *mainController = [[MainViewController alloc]  initWithNibName:@"MainView"  bundle:nil];

But, I fixed that and it didn't help... darn...

Hopefully just another typo elsewhere...
 

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
I had done that myself to check if it gives any error. That's when I said it is not reaching ViewDidLoad. But I forgot to edit it before zipping it.

Looking forward to your response....
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Got It!

If you're going to override the default loadView for a viewController, you need to make sure you still call the loadView for it's superclass.

So, instead of this in your MainViewController.m:
Code:
- (void)loadView {
	NSLog(@"Inside Main View");
}

you should be doing:
Code:
- (void)loadView {
	[super loadView];
	NSLog(@"Inside Main View");
}

With this change and the one from my previous post, things should work as expected.
 

bytezone

macrumors member
Original poster
Apr 20, 2009
64
0
Dejo,

THANKS a ton..!!! It worked.

I missed this as this what not mentioned in chapter 6 source code and also in the book...!!!!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.