IBOutlet not connecting in Interface Builder-Xcode 4.2

I read other questions here, but they seem to be for Xcode 3.2 or earlier, but nothing for 4.2 .:(

I started a simple project and wanted to connect the File Owner Outlets outputs in my xib. Bummer that my IBOutlet from my ViewController.h is not suitable.

I don't have a reputation of 10 or higher, so here is a screenshot of my owner of a file not showing my IBOutlets .

Here is my ViewController.h code:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController { 
    IBOutlet UITextField *txtName; 
    IBOutlet UILabel *lblMessage;
}

@property (nonatomic, retain) IBOutlet UITextField *txtName;
@property (nonatomic, retain) IBOutlet UILabel *lblMessage;

- (IBAction)doSomething;

@end

Here is my ViewController.m code:

#import "ViewController.h"

@implementation ViewController

@synthesize txtName;
@synthesize lblMessage;

- (IBAction) doSomething
{
    NSString *msg = [[NSString alloc] initWithFormat:@"Hello, %@",txtName.text];
    [lblMessage setText:msg];
}

@end

I am new to Objective-C and Xcode, so I could be wrong, but I followed many tutorials and I can never show my IBOutlets. I uninstalled Xcode 4.2 and reinstalled it to fix this problem. Here is a screenshot of my version of Xcode version 4.2, build 4D199 .

- ? , , . , , .

+5
5

IBAction, .h . , .

, . XIB , .

Connect the IBAction to your button by dragging from the the .h file


, File Owner XIB . File Owner "". "" , Custom class, Identity Inspector , - .

Set files owner

, .

!

+16

xib.

IBOutlet.

, .

+4

, Xcode IBOutlet :

  • ViewController UITextField
  • @interface ViewController.h:

    @interface ViewController: UIViewController < UITextFieldDelegate

, Ctrl Storyboard .h, IBOutlet.

0

, , , , - . xib. , xib , , . , . FYI, . , ...

, xcode, .

0

All Articles