Search code examples
objective-ciosxcode4.2xcode4.5outlet

Missing outlets in XCode


I'm doing my first iOS app and it should look like the following screenshot:

enter image description here

Nevertheless, I seem to have missing some connections, such as the ´window´and the ´delegate´ as the ´File's owner´, according to the screenshot of my project in Xcode:

enter image description here

I'm following the book iOS programming - the big nerd ranch guide, and since this books is using an older version of XCode -4.2 I think- I guess my problem has to do with this.

Could anyone please help me find out how to create those missing connections? How can I add that window to Window in the Outlets section and the delegate to the File's Owner in the Referencing Outlets section? Do I really need to add them?

Thanks a lot in advance!

EDIT: This is my header file:

#import <UIKit/UIKit.h>

@interface QuizAppDelegate : UIResponder <UIApplicationDelegate>
{
    int currentQuestionIndex;
    // The model objects
    NSMutableArray *questions;
    NSMutableArray *answers;

    // The view objects
    IBOutlet UILabel *questionField;
    IBOutlet UILabel *answerField;
}

@property (strong, nonatomic) UIWindow *window;

- (IBAction)showQuestion:(id)sender;
- (IBAction)showAnswer:(id)sender;

@end

Solution

  • Each view controller has a .h and .m files what I can see in your header file is that you are adding IBOutlet(s) to the App Delegate which is wrong. Please add them to the corresponding View Controller.

    Then open the storyboard or the xib file and attached the outlets to the UI elements.