实施不完整

时间:2011-11-30 23:03:32

标签: ios xcode

我在我的实施页面上收到了一个不完整的实施警告,我已经注释掉了:

#import "BIDDatePickerViewController.h"

@implementation BIDDatePickerViewController   // Incomplete implementation

@synthesize datePicker;

- (IBAction)buttonPressed:(id)sender
{
    NSDate *selected = [datePicker date];
    NSString *message = [[NSString alloc] initWithFormat:@"The date and time you selected is:%@", selected];
    UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"Date and Time Selected" 
                          message:message 
                          delegate:nil 
                          cancelButtonTitle:@"Yes I did" 
                          otherButtonTitles:nil];
    [alert show];
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    NSDate *now = [NSDate date];
    [datePicker setDate:now animated:NO];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    self.datePicker = nil;

}
@end

此信息的自定义部分,显示日期,所选时间未正确显示。为什么呢?

以下是界面文件:

#import <UIKit/UIKit.h>

@interface BIDDatePickerViewController : UIViewController

@property (strong, nonatomic) IBOutlet UIDatePicker *datePicker;

-(IBAction)buttonPressed;

@end

2 个答案:

答案 0 :(得分:13)

您收到警告的原因是您在定义方法- (IBAction)buttonPressed:(id)sender时实施了方法-(IBAction)buttonPressed;。注意界面上没有参数。

答案 1 :(得分:0)

在您的.h文件中,您有- (IBAction)buttonPressed;,并且在您的.m文件中有- (IBAction)buttonPressed:(id)sender。您的.m文件中应该有- (IBAction)buttonPressed;