协议代表实施无效

时间:2012-11-15 07:15:37

标签: ios5 delegates protocols

我正在实现我的UIViewController类的协议。我需要在另一个类中执行本协议的方法。但它不起作用。

以下是代码。请帮帮我。

///This is my Header Class

#import <UIKit/UIKit.h>

@protocol PauseViewDelegate <NSObject>

- (IBAction)ResumeButtonPressed:(id)sender;
- (IBAction)MenuButtonPressed:(id)sender;
- (IBAction)RestartButtonPressed:(id)sender;

@end

@interface PauseViewController : UIViewController

@property (nonatomic, retain) id<PauseViewDelegate> pauseDelegate;

@end



////This is implementation class protocol Methods.

#import "PauseViewController.h"

@interface PauseViewController ()

@end

@implementation PauseViewController
@synthesize pauseDelegate;

- (IBAction)ResumeButtonPressed:(id)sender
{
    NSLog(@"resume delegate");
        [pauseDelegate ResumeButtonPressed:sender];

}
- (IBAction)RestartButtonPressed:(id)sender
{
    NSLog(@"Restart delegate");
    [self.view removeFromSuperview];
    [pauseDelegate RestartButtonPressed:sender];
}
- (IBAction)MenuButtonPressed:(id)sender
{
    NSLog(@"Menu delegate");
    [self.view removeFromSuperview];
    [pauseDelegate MenuButtonPressed:sender];
}

我在不同的视图控制器中使用这些方法,但它不起作用。

0 个答案:

没有答案