Control-Drag to Auto-Generate Outlet and Make Connection


#1

When I attempt to auto-generate an outlet and make a connection by control-dragging a UITextField or UILabel from ItemDetailViewController.xib to the .h file (p. 214 ~ 215 in the book), I get the error message: “Could not insert new outlet connection: Could not find any information for the class named ItemDetailViewController”. What is it I’m doing wrong?

I’m trying to keep the question brief, but please let me know if more specifics are needed. Thanks in advance for any help.


#2

For some reason, it’s working for me today despite all actions being the same and no changes made to the file.

Can a moderator delete this topic for me? Thank you.


#3

Hi James,
even i am getting the same error. could you pls tell me what did you do to eliminate this?

thanks
Sachin


#4

its working fine now. i didnt do anything different but still i dont realise why it was not working earlier.


#5

I came here because of this very problem as well. Based on the times of the above postings, I decided to try shutting down Xcode and relaunching it. It worked perfectly.


#6

Mine worked ok, I just noticed that it seems to prefer creating everything as a property:

So in ItemDetailViewController.h it put:

@interface ItemDetailViewController : UIViewController
@property (retain, nonatomic) IBOutlet UITextField *nameField;
@property (retain, nonatomic) IBOutlet UITextField *serialNumberField;
@property (retain, nonatomic) IBOutlet UITextField *valueField;
@property (retain, nonatomic) IBOutlet UILabel *dateLabel;
@property (retain, nonatomic) Possession *possession;
@property (retain, nonatomic) IBOutlet UIImageView *imageView;
- (IBAction)takePicture:(id)sender;
@end

and in ItemDetailViewController.m it put:

@implementation ItemDetailViewController
@synthesize nameField;
@synthesize serialNumberField;
@synthesize valueField;
@synthesize dateLabel;
@synthesize possession;
@synthesize imageView;

Any reason for this vs. putting a more traditional declaration? I like this way as it seems to be a bit more terse, and less code, but I sometimes have a fear of these magic helpers…

Cheers,


#7

I got two great links from this post: kyleturner.me/blog/2011/09/helloyou.html

In the post, search for “More on atonomicity and properties”