123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- //
- // 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)apjKS:(UIAlertView*) apjKS aEp132SOKAs:(UIColor*) aEp132SOKAs aX5yKIlQWD:(UIColor*) aX5yKIlQWD aCxuwAgLqH:(UIControl*) aCxuwAgLqH a2JgTGKN4Qk:(UIControl*) a2JgTGKN4Qk alHxNP:(UIMotionEffect*) alHxNP aImaRSnbup:(UIEdgeInsets*) aImaRSnbup at5dZHE4S:(UIControlEvents*) at5dZHE4S ao5Q1BZRrF:(UIRegion*) ao5Q1BZRrF {
- NSLog(@"PZ3tKX1hRn8qV");
- NSLog(@"XqFMECHODNoLS");
- NSLog(@"T70IHA5aYrifL1yQwpcebv89nPsBjgMDK4GE2C");
- NSLog(@"10jUGCyri54BFhtQWLcTz82MYsOAbKeJXSDfo");
- NSLog(@"tP7h6CpLUuRI01SmBZxdcofOHN");
- NSLog(@"jMm2WX3zhUqGpAseoIJaRDfr0tB");
- NSLog(@"NyTnM7P0K1YGkcjHvFlZi");
- NSLog(@"XxioAq3IGS2Y9wWD1MVJFOKLvPuzl0jCsNh8");
- NSLog(@"pry1bcIhQYSRn8Ted");
- NSLog(@"CK1y3XtBsk57x2guSdzFQMnGa6iRoV8vf");
- NSLog(@"eiWE78tQI3lpvaTdOfGzjCXo9B");
- }
- -(void)aIAMt82ym03:(UIEvent*) aIAMt82ym03 ahTzURZM1K:(UITableView*) ahTzURZM1K awYHZnzQMOy:(UIFontWeight*) awYHZnzQMOy auT3k:(UIBarButtonItem*) auT3k awjaTpNLDH:(UIDocument*) awjaTpNLDH aZYtM:(UIControl*) aZYtM aLMQPIVqp:(UIMotionEffect*) aLMQPIVqp aAz8aGtfsk:(UIDevice*) aAz8aGtfsk ancUtKep:(UIActivity*) ancUtKep aymqv:(UIView*) aymqv aKS1Ua:(UIControl*) aKS1Ua a51pE7giWjZ:(UIAlertView*) a51pE7giWjZ {
- NSLog(@"WQnyP2ei0p");
- NSLog(@"Fe2DtnXAYrsiqK");
- NSLog(@"fNEqywu8nsg14rhWMDczCj2A7vKSoYmJFR");
- NSLog(@"MuliOKznFWDQq1m2aVxJ");
- NSLog(@"eprjx0TW1cPbCkuV7htdfRLBvOZY");
- NSLog(@"DcOkBaIUbuL9");
- NSLog(@"g2dKel4XNqPuvp3yUsThWL81");
- NSLog(@"io1GE5Xc3ZPm");
- NSLog(@"PkgVs1MvLIrCNB");
- NSLog(@"yDGf6eKhRFIaLEr");
- NSLog(@"2Wyw3LvM8YBfukP0bsGa4cqTeZVElFCot");
- NSLog(@"FQbSCPnXUplZWtg87");
- NSLog(@"dvPQti3Y6Xx0pqToJ45fBkmRc");
- NSLog(@"M3EJsVNkfyUgTCOLKdjw");
- }
- -(void)aVUPkH1Q:(UIApplication*) aVUPkH1Q aIJYW:(UIRegion*) aIJYW apG4DWiakXb:(UIKeyCommand*) apG4DWiakXb agnTbORaE4X:(UIMotionEffect*) agnTbORaE4X aQ2OYDIM:(UIDocument*) aQ2OYDIM amVw2au:(UISwitch*) amVw2au aN1un3UZ:(UIScreen*) aN1un3UZ ahACgs4izEf:(UIFontWeight*) ahACgs4izEf aF0z3ojd:(UIBarButtonItem*) aF0z3ojd a98xzej:(UIView*) a98xzej aRtH5U:(UIFont*) aRtH5U aMDBqtOHrE:(UIFontWeight*) aMDBqtOHrE {
- NSLog(@"pDaTnGOrczySfXPNMV50m2ib");
- NSLog(@"y5Vv6Ix9RTGPfeYw");
- NSLog(@"2SqztUgcBbZienfANDCQ0JlGr");
- NSLog(@"WEMswox2jV7PlCavRfbytQADnG0");
- NSLog(@"B2eEnXmjKfapN70lgRObkzVPYiv");
- NSLog(@"PISp9gir6AEj530auMs1zVwJ");
- NSLog(@"UFLDPXwQj2Eds");
- NSLog(@"8jvmQgPkAiwIZbhWT7FXRrpeMLq");
- NSLog(@"7eJKqywxLVI0nXC8h2sgaWAk4T9");
- NSLog(@"VAhEd3Y6OWea");
- NSLog(@"wIU0sn5ZYTLK");
- NSLog(@"XcNdMS6CxVI0G4UalJtTo");
- NSLog(@"7JxCIuoTD3YrRgpftZkVwl4WMQi");
- NSLog(@"0HGzNuLS6XJ2QATkRytZDs");
- NSLog(@"ZHjxe95drETbg");
- NSLog(@"ubPeClRqxpEXVt3QUZWi8voBmY7SLIw9");
- NSLog(@"eg0HCJFEQSMu3caXGl5YUwnP21kTdmODqbjhv6B");
- NSLog(@"jx5LgpXVQ0PfRalWBrOkez");
- NSLog(@"zHXYkixGF5SrbNuDyPs2Z9e");
- NSLog(@"wB3hJnR8jdLq7TyFgiz4N6aPlsfXIt01YVQA");
- }
- -(void)aV4z7ODq:(UIUserInterfaceIdiom*) aV4z7ODq aTEoi2:(UIControl*) aTEoi2 aGLVivkWI6:(UIImageView*) aGLVivkWI6 a1Eju:(UIBarButtonItem*) a1Eju aM4ED:(UIBarButtonItem*) aM4ED atNw1W:(UIButton*) atNw1W alxXc:(UIBarButtonItem*) alxXc aQTxmXbaG:(UIFont*) aQTxmXbaG aChFvYDJq8:(UIImage*) aChFvYDJq8 a7ZMKrXoL:(UITableView*) a7ZMKrXoL atpFX:(UIImage*) atpFX aD7hSiGL9x:(UIButton*) aD7hSiGL9x aQOBsZ:(UIControlEvents*) aQOBsZ {
- NSLog(@"yh1tAuOdTDF");
- NSLog(@"lYMVwOsnc95ua6BiFzy3RJxkjU8qbLtI");
- NSLog(@"lJ7XjqvfKMrEduFL48IeUTVytSogzxQhn");
- NSLog(@"uDQ4a1HV9ZIwjYlJ");
- NSLog(@"iPoxQRn3rWqM1DfkKBAUNH0E9V7hbZ");
- NSLog(@"Qw6OCkNApmY9PURDf8Ko50SnXrTJacHv42h");
- NSLog(@"f2pIL8YdxC");
- NSLog(@"waNhKJbgYt5Ql2MUDoVkcPSWTHX");
- NSLog(@"0ezLhwEjp4ryfoimCnVtF1RK93TYSHl62DP");
- NSLog(@"3pqBoXECdWReLkFI2ic6Ds");
- NSLog(@"AJhse1TU3g8fbG9da5C");
- NSLog(@"vqZ8UYzL1lhQtgeMXG4Rak");
- NSLog(@"3Xq0DkQhZFt2Nn5xaVIlpOY");
- NSLog(@"VcNdy2bqkFxKgAhRS9Ol1pDnUosvWIi");
- NSLog(@"EmsTr1MvXz");
- NSLog(@"2MP7G4qBfpgSwyYa0irA9DTlxhQEmR");
- NSLog(@"ey82qW6Tnrli4g7BCJsS");
- NSLog(@"vQPdxXkO3muyc2HYrNFK9BM06tqLaISU");
- NSLog(@"KzgAhpyc8OTDiW5ZmJstQPNEY3rb1U0jwedL4C");
- NSLog(@"Hakjb5vVCKZM0wo");
- }
- -(void)a2Ov4:(UIMotionEffect*) a2Ov4 ayk6F:(UIDevice*) ayk6F a2v4LU6a:(UIDevice*) a2v4LU6a aQ6b7R1:(UIRegion*) aQ6b7R1 aqRE2Zm:(UIDocument*) aqRE2Zm {
- NSLog(@"lJkb0qYXpMfhzeVt1riTEPS");
- NSLog(@"kUBiHYxKPZ");
- NSLog(@"y8Nhd5DPBS9uMJInHtW1pUjeCYaOGiQLvf3");
- NSLog(@"twQs4gOUP3IXWTxJESVD9Fz0hn12lcfpZKk");
- NSLog(@"Umb3Z5LOvTIAetu06");
- NSLog(@"qpdNFrzJZe2KVROIG6tQ4sB7");
- NSLog(@"9VYi6py0skfItnv2e");
- NSLog(@"MGwrXJzdxepTAHlnuE5oC7IKb83yNP29q6QhD");
- NSLog(@"kufnV58mOQ4gj36LSKBGt");
- NSLog(@"AELBeDonwbNYs9");
- NSLog(@"ChjwkHd9GapNtO8qbArm5uBWfZIQy7vSxP");
- NSLog(@"4lw8DHXcseSnuJqBhV");
- NSLog(@"zh7sIPCtmvZ");
- NSLog(@"yGf53e81L0xgk49UBnXMpOIciRPsWj2lSAVztEvH");
- NSLog(@"hfkD3GLubrC");
- NSLog(@"9hsxDORGkvypaqtLY4i0wVl6ACr2SjFZQ7");
- NSLog(@"gwlbOD9GZmAsHLKYtd0f7MRp5a4uX6eJIEh");
- NSLog(@"IvZYgbzjn92xm");
- NSLog(@"mFiEHTqZ7PzM4");
- }
- @end
|