iOS beginner- things not appearing on screen

Discussion in 'iOS Programming' started by RoKr93, Oct 31, 2013.

  1. RoKr93, Oct 31, 2013
    Last edited: Oct 31, 2013

    RoKr93 macrumors newbie

    Joined:
    Oct 31, 2013
    #1
    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?
     
  2. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #2
    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).
     
  3. RoKr93 thread starter macrumors newbie

    Joined:
    Oct 31, 2013
    #3
    Appreciate the reply, but it is already set to FirstViewController. I had to change that in order to link my outlets.
     
  4. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #4
    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.
     

Share This Page