Dan Ray
Dan Ray

Reputation: 21893

Why doesn't IB see my IBAction?

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

Upvotes: 3

Views: 880

Answers (3)

gotosleep
gotosleep

Reputation: 328

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.

Upvotes: 3

falconcreek
falconcreek

Reputation: 4170

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.

Upvotes: 0

pgb
pgb

Reputation: 25001

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

-(IBAction)slideDirections:(id)sender;

Upvotes: 6

Related Questions