add .gitignore

This commit is contained in:
JoyWayer
2023-12-27 20:38:37 +08:00
parent b106a628a5
commit f6343426d6
515 changed files with 104217 additions and 199 deletions

View File

@@ -0,0 +1,56 @@
//
// UIView+Animation.h
//
//
// Created by Jeans on 3/9/13.
// Copyright (c) 2013 Jeans. All rights reserved.
//
#import <UIKit/UIKit.h>
#define kDefaultAnimateTime 0.25f
typedef enum AnimateType{ //动画类型
AnimateTypeOfTV, //电视
AnimateTypeOfPopping, //弹性缩小放大
AnimateTypeOfLeft, //左
AnimateTypeOfRight, //右
AnimateTypeOfTop, //上
AnimateTypeOfBottom //下
}AnimateType;
@interface UIView (Animation)
#pragma mark - 获取顶部View
+ (UIView *)getTopView;
#pragma mark - 顶层maskView触摸
+ (void)setTopMaskViewCanTouch:(BOOL)_canTouch;
/**
显示view
@param _view 需要显示的view
@param _aType 动画类型
@param _fRect 最终位置
*/
+ (void)showView:(UIView*)_view animateType:(AnimateType)_aType finalRect:(CGRect)_fRect;
/**
消失view
*/
+ (void)hideView;
/**
消失view
@param _aType 动画类型
*/
+ (void)hideViewByType:(AnimateType)_aType;
#pragma mark - 下面的增加了完成块
+ (void)showView:(UIView*)_view animateType:(AnimateType)_aType finalRect:(CGRect)_fRect completion:(void(^)(BOOL finished))completion;
+ (void)hideViewByCompletion:(void(^)(BOOL finished))completion;
+ (void)hideViewByType:(AnimateType)_aType completion:(void(^)(BOOL finished))completion;
@end

View File

