Xcode4.3 UIActionSheet导致错误消息

时间:2013-03-29 14:54:30

标签: ios xcode uiactionsheet

该应用在测试时效果非常好,但在delegate:self旁边我得到了......

  

将'ViewController * const __strong'发送到不兼容的参数   输入'id< UIActionSheetDelegate>'

非常感谢任何有关此事的帮助,因为我已经有好几天了!

我的Viewcontroller.h是......

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

#import "Accounts/Accounts.h"
#import <MessageUI/MessageUI.h>


@interface ViewController : UIViewController<MFMailComposeViewControllerDelegate>

{
    UIAlertView *objresponseAlert;
}
@property (weak, nonatomic) IBOutlet UITextView *myTextView;

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

在我的ViewController.m中,我有......

- (IBAction)emailButton:(id)sender {    
    UIActionSheet *actionsheet = [[UIActionSheet alloc]
                                  initWithTitle:@"Title"
                                  delegate:self
                                  cancelButtonTitle:@"Cancel"
                                  destructiveButtonTitle:nil
                                  otherButtonTitles:@"Email", nil];
    [actionsheet showInView:self.view];
}

1 个答案:

答案 0 :(得分:5)

这很完美!

// Make Class conform to UIActionSheet delegate
@interface ViewController : UIViewController<MFMailComposeViewControllerDelegate,UIActionSheetDelegate>