0

我想将操作表放入重用类,但是当我单击操作表时,应用程序崩溃并且错误是 EXC_BAD_ACCESS。

MOTestAction.h

#import <Foundation/Foundation.h>

@interface MOTestAction : NSObject<UIActionSheetDelegate>
{
    UIActionSheet * actionSheet;
}
- (id) initWithAction;
- (void) showInView:(UIView *) view;
@end

MOTestAction.m #import "MOTestAction.h"

@implementation MOTestAction

- (id) initWithAction
{
    self = [super init];

    if (self) {
        actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"Cancle" destructiveButtonTitle:nil otherButtonTitles:nil, nil];

        }
        return self;
    }

- (void) showInView:(UIView *) view
{
    [actionSheet showInView:view];

}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;
{

}

@end

呼叫者,召集者:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically 
    MOTestAction * moActionSheet = [[MOTestAction alloc]initWithAction];
    [moActionSheet showInView:self.navigationController.toolbar];


}
4

0 回答 0