@@ -0,0 +1,286 @@
//
// UIView+Animation.m
//
//
// Created by Jeans on 3/9/13.
// Copyright (c) 2013 Jeans. All rights reserved.
//
#import "UIView+Animation.h"
#import "AppDelegate.h"
#define kScaleMin 0.007f
#define kScaleDefault 1.0f
#define kScaleDelta 0.05f
#define kFirstAnimateTime 0.3f
#define kSecondAnimateTime 0.2f
#define kMaskViewFinalAlpha 0.2f //
@interface ViewInfo : NSObject{
AnimateType aType; //
UIView *displayView; //
CGRect displayRect; //
UIControl *maskView; //
void (^showBlock)(BOOL finished);
void (^hideBlock)(BOOL finished);
}
@property (retain, nonatomic) UIView *displayView;
@property (assign, nonatomic) AnimateType aType;
@property (assign, nonatomic) CGRect displayRect;
@property (retain, nonatomic) UIControl *maskView;
@property (copy, nonatomic) void (^showBlock)(BOOL finished);
@property (copy, nonatomic) void (^hideBlock)(BOOL finished);
@end
@implementation ViewInfo
@synthesize displayView,aType,maskView,displayRect,showBlock,hideBlock;
- (void)dealloc{
Block_release(hideBlock);
Block_release(showBlock);
[maskView release];
[displayView release];
[super dealloc];
}
@end
@implementation UIView (Animation)
static NSMutableArray *displayViewAry;//
#pragma mark - View
+ (AppDelegate *)getAppDelegate {
return (AppDelegate *)[[UIApplication sharedApplication] delegate];
}
+ (UIView *)getTopView{
return [[UIApplication sharedApplication].windows objectAtIndex:0];
// return [FuncPublic SharedFuncPublic].currentVC.view;
return [[[UIView getAppDelegate] root] view];
}
#pragma mark - maskView
+ (void)setTopMaskViewCanTouch:(BOOL)_canTouch{
ViewInfo *info = [displayViewAry lastObject];
if (_canTouch)
[info.maskView addTarget:self action:@selector(maskViewTouch) forControlEvents:UIControlEventTouchUpInside];
else
[info.maskView removeTarget:self action:@selector(maskViewTouch) forControlEvents:UIControlEventTouchUpInside];
}
#pragma mark -
/**
view
@param _view view
@param _aType
@param _fRect
@param completion
*/
+ (void)showView:(UIView*)_view animateType:(AnimateType)_aType finalRect:(CGRect)_fRect completion:(void(^)(BOOL finished))completion{
//
if (displayViewAry == nil)
displayViewAry = [[NSMutableArray alloc]init];
UIView *topView = [UIView getTopView];
//
ViewInfo *info = [[ViewInfo alloc]init];
info.displayView = _view;
info.aType = _aType;
info.displayRect = _fRect;
//
UIControl *maskView = [[UIControl alloc]init];
maskView.backgroundColor = [UIColor blackColor];
maskView.alpha = 0;
maskView.frame = topView.bounds;
[maskView addTarget:self action:@selector(maskViewTouch) forControlEvents:UIControlEventTouchUpInside];
//
[topView addSubview:maskView];
[topView bringSubviewToFront:maskView];
info.maskView = maskView;
[maskView release];
if (completion)
info.showBlock = completion;
[displayViewAry addObject:info];
[info release];
//
switch (_aType) {
case AnimateTypeOfTV:
[UIView showTV];
break;
case AnimateTypeOfPopping:
[UIView showPopping];
default:
break;
}
}
/**
view
@param _view view
@param _aType
@param _fRect
*/
+ (void)showView:(UIView*)_view animateType:(AnimateType)_aType finalRect:(CGRect)_fRect{
[self showView:_view animateType:_aType finalRect:_fRect completion:nil];
}
#pragma mark - view
+ (void)hideViewByCompletion:(void(^)(BOOL finished))completion{
if ([displayViewAry count] > 0){
ViewInfo *info = [displayViewAry lastObject];
if (completion)
info.hideBlock = completion;
}
[UIView maskViewTouch];
}
+ (void)hideViewByType:(AnimateType)_aType completion:(void(^)(BOOL finished))completion{
if ([displayViewAry count] > 0){
ViewInfo *info = [displayViewAry lastObject];
info.aType = _aType;
if (completion)
info.hideBlock = completion;
}
[UIView maskViewTouch];
}
//
+ (void)hideView{
[UIView hideViewByCompletion:nil];
}
+ (void)hideViewByType:(AnimateType)_aType{
[UIView hideViewByType:_aType completion:nil];
}
#pragma mark -
+ (void)maskViewTouch{
if ([displayViewAry count] > 0){
ViewInfo *info = [displayViewAry lastObject];
//
switch (info.aType) {
case AnimateTypeOfTV:
[UIView hideTV];
break;
case AnimateTypeOfPopping:
[UIView hidePopping];
break;
default:
break;
}
}
}
#pragma mark -
+ (void)removeMaskViewAndDisplay:(ViewInfo*)info{
if (info.aType == AnimateTypeOfTV || info.aType == AnimateTypeOfPopping) //TV,Popping
info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleDefault);
[info.displayView removeFromSuperview];
[info.maskView removeFromSuperview];
[displayViewAry removeObject:info];
}
#pragma mark -
#pragma mark - TV
+ (void)showTV{
ViewInfo *info = [displayViewAry lastObject];
UIView *topView = [UIView getTopView];
info.displayView.frame = info.displayRect;
[topView addSubview:info.displayView];
[topView bringSubviewToFront:info.displayView];
info.displayView.transform = CGAffineTransformMakeScale(kScaleMin, kScaleMin);
//
[UIView animateWithDuration:kSecondAnimateTime animations:^{
info.maskView.alpha = 0.1f;
info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleMin);
}completion:^(BOOL finish){
[UIView animateWithDuration:kFirstAnimateTime animations:^{
info.maskView.alpha = kMaskViewFinalAlpha;
info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleDefault);
}completion:^(BOOL finish){
//
if (info.showBlock)
info.showBlock(finish);
}];
}];
}
#pragma mark - TV
+ (void)hideTV{
ViewInfo *info = [displayViewAry lastObject];
[UIView animateWithDuration:kSecondAnimateTime animations:^{
info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleMin);
}completion:^(BOOL finish){
[UIView animateWithDuration:kFirstAnimateTime animations:^{
info.displayView.transform = CGAffineTransformMakeScale(kScaleMin, kScaleMin);
info.maskView.alpha = 0;
}completion:^(BOOL finish){
//
if (info.hideBlock)
info.hideBlock(finish);
[UIView removeMaskViewAndDisplay:info];
}];
}];
}
#pragma mark - Popping
+ (void)showPopping{
ViewInfo *info = [displayViewAry lastObject];
UIView *topView = [UIView getTopView];
info.displayView.frame = info.displayRect;
[topView addSubview:info.displayView];
[topView bringSubviewToFront:info.displayView];
info.displayView.transform = CGAffineTransformMakeScale(kScaleMin, kScaleMin);
//
[UIView animateWithDuration:kFirstAnimateTime animations:^{
info.maskView.alpha = kMaskViewFinalAlpha;
info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault+kScaleDelta, kScaleDefault+kScaleDelta);
}completion:^(BOOL finish){
[UIView animateWithDuration:kSecondAnimateTime animations:^{
info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault-kScaleDelta, kScaleDefault-kScaleDelta);
}completion:^(BOOL finish){
[UIView animateWithDuration:kSecondAnimateTime animations:^{
info.displayView.transform = CGAffineTransformMakeScale(kScaleDefault, kScaleDefault);
}completion:^(BOOL finish){
//
if (info.showBlock)
info.showBlock(finish);
}];
}];
}];
}
#pragma mark - Popping
+ (void)hidePopping{
ViewInfo *info = [displayViewAry lastObject];
[UIView animateWithDuration:kFirstAnimateTime animations:^{
info.maskView.alpha = 0;
info.displayView.transform = CGAffineTransformMakeScale(kScaleMin, kScaleMin);
}completion:^(BOOL finish){
//
if (info.hideBlock)
info.hideBlock(finish);
[UIView removeMaskViewAndDisplay:info];
}];
}
@end