Objective-C类中的不完全实现

Objective-C类中的不完全实现,objective-c,Objective C,这是我的ViewController.h,它很短很简单,所以我认为这可以用 // // ViewController.h // Blue Bird // // Created by Chandler Davis on 12/23/11. // Copyright (c) 2011 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> #import <Twitter/Twitter.h&g

这是我的ViewController.h,它很短很简单,所以我认为这可以用

//
//  ViewController.h
//  Blue Bird
//
//  Created by Chandler Davis on 12/23/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

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

@interface ViewController : UIViewController

- (IBAction)Button: (id)sender;
@end

您需要实际实现
-(iAction)按钮:(id)sender在ViewController.m中的ViewController.h中定义的方法:

- (IBAction)Button: (id)sender{
   // Do things here
}

因为你已经添加了这个方法

- (IBAction)Button: (id)sender;
在.h文件中,但不在.m文件中,这就是为什么

解决方案:您可以从.h文件或.m文件中定义的方法中注释该行

这将解决问题


享受吧

我也收到了同样的警告,在我将该功能从一个视图移动到另一个视图后,我忘记删除了一个未使用的iAction

我对这一点相当陌生,所以我很抱歉,但是“注释.h文件中的那一行或.m文件中定义的方法”是什么意思?“注释(out)”意味着将
/
放在它前面,这样它就会变成编译器忽略的注释。在程序中我应该在哪里实现它?在ViewController.m文件中,
@implementation ViewController
@end
之间的任意位置。
- (IBAction)Button: (id)sender;