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

RoKr93

macrumors newbie
Original poster
Oct 31, 2013
2
0
I have a reasonable amount of experience with C++ and Java, but I'm almost entirely new to iOS/Objective-C, so go easy on me.

I'm working on a very basic iPad application. I made a storyboard UIViewController with a couple of text fields and an image. My header file looks like this:

Code:
#import <UIKit/UIKit.h>

@interface FirstViewController : UIViewController{
    IBOutlet UITextView *directions;
    IBOutlet UITextView *equipment;
    IBOutlet UITextView *setup;
    IBOutlet UIImageView *tugPic;
    
}

@end
and my .m file looks like this:
Code:
#import "FirstViewController.h"

@implementation FirstViewController

-(void)viewDidLoad{
    if(self){
        directions.hidden = NO;
        equipment.hidden = NO;
        setup.hidden = NO;
        tugPic.hidden = NO;
        NSLog(@"Loaded!");
    }
}

@end
I expected this to display the image and text fields I'd created in my storyboard, but when I run the simulation, I just get a blank white screen. As far as I can tell, I linked all of my outlets to the view correctly, so I'm not sure what's wrong with this. Any help would be appreciated.

edit: the "loaded!" thing was a debug print statement I put in. It is not being printed, so it seems that my method isn't being accessed at all. Why might this be?
 
Last edited:

Duncan C

macrumors 6502a
Jan 21, 2008
853
0
Northern Virginia
I have a reasonable amount of experience with C++ and Java, but I'm almost entirely new to iOS/Objective-C, so go easy on me.

I'm working on a very basic iPad application. I made a storyboard UIViewController with a couple of text fields and an image. My header file looks like this:

Code:
#import <UIKit/UIKit.h>

@interface FirstViewController : UIViewController{
    IBOutlet UITextView *directions;
    IBOutlet UITextView *equipment;
    IBOutlet UITextView *setup;
    IBOutlet UIImageView *tugPic;
    
}

@end
and my .m file looks like this:
Code:
#import "FirstViewController.h"

@implementation FirstViewController

-(void)viewDidLoad{
    if(self){
        directions.hidden = NO;
        equipment.hidden = NO;
        setup.hidden = NO;
        tugPic.hidden = NO;
        NSLog(@"Loaded!");
    }
}

@end
I expected this to display the image and text fields I'd created in my storyboard, but when I run the simulation, I just get a blank white screen. As far as I can tell, I linked all of my outlets to the view correctly, so I'm not sure what's wrong with this. Any help would be appreciated.

edit: the "loaded!" thing was a debug print statement I put in. It is not being printed, so it seems that my method isn't being accessed at all. Why might this be?

If your viewDidLoad method isn't being called, it probably means that you are not creating a view controller of that type. Go to your storyboard, select the view controller object (the top-level object inside the scene) and bring up the "identity inspector". What is the class name of the view controller? If it's "UIViewController" then change it to your custom class (FirstViewController).
 

RoKr93

macrumors newbie
Original poster
Oct 31, 2013
2
0
Appreciate the reply, but it is already set to FirstViewController. I had to change that in order to link my outlets.
 

Duncan C

macrumors 6502a
Jan 21, 2008
853
0
Northern Virginia
Appreciate the reply, but it is already set to FirstViewController. I had to change that in order to link my outlets.

Dunno then. It is probably a problem with the way the project is set up that's hard/impossible to find except working with the project directly.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.