IBOutlet not connecting in Interface Builder- Xcode 4.2

I have 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 was wanting to connect the File Owner's Outlets within my xib. The bummer is that my IBOutlet's from my ViewController.h aren't coming over.

I don't have a reputation of 10 or above, so here is a screenshot of my File's Owner 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 have made a mistake, but I've followed many tutorials and I can never get my IBOutlets to show. I have gone as far as to delete Xcode 4.2 and re-installed to try and fix this issue. Here is a screenshot of my Xcode Version 4.2, Build 4D199 info.

Anyone else run into this issue? Thanks anyone who can point out any mistakes I have made. Please let me know if more information is needed.

Answers


When you create your IBAction, in the .h file, there will be a connection indicator to the left of it. When it isn't connected it shows a empty circle.

Press and hold this and drag it to the item you want to connect it to. I usually open up the XIB in a new window by double clicking it.


If it wont connect you must set the File's Owner in the XIB file. Select File's Owner in the Placeholders panel. Move over to the Utilities panel and make sure the Custom class, in Identity Inspector, is set to what ever your viewcontroller is named.

I Hope this will help you.

Cheers!


Need Your Help

Do I need a custom Devise controller if only changing the Sign Up view?

ruby-on-rails rspec devise integration-testing capybara

I have the following steps in a capybara/rspec integration test, that is simply trying to sign up a new member.

c# taking multiple lines in a texbox and separating them

c#

Hello i'm trying to write a program that takes 3 user inputs: file path, username, and computer name and then create a batch file for each computer name in the list. I have not written the create b...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.