| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- //
- // SusBaseWindow.m
- // BuguLive
- //
- // Created by 岳克奎 on 16/9/24.
- // Copyright © 2016年 xfg. All rights reserved.
- //
- #import "SusBaseWindow.h"
- @implementation SusBaseWindow
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self)
- {
- self.windowLevel = UIWindowLevelStatusBar - 2;
- [self addGesture];
- self.backgroundColor = [UIColor blackColor];
- }
- return self;
- }
- #pragma mark - 加手势
- - (void)addGesture
- {
- [self initTapGes];
- [self initPanGes];
- }
- #pragma amrk - Tap Ges
- - (void)initTapGes
- {
- _window_Tap_Ges = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGesClick:)];
- [self addGestureRecognizer:_window_Tap_Ges];
- }
- - (void)tapGesClick:(UITapGestureRecognizer *)tap
- {
- [IQKeyboardManager sharedManager].enable = NO;
- [IQKeyboardManager sharedManager].enableAutoToolbar = NO;
-
- // 关闭键盘
- [BGUtils closeKeyboard];
-
- if ([IQKeyboardManager sharedManager].keyboardShowing)
- {
- [FanweMessage alert:ASLocalizedString(@"请先关闭键盘")];
- return;
- }
-
- if (SUS_WINDOW.reccordSusWidnowSale)
- {
- //tap
- if (_susBaseWindowTapGesBlock)
- {
- _susBaseWindowTapGesBlock();
- }
- }
- }
- #pragma mark - Pan Ges
- - (void)initPanGes
- {
- _window_Pan_Ges =[[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(panGesClick:)];
- _window_Pan_Ges.delaysTouchesBegan = NO;
- [self addGestureRecognizer:_window_Pan_Ges];
- }
- - (void)panGesClick:(UIPanGestureRecognizer *)pan
- {
- if (SUS_WINDOW.reccordSusWidnowSale)
- {
- if (_susBaseWindowPanGesBlock)
- {
- _susBaseWindowPanGesBlock();
- }
- }
- }
- #pragma mark- window 剪切 下角
- - (void)setWindowCorner
- {
- self.layer.cornerRadius = 8;
- self.layer.masksToBounds = YES;
- }
- - (void)setIsSusWindow:(BOOL)isSusWindow
- {
- _isSusWindow = isSusWindow;
- }
- @end
|