在最后一行,我收到错误:Duplicate interface definition for class "ViewController".
我想做一个IBAction。什么是错?我能做什么?请帮帮我。
//
// ViewController.h
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@interface SimpleEmailViewController : UIViewController <MFMailComposeViewControllerDelegate>
- (IBAction)showEmail:(id)sender;
@end
@interface ViewController : UIViewController <MFMessageComposeViewControllerDelegate> {
}
-(IBAction)sendMessage:(id)sender;
- (IBAction)showEmail:(id)sender;
@property (nonatomic, strong) IBOutlet UIWebView *site ;
- (IBAction)call:(id)sender;
@property (retain, nonatomic) IBOutlet UIButton *myBotton;
@end
@interface ViewController : UIViewController**i**
答案 0 :(得分:2)
问题正是错误所指出的。您定义了@interface viewController
两次。将其名称更改为其他名称。作为旁注,用名称apple已经使用的名称命名是一个可怕的想法。您应该将viewController
更改为其他内容,更具描述性,例如mailViewController或setupViewController。使用Apple定义的名称时可能会发生奇怪的事情。
@interface FSMainiPadViewController : UIViewController
答案 1 :(得分:1)
为什么不像这样简单?
// ViewController.h
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@interface ViewController : UIViewController <MFMailComposeViewControllerDelegate, MFMessageComposeViewControllerDelegate>
// Actions
- (IBAction)showEmail:(id)sender;
- (IBAction)sendMessage:(id)sender;
- (IBAction)call:(id)sender;
// Properties
@property (nonatomic, strong) IBOutlet UIWebView *site;
@property (retain, nonatomic) IBOutlet UIButton *myBotton;
@end