My view controller keeps blank!


#1

Hi, I reached page 154, when I had to create a view with two subviews (a label and a button), but when I run my app, I get a white screen, no label and no button.

I have had connected file’s owner to the view outlet of TimeViewController, indicated that the class of the XIB file’s Owner is TimeViewController and also connected the button and the label to the outlet and the method in .m file, but no luck

In the AppDelegate file I have written the code to set the rootView

TimeViewController *tvc = [[TimeViewController alloc] init]; [[self window] setRootViewController:tvc];

Any advise will be great!

Thanks a lot!


#2

Auto replyed!

For some extrange reason, my XIB got named TimeViewControllerXIB.xib, it should be TimeViewController.xib.

Fixed that and everything ok.

Best regards!


#3

I had the exact same problem, but for a different reason. When I had created my TimeViewController.xib file, I had a typo: I had forgotten the “t” in Controller and had typed TimeViewConroller.xib. I corrected the name in Xcode. When I added the “t” to the file’s name in Xcode, the actual file on my system (the one I can see in Finder) was renamed automatically, too.


#4

The template fills it in with the extra xib… I noticed that when it populated the name and I took it out


#5

I’m having this problem, in which I’m just getting a blank white screen appear. I am 100% sure I have not made a spelling error, so i don’t understand why it isn’t working. This problem occurred on pg 154 after I changed the root view controller to the new timeviewcontroller.

I am using Xcode 5 beta and iOS 7 beta.


#6

EDIT: Also tried it on Xcode 4.2 with the iOS 6.1 simulator and it still does not work.


#7

I had the same problem. I finally solved it. If you bring up the xib file, show the file inspector, make sure that “Target Membership - HypnoTime” is checked. Evidently, for me, the xib wasn’t linking in to the compiled run-time.

And since nil is a valid response for no xib file, it didn’t error out.

Mark


#8

Here’s another ‘rookie’ mistake that should be forever ensconced in the ‘Lessons Learned’ category. Right after I finished reading the warning in the book about following the BNR naming conventions, I noticed that my XIB file was named differently than the view controller. Thus, I would only get a blank screen.

When the two are named the same, it works perfectly.

Cheers,
Seth