Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-07-2010, 10:53 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 17
CrystalBlue is on a distinguished road
Default viewDidLoad not being called after addSubview

I don't know if I'm doing something wrong or not, but I can't find the problem in my code yet.

I have two main views that I'm trying to get to work. One has been working, the other one won't show up when I call addSubview. And just to be sure, I am commenting their lines of code out to load each one individually for testing.

Here's my code...

UtilAppAppDelegate.h
Code:
#import <UIKit/UIKit.h>

@class UtilAppViewController;
@class DataSynchViewController;

@interface UtilAppAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
	
    UtilAppViewController *dwgViewController;
    DataSynchViewController *dsViewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@property (nonatomic, retain) IBOutlet UtilAppViewController *dwgViewController;
@property (nonatomic, retain) IBOutlet DataSynchViewController *dsViewController;

@end
UtilAppAppDelegate.m
Code:
#import "UtilAppAppDelegate.h"

#import "UtilAppViewController.h"
#import "DataSynchViewController.h"

@implementation UtilAppAppDelegate

@synthesize window;
@synthesize dwgViewController;
@synthesize dsViewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Override point for customization after app launch
    //[window addSubview:dwgViewController.view];
    [window addSubview:dsViewController.view];
    [window makeKeyAndVisible];

	return YES;
}


- (void)dealloc {
    [dsViewController release];
    [dwgViewController release];
    [window release];
    [super dealloc];
}


@end
UtilAppViewController.h
Code:
#import <UIKit/UIKit.h>

@interface UtilAppViewController : UIViewController {

}

@end
UtilAppViewController.m
Code:
#import "UtilAppViewController.h"

@implementation UtilAppViewController

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    NSLog(@"Hellos");
}

- (void)dealloc {
    [super dealloc];
}

@end
DataSynchViewController.h
Code:
#import <UIKit/UIKit.h>

@interface DataSynchViewController : UIViewController {

}

@end
DataSynchViewController.m
Code:
#import "DataSynchViewController.h"

@implementation DataSynchViewController

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    NSLog(@"Hellos");
}

- (void)dealloc {
    [super dealloc];
}

@end
Anyways, when I load up the UtilAppViewController (dwgViewController) I get the NSLog just fine. But when I, instead, try to load up the DataSynchViewController (dsViewController) nothing hapapens. It never gets to the viewDidLoad for that controller. What am I doing wrong here?
CrystalBlue is offline   Reply With Quote
Old 07-07-2010, 11:32 AM   #2 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 17
CrystalBlue is on a distinguished road
Default

After hitting my head against the computer enough times, I realized that I don't like Interface Builder. I had to set a reference outlet on the dsViewController. I'm still not getting any controls to show up, but as least I got to the viewDidLoad.
CrystalBlue is offline   Reply With Quote
Reply

Bookmarks

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



» Advertisements
» Online Users: 333
9 members and 324 guests
bignoggins, Chickenrig, firecall, givensur, iNet, michaelhansen, Objective Zero, PlutoPrime, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,893
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:33 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0