开发者

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 (nonat开发者_C百科omic, 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


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

-(IBAction)slideDirections:(id)sender;


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