views:

82

answers:

3

I've been staring at this for way too long.

There's nothing fancy happening here, and I've done this dozens of times, yet Interface Builder steadfastly refuses to provide me an action target for -(IBAction)slideDirections. I'm at the point where I'm willing to post publicly and feel stupid. So let 'er rip.

Here's my .h:

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>

@interface PulseDetailController : UIViewController {
    NSDictionary *pulse;
    IBOutlet MKMapView *map;
    IBOutlet UIWebView *directions;
    IBOutlet UIView *directionsSlider;
    BOOL directionsExtended;
    IBOutlet UILabel *vendor;
    IBOutlet UILabel *offer;
    IBOutlet UILabel *offerText;
    IBOutlet UILabel *hours;
    IBOutlet UILabel *minutes;
    IBOutlet UILabel *seconds;
    IBOutlet UILabel *distance
}
@property (nonatomic, retain) NSDictionary *pulse;
@property (nonatomic, retain) MKMapView *map;
@property (nonatomic, retain) UIWebView *directions;
@property (nonatomic, retain) UIView *directionsSlider;
@property (nonatomic) BOOL directionsExtended;
@property (nonatomic, retain) UILabel *vendor;
@property (nonatomic, retain) UILabel *offer;
@property (nonatomic, retain) UILabel *offerText;
@property (nonatomic, retain) UILabel *hours;
@property (nonatomic, retain) UILabel *minutes;
@property (nonatomic, retain) UILabel *seconds;
@property (nonatomic, retain) UILabel *distance;

-(IBAction)slideDirections;

@end
+6  A: 

Shouldn't the IBAction have a sender parameter? Like:

-(IBAction)slideDirections:(id)sender;
pgb
I have plenty that don't and IB knows them fine.
Dan Ray
You should follow naming conventions anyway. The Objective-C runtime relies on them heavily. Yeah, they've allowed an increasing number of short cuts over the years but in my experience the short cuts work fine except for the 5% of the time they don't.
TechZen
From watching the Stanford iPhone course on iPhone programming (which is held by Apple employees) recently, there are, in fact 3 different valid parameter signatures for IBAction methods: without any arguments, with just the sender id and with sender id and an NSEvent.
Joost Schuur
Slight correction. The third method passes back a UIEvent. It's in lesson 4 of the Winter 2010 course of their iTunesU podcast.
Joost Schuur
A: 

Which objects are you trying to connect? From your header, the logical choice would be UIView *directionsSlider If you are ctrl dragging from directionsSlider to the "File's Owner" object, make sure that the Class in "File's Owner" is set to PulseDetailController.

falconcreek
Yeah, it was all set up right. Like I say, this isn't my first day, but it IS the first day not having an IBAction just show up on its own. But eventually and for no reason I can discern it just started working... So. There you go.
Dan Ray
Sometimes the indexing takes a while to catch up. Sometimes just walking away for a while is the right answer.
falconcreek
+2  A: 

Sometimes Interface Builder seems to get out of sync with classes in Xcode. Have you tried forcing interface builder to reread your PulseDetailController header file? (File -> Read Class Files... -> Select 'PulseDetailController.h'). This should force Interface Builder to see your new action.

Gotosleep
That must have been it, because when I set it aside and came back later in the day, it worked just fine as if there had never been any problem. Grumble.
Dan Ray
Olie