Nav Link On

iPhone Dev Forums > General Development > SDK Coding Help > View Controller problem

Reply

 

LinkBack Thread Tools Display Modes
Old 06-16-2008, 03:42 PM   #1 (permalink)
Member
Default Avatar
 
Join Date: May 2008
Posts: 81
Default View Controller problem

I have a problem in my app... I write my own view controller for controlling my NIB user interface, but it is not working.

Here's what I have. I have a TabBar application (started from XCODE TabBar App template). Each TabBarItem loads view from external NIB file. Here is the screenshot for this:



First TabBar item loads content from HomView NIB file, which uses HomeViewController (referenced in File's owner in IB) that I wrote... Here is this screenshot:



When I launch my App view is loaded ok, but the problem start when I want to write some code in HomeViewController for example to set some label text... I tried to do that in

1) - (void)awakeFromNib
2) - (void)viewDidLoad {
3) - (id)initWithNibNameNSString *)nibNameOrNil bundleNSBundle *)nibBundleOrNil

but none of these method are being called when I run my app. What am I doing wrong here?

Thanks for helping,
Jume
Jume is offline   Reply With Quote
Old 06-17-2008, 03:10 PM   #2 (permalink)
Member
Default Avatar
 
Join Date: May 2008
Posts: 81
Default

I figured out what was the problem... If some wants to know I post image here. It's the easiest way I can explain




Thanks for helping
Jume is offline   Reply With Quote
Old 06-17-2008, 05:37 PM   #3 (permalink)
Administrator
 
MacTyler's Avatar
 
Join Date: Mar 2008
Posts: 165
Smile

Sorry I wasn't any help. Glad to hear you got it working! Also thanks for updating your post with how you got it working, that is really helpful to others that are having your same problem.
MacTyler is offline   Reply With Quote
Old 06-18-2008, 09:08 AM   #4 (permalink)
Member
Default Avatar
 
Join Date: May 2008
Posts: 81
Default

Sure Tyler ;)! I hope someone finds it useful! It might be stupid questions for most, but for me as a newbie to Cocoa and iPhone development this bindings/connections are completely new world!

If I continue with my UI quest. Now I've completed view controller for my first TabItem and it works. Now for the second TabItem I want it to be a UINavigationController and not UIViewController and it is again loaded from external NIB file. Looks like this:


and the ChannelView.nib looks like this:


The problem: files are somehow not linked. The content of ChannelView is not display once I click on second TabItem in my TabBar. The result looks like this:



What is wrong here? Do I have to subclass UINavigationController and put it into File's owner of ChannelView.nib - the same as I did for UIViewController for the first TabItem?

@MacTyler: once I'm done with this GUI layout (all different controllers together) in InterfaceBuilder I would like to write a complete tutorial with images and code, just so people can see how all the connections are done. There are virtually no IB examples on Apple Developer site or documentation. Can I post it on this forum?

Last edited by Jume; 06-18-2008 at 09:14 AM.
Jume is offline   Reply With Quote
Old 06-18-2008, 09:58 AM   #5 (permalink)
Member
Default Avatar
 
Join Date: May 2008
Posts: 81
Default

Ok figured it out myself again . This looks like an Interface Builder bug in this version of SDK (I'm using beta 7).

Here what's wrong:
(Check the .xib objects window and Tab Bar Controller Attributes. The classes are different. If you change view controller class in .xib object window to UINavigationController it doesn't change in attribute window...)



So the solution is to change class in attribute window only, and then IB adds right class to tab controller's view controller. It's done like this:



And the result is that IB then adds UINavigationController automatically to Tab Bar's view controller. Looks like this:
Jume is offline   Reply With Quote
Old 06-20-2008, 04:29 PM   #6 (permalink)
Member
Default Avatar
 
Join Date: Jun 2008
Posts: 56
Default

Thanks for posting the solutions - I can guarantee I would have run into the same problems
wyvwyv is offline   Reply With Quote
Old 06-24-2008, 02:58 PM   #7 (permalink)
Administrator
 
MacTyler's Avatar
 
Join Date: Mar 2008
Posts: 165
Default

Hey Jume, I would love for you to make an IB tutorial. I would even make a specific Tutorial forum. I think it would be a really great addition!
MacTyler is offline   Reply With Quote
Old 06-24-2008, 03:21 PM   #8 (permalink)
Member
Default Avatar
 
Join Date: May 2008
Posts: 81
Default

Quote:
Originally Posted by MacTyler View Post
Hey Jume, I would love for you to make an IB tutorial. I would even make a specific Tutorial forum. I think it would be a really great addition!
I will do it, I already keep some picture material for this tutorial. I just need a bit more time to get more familiar with it.
Jume is offline   Reply With Quote
Old 11-28-2008, 12:45 PM   #9 (permalink)
Junior Member
Default Avatar
 
Join Date: Nov 2008
Posts: 1
Default

Hi,

Did you write a tutorial on this? I am still having some problems and a tutorial would be really helpful as I'd much rather do this with IB than in code...

Thanks.
ichi is offline   Reply With Quote
Old 04-24-2009, 06:27 AM   #10 (permalink)
Junior Member
Default Avatar
 
Join Date: Apr 2009
Posts: 1
Default Hello June

Very nice tutorial,

I'm very noob on this, i need some help to continue.

I do all what you do, ...

How do you make the navigation bar works with a table view at this point, can you make a sample to us : ) please : )

Just the same case with tab bar + navigation bar -> with a table view

I try many things and i dont know how to change the navigation bar title or populate the table view (my idea: make a table view with a detail view)

Thanks ; )
drwxr is offline   Reply With Quote
Reply

iPhone Dev Forums > General Development > SDK Coding Help


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC1