UIWebView实现左滑, 右滑__前进,后退

2017-03-23  本文已影响0人  飞天蛤蟆

import "RGWebView.h"

@interface RGWebView()

@property (nonatomic, strong) UIView *redView;
@property (nonatomic, strong) UIView *blueView;
@property (assign, nonatomic) NSInteger start;
@property (assign, nonatomic) BOOL backBool;
@property (assign, nonatomic) BOOL forwardBool;

@end

@implementation RGWebView

-(instancetype)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
self.start = 0;
self.backBool = NO;
self.forwardBool = NO;
[self setupUI];
}
return self;
}

-(void)setupUI{
if (nil == _redView) {
_redView = [[UIView alloc]init];
_redView.backgroundColor = [UIColor redColor];
[self addSubview:_redView];
}
if (nil == _blueView) {
_blueView = [[UIView alloc]init];
_blueView.backgroundColor = [UIColor blueColor];
[self addSubview:_blueView];
}
UIPanGestureRecognizer *gesture = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panGesture:)];
[self addGestureRecognizer:gesture];
}
-(void)layoutSubviews{
[super layoutSubviews];
self.redView.frame = CGRectMake(-100, 100, 100, 50);
self.blueView.frame = CGRectMake(KScreen_Width, 100, 100, 50);
}

pragma mark === gesture===

@end

上一篇下一篇

猜你喜欢

热点阅读