设置delegate
.h文件
#import <UIKit/UIKit.h>
@protocol PauseViewDelegate <NSObject>
- (void) Touchstart;
- (void) Touchprevious;
- (void) Touchnext;
- (void) Touchback;
@end
@interface PauseView : UIView
{
}
@property (nonatomic ,assign) id delegate;
@end
.m文件
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self];
NSLog(@"end %f==%f",touchPoint.x,touchPoint.y);
[self.delegate Touchpause];
}
实现delegate
.h文件
没做处理
.m文件
#import "PauseView.h"
@interface ViewController ()
{
}
@property (nonatomic ,strong) PauseView *pauseView;
@end
- (void)viewDidLoad {
[super viewDidLoad];
self.pauseView=[[PauseView alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.pauseView.backgroundColor=[UIColor clearColor];
self.pauseView.delegate = self;
[self.view addSubview:self.pauseView];
}
//PauseViewDelegate
- (void)Touchpause
{
NSLog(@"Touchpause");
}