iphone - view controller not working?

688 views Asked by At

i'm newbie in iphone development, i'm studying, searching and learning much things about x-code and objective-c. i already started my project but i have some questions to do.

i've started my project as a tabbarcontroller app. it's something link a catalogue, with a bottom tabbar acting as the menu, with 4 tabs. the first tab must have a view with scroll of images side by side and zoom.

i searched around and i found jmDiap sample. i've started this sample alone and it works nicely. it's really all that i need. but now i have to put it inside MY project.

so i copied the classes. after, i took my subview for first tab (named Catalogo.xib) and selected its file's owner class as the (CatalogoController). the xib, m and h files were created with xCode creation wizard, so its connections are ok. i selected Catalogo as the nib to use in first tab.

my trouble is that nothing happened. when i try to put some code in loadView or viewDidLoad like:

self.view.backgroundColor = [UIColor greenColor];

to just see class working, nothing happens too.

can anybody help me please?

3

There are 3 answers

1
Purj0001 On

It definitely sounds like the View itself didn't get connected. Check to see if you connected the View object in the xib window to the actual view (in Interface Builder). I've forgotten this before and it can be super frustrating.

2
Thomas K On

Sounds to me like you didn't declare the nav controller in the header file of your app delegate.

@interface AppDelegate : NSObject <UIApplicationDelegate> {
    IBOutlet UIWindow *window;
    IBOutlet UITabBarController *rootController;

}

@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) UITabBarController *rootController;

@end

Make sure to hook up rootController to your App Delegate in the interface builder

0
mausalamon On

All the hell was object references. I use to be a PHP developer, but I work with many languages, PHP is the main. I always make my programs by coding and coding and coding, rarelly doing it with interface builder. I was a Delphi programmer and used to work with object place and position by interface builder. When we work with this kind of development, we can never forget the object references. We must always remember to clean the build first of all. This was my mistake this time. My objects in interface builder were alright hooked up. But xCode, behind the eyes messed up the references. All i have to do is clean the build and the project is ok again.

Sorry to borrow you, guys, but now I want to make it clear 4 everyone. Look to the references when you work with interface builders. Unity, Delphi, xCode, JBuilder, all other platform that you uses, remember to clean your builds.

Thx.