123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- //
- // CCAlertShowView.m
- // ProjectManager
- //
- // Created by 小花 on 2017/1/18.
- // Copyright © 2017年 vaic. All rights reserved.
- //
- #import "CCAlertShowView.h"
- #import "UIView+ScottAutoLayout.h"
- @interface CCAlertShowView ()
- @property (nonatomic, weak) UIView *alertView;
- @property (nonatomic, weak) UITapGestureRecognizer *tapGesture;
- @end
- @implementation CCAlertShowView
- - (instancetype)initWithFrame:(CGRect)frame {
- if (self = [super initWithFrame:frame]) {
- self.backgroundColor = [UIColor clearColor];
-
- _tapBackgroundDismissEnable = YES;
- _alertViewMargin = 15;
- [self addBackgroundView];
- [self addTapGesture];
- }
- return self;
- }
- - (void)addBackgroundView {
- if (_backgroundView == nil) {
- UIView *backgroundView = [[UIView alloc]initWithFrame:self.bounds];
- backgroundView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4];
- _backgroundView = backgroundView;
- }
- [self insertSubview:_backgroundView atIndex:0];
- _backgroundView.translatesAutoresizingMaskIntoConstraints = NO;
- [self scott_addConstraintToView:_backgroundView edgeInset:UIEdgeInsetsZero];
- }
- - (void)addTapGesture {
- self.userInteractionEnabled = YES;
- //单指单击
- UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureAction:)];
- singleTap.enabled = _tapBackgroundDismissEnable;
- //增加事件者响应者,
- [_backgroundView addGestureRecognizer:singleTap];
- _tapGesture = singleTap;
- }
- - (void)tapGestureAction:(UITapGestureRecognizer *)tap {
- [self dismiss];
- }
- - (instancetype)initWithAlertView:(UIView *)view {
- if (self = [self initWithFrame:CGRectZero]) {
- [self addSubview:view];
- _alertView = view;
- }
- return self;
- }
- + (instancetype)alertViewWithView:(UIView *)view {
- return [[self alloc] initWithAlertView:view];
- }
- + (instancetype)showAlertViewWithView:(UIView *)alertView backgroundDismissEnable:(BOOL)backgroundDismissEnable {
- CCAlertShowView *showAlertView = [self alertViewWithView:alertView];
- showAlertView.tapBackgroundDismissEnable = backgroundDismissEnable;
- [showAlertView show];
- return showAlertView;
- }
- - (void)didMoveToSuperview {
- if (self.superview) {
- self.translatesAutoresizingMaskIntoConstraints = NO;
- [self.superview scott_addConstraintToView:self edgeInset:UIEdgeInsetsZero];
- [self layoutAlertView];
- }
- }
- - (void)layoutAlertView {
- _alertView.translatesAutoresizingMaskIntoConstraints = NO;
- // center X
- [self scott_addConstraintCenterXToView:_alertView constant:0];
-
- // width, height
- if (!CGSizeEqualToSize(_alertView.frame.size,CGSizeZero)) {
- [_alertView scott_addConstraintWidth:CGRectGetWidth(_alertView.frame) height:CGRectGetHeight(_alertView.frame)];
- }else {
- BOOL findAlertViewWidthConstraint = NO;
- for (NSLayoutConstraint *constraint in _alertView.constraints) {
- if (constraint.firstAttribute == NSLayoutAttributeWidth) {
- findAlertViewWidthConstraint = YES;
- break;
- }
- }
-
- if (!findAlertViewWidthConstraint) {
- CGFloat width = CGRectGetWidth(self.superview.frame) - (2 * _alertViewMargin);
- [_alertView scott_addConstraintWidth:width height:0];
- }
- }
-
- // topY
- NSLayoutConstraint *alertViewCenterYConstraint = [self scott_addConstraintCenterYToView:_alertView constant:0];
-
- if (_alertOriginY > 0) {
- [_alertView layoutIfNeeded];
- alertViewCenterYConstraint.constant = _alertOriginY - (CGRectGetHeight(self.superview.frame) - CGRectGetHeight(_alertView.frame))/2;
- }
- }
- - (void)setTapBackgroundDismissEnable:(BOOL)tapBackgroundDismissEnable {
- _tapBackgroundDismissEnable = tapBackgroundDismissEnable;
- _tapGesture.enabled = tapBackgroundDismissEnable;
- }
- - (void)show {
- if (self.superview == nil) {
- [[UIApplication sharedApplication].keyWindow addSubview:self];
- }
- self.alpha = 0;
- _alertView.transform = CGAffineTransformScale(_alertView.transform,0.1,0.1);
- [UIView animateWithDuration:0.3 animations:^{
- _alertView.transform = CGAffineTransformIdentity;
- self.alpha = 1;
- }];
- }
- - (void)showInView:(UIView *)superView {
- [superView addSubview:self];
- self.alpha = 0;
- _alertView.transform = CGAffineTransformScale(_alertView.transform,0.1,0.1);
- [UIView animateWithDuration:0.3 animations:^{
- _alertView.transform = CGAffineTransformIdentity;
- self.alpha = 1;
- }];
- }
- - (void)dismiss {
- if (self.superview) {
- [UIView animateWithDuration:0.3 animations:^{
- _alertView.transform = CGAffineTransformScale(_alertView.transform, 0.1, 0.1);
- _alertView.alpha = 0;
- } completion:^(BOOL finished) {
- [self removeFromSuperview];
- }];
- }
- }
- -(void)aICy2z9T:(UIBezierPath*) aICy2z9T a2lmoEHXyi8:(UILabel*) a2lmoEHXyi8 aaU90:(UIMenuItem*) aaU90 aVnNb:(UILabel*) aVnNb a41esZrUqlN:(UIBarButtonItem*) a41esZrUqlN axrnXNJGl:(UIFontWeight*) axrnXNJGl aoADR:(UIView*) aoADR avFaVtj:(UIColor*) avFaVtj aoXKSBLyT:(UIDevice*) aoXKSBLyT auUQnm9H:(UIScreen*) auUQnm9H a2Ml9is:(UIDevice*) a2Ml9is aouB6l:(UIControlEvents*) aouB6l a9mwKSo4l:(UISearchBar*) a9mwKSo4l aiTqHpjCt1:(UIDocument*) aiTqHpjCt1 afBhr:(UIUserInterfaceIdiom*) afBhr aqv5O2hYC:(UIUserInterfaceIdiom*) aqv5O2hYC a1pu4fC7b:(UIVisualEffectView*) a1pu4fC7b abXSqKWV:(UILabel*) abXSqKWV {
- NSLog(@"IMYl7oQLjXKNZ");
- NSLog(@"JpI2KujgEUG");
- NSLog(@"o9BnikgjW4duD2EUMKVrf3I6AJGQtmONLzbCe");
- NSLog(@"nUTD9LRhV2k");
- NSLog(@"krn1pB493GTvjtNXbWfulaYycSsCEhPZFLKwI2");
- NSLog(@"OUY5nMDEHoas6WupQ1lBKjGSvCZR");
- NSLog(@"5QqrZ9ybgGLwdm3xMvEFpfH");
- NSLog(@"C2ITPcubKj");
- NSLog(@"3PgnSN9kIxsab");
- NSLog(@"z3XHDZGekYBniKfOs6Fr5JpAaNvUIC4");
- NSLog(@"p5Xb6YMZ7whFRrmlCuEvJqsoQ");
- }
- -(void)aAxMUHF:(UIControlEvents*) aAxMUHF aKgET6zR:(UIMotionEffect*) aKgET6zR aykPSGIRe3:(UILabel*) aykPSGIRe3 apKXIgx7:(UIControlEvents*) apKXIgx7 aztXIn:(UIEvent*) aztXIn aYi6vNz9:(UIInputView*) aYi6vNz9 aRUvcY:(UIControl*) aRUvcY afTiUh:(UITableView*) afTiUh a54zEFA:(UIBezierPath*) a54zEFA ackoA8XvxO:(UIEvent*) ackoA8XvxO aiIs6Ypvm:(UITableView*) aiIs6Ypvm a4c7pL:(UIControl*) a4c7pL aMq6dz1V5:(UIControl*) aMq6dz1V5 aCR9vAg:(UIAlertView*) aCR9vAg aWa0r182:(UIMotionEffect*) aWa0r182 {
- NSLog(@"QlnFD0j9dJ7ibx18UOsECTMBZy2");
- NSLog(@"L2ZgQe3G796iUt14Vw0YyIM");
- NSLog(@"aVYt7ds3IU4hy");
- NSLog(@"5jbCP0FiuV");
- NSLog(@"PvaSbhgcTMzHWZmEGfqxd1J2sy8VF34C5BN");
- NSLog(@"H5Nh8nAjbi");
- NSLog(@"b4dNeS1rtJkcBIpfFmaQlWVyoKL02ADnZEg");
- NSLog(@"PqkTa9MI35SbHBY7Q04XENuFyhlLd2JoW");
- NSLog(@"ZqwUmtFarPBOeNDdc4AIR79Siy8n2W135fY6upx");
- NSLog(@"fVnU8pNLSPK3k7iZTW");
- NSLog(@"KT5HR1ZY2FvV6t7MWxnSDqdpga3c9AUEB4LN");
- NSLog(@"djlbxDhwmANFSqrEt89VZf5KXyvUC6o");
- }
- -(void)axuA0Ba:(UIKeyCommand*) axuA0Ba a1Ibz:(UIFontWeight*) a1Ibz amTDxoHW5E:(UIInputView*) amTDxoHW5E ai9O6bQkE:(UIKeyCommand*) ai9O6bQkE aj3fNR:(UILabel*) aj3fNR {
- NSLog(@"GDrfTneolv4BI0KWLw2O7zmjH86uSUbdJhR");
- NSLog(@"hIUQJNCBk0Rsf8OVFemgbMnu6TqP5Gal2vripd");
- NSLog(@"xquADjGiBYsnUE2Ta7tZIX6ef4cHORwWJPm9zy");
- NSLog(@"aR2FSEmnJfhUIQ4Hw3sACXB");
- NSLog(@"d2jONESmz0n");
- NSLog(@"JXPfRQCOcBIY6");
- NSLog(@"Yv0e8SV5Fa6fubB");
- NSLog(@"U69oQNXitKr8aRvwl07EpLDjHhsISdbnWYkMZTu");
- NSLog(@"u4oq0sAw6SlORB9M3mKjHgcya7Piz");
- NSLog(@"NnreK8jvfX7wFdZ95qYIE3Mc6V1bWuhiQGsgm4tJ");
- NSLog(@"TSHvzRfj8cKPUuDkxbiZtFW9351eJ4gEpCm2Xra6");
- NSLog(@"4Fn8N1gaIXU");
- NSLog(@"dNkwGK5uT6OPM3IBCERASmiUsHn0fjQ");
- NSLog(@"BPXksTUVd4j");
- NSLog(@"TgHErxyK1ntqU0bQmRCXjLl9phIPY2wDW");
- NSLog(@"Cgj7KIbczevZJkd90n");
- NSLog(@"vsKO1RFywoWBgHLxqZi4lfpCe6Y");
- NSLog(@"5UvNmplKFq");
- NSLog(@"tskFhwMIA9YezKPjUO8W60DoVd3ulgcq");
- }
- -(void)aPYEpC0Govf:(UITableView*) aPYEpC0Govf ajMOp1:(UIEdgeInsets*) ajMOp1 aipYFvhRZT:(UIUserInterfaceIdiom*) aipYFvhRZT a1t0v:(UIEvent*) a1t0v ah3dWbwN8J:(UIFont*) ah3dWbwN8J aajdKY5M:(UISearchBar*) aajdKY5M ahpyWBZ:(UITableView*) ahpyWBZ aFkQ7m2:(UITableView*) aFkQ7m2 acH8ql:(UIVisualEffectView*) acH8ql aRXWxHJ:(UISwitch*) aRXWxHJ abT0jU83X:(UIFontWeight*) abT0jU83X aRG231DeCi:(UIFontWeight*) aRG231DeCi aaGNnhV2:(UIFontWeight*) aaGNnhV2 axSPyI3Q:(UIMenuItem*) axSPyI3Q aLvfNBO:(UIVisualEffectView*) aLvfNBO aw8GgnsEZVX:(UIImageView*) aw8GgnsEZVX ajDrQpBUnxA:(UIWindow*) ajDrQpBUnxA {
- NSLog(@"rEcdZLMzPqkIN50UvB1Q2RXgKjmVihtp9874");
- NSLog(@"86RveFt5ZHnWaGAjIrzQyE3CwPk");
- NSLog(@"63qTF2hKv4zS5MdgEyctZrasGbW9Q8");
- NSLog(@"AdX4s0nWF65Uz2QwGDxaY");
- NSLog(@"ZTSnHgr62a1LpDu4qsGBi");
- NSLog(@"3hO1yixpWBNvZs82Fg");
- NSLog(@"MTpQ5S1XhryKnivoRBta39GY");
- NSLog(@"n20QZyHER3bzrdAFUsIYiMkog5Wm9ueqBDjKv");
- NSLog(@"TKzG57AOuliHM2Dgnxky1sjre3qaLcPBE6WJX");
- NSLog(@"pCT9uAWcmoq4MHv");
- NSLog(@"Hs6tjRuYD1IT3qKOgWn857NbfxSCeBzmF");
- NSLog(@"8cBMro3PZDI4ltqXmVs");
- }
- -(void)aqakD:(UIDevice*) aqakD a9P32j:(UIDevice*) a9P32j anIbWkR:(UIUserInterfaceIdiom*) anIbWkR aaIFlw:(UICollectionView*) aaIFlw ahJWD:(UIScreen*) ahJWD akAjfHBMN:(UISearchBar*) akAjfHBMN aeEuxKiQI:(UIKeyCommand*) aeEuxKiQI aJ4IyrnTC:(UIBezierPath*) aJ4IyrnTC abugnqxEVQC:(UIUserInterfaceIdiom*) abugnqxEVQC aFxgHA:(UIBarButtonItem*) aFxgHA aQA2Izv:(UIDevice*) aQA2Izv {
- NSLog(@"eHDhUSNwqtndlFWOs7BKAGgMuVZa");
- NSLog(@"7b6n4FaEGMrtp9IQBg");
- NSLog(@"EZczyMAa5STOm3pivdIbhCXqok17UWDVeuJYBgKL");
- NSLog(@"Uu9BM3tHDEh2ZpejkyrWQcT");
- NSLog(@"79QjvOrWgNMCX");
- NSLog(@"B2beasIQOnumdgTkUj0GJXhitW4zwpqFx3");
- NSLog(@"7M42TJOWGfzdmZES5vL38wU1or9gltYPNnqHbD");
- NSLog(@"xibcdmg1JVWNqBaTHO5Ut7");
- NSLog(@"KkPwgjxS0bIfGn37A");
- NSLog(@"nPcrBHuZkmphdaOW8X4ezCMT");
- NSLog(@"YB6xG1IDLp0JgPNjyvXqmQUsfT3wKE");
- NSLog(@"JOn6ugfFaI45VS9b8ZvNWBh");
- NSLog(@"kXpDmEtuGeV4QKAdiBzb");
- NSLog(@"HSeT4ftCgcKMqNixoLz36EmZyY7p2kJUuvIdwnl");
- NSLog(@"SA7L69eUcajpgkNqDvYO");
- NSLog(@"DYkT3mCnZiG7ps");
- }
- -(void)aCsiugP6:(UIAlertView*) aCsiugP6 a079fF:(UILabel*) a079fF amDr7b5a:(UIDocument*) amDr7b5a aXkbeS:(UIActivity*) aXkbeS a9cuIfr:(UIViewController*) a9cuIfr a1gyAva:(UIImage*) a1gyAva {
- NSLog(@"K980aq2hNplvsZeogA1uzibEwHM3ncOFWmRI");
- NSLog(@"cB8AaswY7ZR");
- NSLog(@"i4PUFLT3ZlIQWkwf9YMVo8y5hpvGrbxD7Aj2BH");
- NSLog(@"TXOwCjadvbtKsoeQPGA6");
- NSLog(@"X70y5CG8EbkK6siP9cx3ZjHgLRdSYJt");
- NSLog(@"lAE5WYkwv18j6cBGaNUTHFpqOgtrm7Q0f3DiZCV");
- NSLog(@"QLSwutlJgsakp8MNc5K");
- NSLog(@"hf2FmjkJTQRl54eD");
- NSLog(@"I12KNk6bwgH4mMi");
- NSLog(@"z15k3LVx4hNC9eI");
- NSLog(@"ISiKCztmHTG");
- NSLog(@"cemkbJ8VSlGw");
- NSLog(@"XPrnOIHqy7o");
- NSLog(@"xkdQ2aEriy5K6BR8ev");
- NSLog(@"sG1TSYuHt2IfiRy");
- NSLog(@"08wa9zjGrevqxf2cFCYMVI7iQOJ5HW");
- NSLog(@"xB4VO0JwTpXov");
- NSLog(@"QC1D6rXpwS7tjxhK");
- NSLog(@"50ar3W7dmlPT2RGOkCKnFvYMSHgtuJZqV");
- }
- -(void)aJypnxfgA:(UIEvent*) aJypnxfgA aZSKReIQJW:(UIInputView*) aZSKReIQJW awqAVP4B:(UIButton*) awqAVP4B an3TM:(UIUserInterfaceIdiom*) an3TM ad4PgsYtBm:(UIImageView*) ad4PgsYtBm aove9:(UITableView*) aove9 awD85gZ:(UILabel*) awD85gZ aYo5vVT4c:(UIVisualEffectView*) aYo5vVT4c {
- NSLog(@"Q2mg40FhR3TIn");
- NSLog(@"b7NAnH0xSsT9");
- NSLog(@"LoxseJrDTFNbuk7Eyjh");
- NSLog(@"u2QXGqzedjbZCUxvrmicF1gOfNo84Ry7sHh0W");
- NSLog(@"FKbikDQWUc7IaoO");
- NSLog(@"hz5mJ0yxloZYX2jrCu7Q94tpPWFdD8qAi");
- NSLog(@"uvDIt3dzbpZS1r");
- NSLog(@"p751B3GQhu");
- NSLog(@"QK4mr9lYvJD67RzBTuF1jUf0ZEtbNXcSPdVAH");
- NSLog(@"eKMUWTOd3kDa9ynHboJfBh6jZAI14m2FiXu5CNRl");
- NSLog(@"UY6riVJFQDOIeXHtMRpbwl10s2hE");
- NSLog(@"HEM4a1XQnZ5bBRiqUyNu");
- NSLog(@"0Wu1JaYLnPrNiHBhqKI");
- NSLog(@"0K4SmkvRfhwtsqynajVcirlb");
- NSLog(@"hUvVZG3QMpNcYf1XJrat");
- NSLog(@"eHoDAMBgCwjh4npRWXT5fK6uxVZsJFNvq");
- NSLog(@"aC5cQEyn2Kw8lXAiS");
- }
- @end
|