Repository: HZQuan/Bzier-Animation-FloatingWindow Branch: master Commit: b890edfeabcd Files: 32 Total size: 78.3 KB Directory structure: gitextract_joyk1q2q/ ├── FloatingWindwoAmination/ │ ├── FloatingWindwoAmination/ │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets/ │ │ │ └── AppIcon.appiconset/ │ │ │ └── Contents.json │ │ ├── Base.lproj/ │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── FloatingWindow.h │ │ ├── FloatingWindow.m │ │ ├── Info.plist │ │ ├── SecondViewController.h │ │ ├── SecondViewController.m │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ └── main.m │ ├── FloatingWindwoAmination.xcodeproj/ │ │ ├── project.pbxproj │ │ ├── project.xcworkspace/ │ │ │ ├── contents.xcworkspacedata │ │ │ ├── xcshareddata/ │ │ │ │ └── FloatingWindwoAmination.xccheckout │ │ │ └── xcuserdata/ │ │ │ ├── huangzengquan.xcuserdatad/ │ │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── huangzq.xcuserdatad/ │ │ │ └── UserInterfaceState.xcuserstate │ │ └── xcuserdata/ │ │ ├── huangzengquan.xcuserdatad/ │ │ │ └── xcschemes/ │ │ │ ├── FloatingWindwoAmination.xcscheme │ │ │ └── xcschememanagement.plist │ │ ├── huangzq.xcuserdatad/ │ │ │ ├── xcdebugger/ │ │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ └── xcschemes/ │ │ │ ├── FloatingWindwoAmination.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── quan.xcuserdatad/ │ │ ├── xcdebugger/ │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes/ │ │ ├── FloatingWindwoAmination.xcscheme │ │ └── xcschememanagement.plist │ ├── FloatingWindwoAminationTests/ │ │ ├── FloatingWindwoAminationTests.m │ │ └── Info.plist │ └── FloatingWindwoAminationUITests/ │ ├── FloatingWindwoAminationUITests.m │ └── Info.plist ├── LICENSE └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/AppDelegate.h ================================================ // // AppDelegate.h // FloatingWindwoAmination // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import #import "FloatingWindow.h" @interface AppDelegate : UIResponder @property(strong ,nonatomic) UIWindow *window; @property(strong ,nonatomic) FloatingWindow *floatWindow; @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/AppDelegate.m ================================================ // // AppDelegate.m // FloatingWindwoAmination // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.floatWindow = [[FloatingWindow alloc] initWithFrame:CGRectMake(100, 100, 76, 76) imageName:@"av_call"]; [self.floatWindow makeKeyAndVisible]; self.floatWindow.hidden = YES; return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/Assets.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "1x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "2x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "1x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "2x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "1x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/Base.lproj/LaunchScreen.storyboard ================================================ ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/Base.lproj/Main.storyboard ================================================ ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/FloatingWindow.h ================================================ // // FloatingWindow.h // FloatingWindwoAmination // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import @protocol FloatingWindowTouchDelegate //悬浮窗点击事件 - (void)assistiveTocuhs; @end @interface FloatingWindow : UIWindow { UIImageView *_imageView; } @property(nonatomic ,assign) NSInteger time; @property(nonatomic ,assign) BOOL isShowMenu; @property(nonatomic ,strong) UIImage *showImage; @property(nonatomic ,strong) UIImageView *showImageView; @property(nonatomic ,assign) CGRect startFrame; @property(nonatomic ,assign) BOOL isCannotTouch; @property(nonatomic ,strong)id floatDelegate; - (id)initWithFrame:(CGRect)frame imageName:(NSString*)name; - (void)close; - (void)startWithTime:(NSInteger)time presentview:(UIView *)presentView inRect:(CGRect)rect; - (UIImage *)clipcircleImageFromView:(UIView *)view inRect:(CGRect)frame; @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/FloatingWindow.m ================================================ // // FloatingWindow.m // FloatingWindwoAmination // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import "FloatingWindow.h" #import #import #define WIDTH self.frame.size.width #define HEIGHT self.frame.size.height #define kScreenWidth [[UIScreen mainScreen] bounds].size.width #define kScreenHeight [[UIScreen mainScreen] bounds].size.height static const float timeSplit = 1.f / 3.f; @interface FloatingWindow () @property (nonatomic ,strong) UILabel *timeLable; @property (nonatomic ,strong) NSTimer *timer; @property (nonatomic ,copy) NSString *imageNameString; @property (nonatomic ,strong) UIView *presentView; @property (nonatomic ,strong) CAAnimation *samllAnimation; @property (nonatomic ,assign) BOOL isExit; @property (assign ,nonatomic) BOOL timeStart; @end @implementation FloatingWindow { UIImageView * _phoneFlowImageView1; UIImageView * _phoneFlowImageView2; UIImageView * _phoneFlowImageView3; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; } - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code } return self; } -(id)initWithFrame:(CGRect)frame imageName:(NSString *)name { if(self = [super initWithFrame:frame]) { self.backgroundColor = [UIColor clearColor]; self.windowLevel = UIWindowLevelAlert + 1; [self makeKeyAndVisible]; _imageView = [[UIImageView alloc]initWithFrame:(CGRect){0, 0,frame.size.width, frame.size.height}]; _imageView.image = [UIImage imageNamed:name]; _imageView.alpha = 1.0; self.imageNameString = name; [self addSubview:_imageView]; _phoneFlowImageView1 = [[UIImageView alloc] initWithImage : [UIImage imageNamed:@"fsav_phone_flow1"]]; _phoneFlowImageView1.frame = CGRectMake(76 - 21 - _phoneFlowImageView1.frame.size.width, 12, _phoneFlowImageView1.frame.size.width, _phoneFlowImageView1.frame.size.height); [self addSubview:_phoneFlowImageView1]; _phoneFlowImageView2 = [[UIImageView alloc] initWithImage : [UIImage imageNamed:@"fsav_phone_flow2"]]; _phoneFlowImageView2.frame = CGRectMake(76 - 21 - _phoneFlowImageView2.frame.size.width, 12, _phoneFlowImageView2.frame.size.width, _phoneFlowImageView2.frame.size.height); [self addSubview:_phoneFlowImageView2]; _phoneFlowImageView3 = [[UIImageView alloc] initWithImage : [UIImage imageNamed:@"fsav_phone_flow3"]]; _phoneFlowImageView3.frame = CGRectMake(76 - 21 - _phoneFlowImageView3.frame.size.width, 12, _phoneFlowImageView3.frame.size.width, _phoneFlowImageView3.frame.size.height); [self addSubview:_phoneFlowImageView3]; _phoneFlowImageView1.alpha = 0.f; _phoneFlowImageView2.alpha = 0.f; _phoneFlowImageView3.alpha = 0.f; UILabel *timelable = [[UILabel alloc ] initWithFrame:CGRectMake(0, 0, 60, 10)]; timelable.center = CGPointMake(frame.size.width /2, frame.size.height / 2 + 12); timelable.font = [UIFont systemFontOfSize:12]; timelable.textColor = [UIColor whiteColor]; timelable.textAlignment = NSTextAlignmentCenter; self.timeLable = timelable; [self addSubview:timelable]; //添加移动的手势 UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(locationChange:)]; pan.delaysTouchesBegan = YES; [self addGestureRecognizer:pan]; //添加点击的手势 UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(click:)]; [self addGestureRecognizer:tap]; self.hidden = YES; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(convStartHere) name:@"FSAVConvStartNotification" object:nil]; } return self; } #pragma mark--- 开始和结束 - (void)startWithTime:(NSInteger)time presentview:(UIView *)presentView inRect:(CGRect)rect{ self.hidden = NO; _imageView.hidden = YES; self.timeLable.hidden = YES; self.startFrame = rect; [self circleSmallerWithView:presentView]; self.time = time; self.presentView = presentView; if(time == 0) { _timeStart = NO; } else { _timeStart = YES; } } - (void)close { self.hidden = YES; self.presentView = nil; [self.timer invalidate]; self.showImageView = nil; self.showImage = nil; self.timer = nil; } - (void)start { self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(changeTimeLable) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes]; [_timer fire]; } - (void)changeTimeLable { self.timeLable.text = [self changeTimeFormater:self.time]; if(_timeStart) { self.time++; } static BOOL oem = false; oem = !oem; if(oem && _timeStart) { __weak typeof(self) weakself = self; dispatch_async(dispatch_get_main_queue(), ^{ [UIView transitionWithView:weakself duration:timeSplit options:UIViewAnimationOptionCurveLinear animations:^{ _phoneFlowImageView1.alpha = 1.f; } completion:^(BOOL finished) { ; }]; }); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * timeSplit * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [UIView transitionWithView:weakself duration:timeSplit options:UIViewAnimationOptionCurveLinear animations:^{ _phoneFlowImageView1.alpha = 0.f; } completion:^(BOOL finished) { ; }]; ; }); //_fimageView2 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * timeSplit * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [UIView transitionWithView:weakself duration:timeSplit options:UIViewAnimationOptionCurveLinear animations:^{ _phoneFlowImageView2.alpha = 1.f; } completion:^(BOOL finished) { ; }]; }); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * timeSplit * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [UIView transitionWithView:self duration:timeSplit options:UIViewAnimationOptionCurveLinear animations:^{ _phoneFlowImageView2.alpha = 0.f; } completion:^(BOOL finished) { ; }]; }); //_fimageView3 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * timeSplit * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [UIView transitionWithView:weakself duration:timeSplit options:UIViewAnimationOptionCurveLinear animations:^{ _phoneFlowImageView3.alpha = 1.f; } completion:^(BOOL finished) { ; }]; }); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * timeSplit * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [UIView transitionWithView:weakself duration:timeSplit options:UIViewAnimationOptionCurveLinear animations:^{ _phoneFlowImageView3.alpha = 0.f; } completion:^(BOOL finished) { ; }]; }); } } #pragma mark ---进去和出去动画 - (void)makeIntoAnimation { UIImageView *showImageView = [[UIImageView alloc] init]; showImageView.image = self.showImage; _imageView.hidden = YES; self.showImageView = showImageView; self.frame = self.startFrame; showImageView.frame = CGRectMake(0, 0, self.startFrame.size.width,self.startFrame.size.height); [self addSubview:showImageView]; self.frame = self.startFrame; [UIView animateWithDuration:0.5f animations:^{ showImageView.frame = CGRectMake(0, 0, 76, 76); self.frame = CGRectMake([UIScreen mainScreen].bounds.size.width - 100, [UIScreen mainScreen].bounds.size.height - 200, 76, 76); } completion:^(BOOL finished) { [self start]; showImageView.hidden = YES; _imageView.hidden = NO; _timeLable.hidden = NO; [self showPhoneImages]; _imageView.image = [UIImage imageNamed:self.imageNameString]; }]; } - (void)makeOuttoAnimation { self.showImageView.hidden = NO; _imageView.hidden = YES; self.timeLable.hidden = YES; [self hidePhoneImages]; [UIView animateWithDuration:0.5f animations:^{ self.frame = self.startFrame; self.showImageView.frame = CGRectMake(0, 0, self.startFrame.size.width, self.startFrame.size.height); } completion:^(BOOL finished) { self.showImageView.hidden = YES; [self circleBigger]; }]; } /** * 动画开始时 */ - (void)animationDidStart:(CAAnimation *)theAnimation { } /** * 动画结束时 */ - (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag { if (self.isExit) { self.isExit = NO; self.presentView.layer.mask = nil; [self.floatDelegate assistiveTocuhs]; } else { self.showImage = [self clipcircleImageFromView:self.presentView inRect:self.startFrame]; [self.presentView removeFromSuperview]; [self makeIntoAnimation]; } } - (void)circleSmallerWithView:(UIView *)view { self.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height); CGRect startFrame = self.startFrame; UIBezierPath *maskStartBP = [UIBezierPath bezierPathWithOvalInRect:startFrame]; CGFloat radius = [UIScreen mainScreen].bounds.size.height - 100; UIBezierPath *maskFinalBP = [UIBezierPath bezierPathWithOvalInRect:CGRectInset(startFrame, -radius, -radius)]; CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.path = maskStartBP.CGPath; maskLayer.backgroundColor = (__bridge CGColorRef )([UIColor whiteColor]); view.layer.mask = maskLayer; CABasicAnimation *maskLayerAnimation = [CABasicAnimation animationWithKeyPath:@"path"]; maskLayerAnimation.fromValue = (__bridge id)(maskFinalBP.CGPath); maskLayerAnimation.toValue = (__bridge id)((maskStartBP.CGPath)); maskLayerAnimation.duration = 0.5f; __weak typeof(self) weakSelf = self; maskLayerAnimation.delegate = weakSelf; self.samllAnimation = maskLayerAnimation; // maskLayerAnimation.fillMode = kCAFillModeForwards; maskLayerAnimation.removedOnCompletion = NO; [self addSubview:view]; [maskLayer addAnimation:maskLayerAnimation forKey:@"path"]; } - (void)circleBigger { self.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height); [self addSubview:self.presentView]; UIBezierPath *maskStartBP = [UIBezierPath bezierPathWithOvalInRect:self.startFrame]; CGFloat radius = [UIScreen mainScreen].bounds.size.height - 100; UIBezierPath *maskFinalBP = [UIBezierPath bezierPathWithOvalInRect:CGRectInset(self.startFrame, -radius, -radius)]; CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.path = maskFinalBP.CGPath; maskLayer.backgroundColor = (__bridge CGColorRef)([UIColor whiteColor]); self.presentView.layer.mask = maskLayer; CABasicAnimation *maskLayerAnimation = [CABasicAnimation animationWithKeyPath:@"path"]; maskLayerAnimation.fromValue = (__bridge id)(maskStartBP.CGPath); maskLayerAnimation.toValue = (__bridge id)((maskFinalBP.CGPath)); maskLayerAnimation.duration = 0.5f; __weak typeof(self) weakSelf = self; maskLayerAnimation.delegate = weakSelf; [maskLayer addAnimation:maskLayerAnimation forKey:@"path"]; } #pragma mark -触摸事件监听 -(void)locationChange:(UIPanGestureRecognizer*)p { if (self.isCannotTouch) { return; } CGPoint panPoint = [p locationInView:[[UIApplication sharedApplication] keyWindow]]; if(p.state == UIGestureRecognizerStateBegan) { } else if (p.state == UIGestureRecognizerStateEnded) { } if(p.state == UIGestureRecognizerStateChanged) { // if(panPoint.x > [UIScreen mainScreen].bounds.size.width - WIDTH/2){ // panPoint.x = [UIScreen mainScreen].bounds.size.width - WIDTH/2; // } // if(panPoint.x < WIDTH/2){ // panPoint.x = WIDTH/2; // } // if(panPoint.y > [UIScreen mainScreen].bounds.size.height - HEIGHT/2) { // panPoint.y = [UIScreen mainScreen].bounds.size.height - HEIGHT/2; // } // if (panPoint.y < HEIGHT/2) { // panPoint.y = HEIGHT/2; // } // self.center = CGPointMake(panPoint.x, panPoint.y); } else if(p.state == UIGestureRecognizerStateEnded) { if(panPoint.x <= kScreenWidth/2) { if(panPoint.y <= 40+HEIGHT/2 && panPoint.x >= 20+WIDTH/2) { [UIView animateWithDuration:0.15f animations:^{ self.center = CGPointMake(panPoint.x, HEIGHT/2+25); }]; } else if(panPoint.y >= kScreenHeight-HEIGHT/2-40 && panPoint.x >= 20+WIDTH/2) { [UIView animateWithDuration:0.15f animations:^{ self.center = CGPointMake(panPoint.x, kScreenHeight-HEIGHT/2-25); }]; } else if (panPoint.x < WIDTH/2+15 && panPoint.y > kScreenHeight-HEIGHT/2) { [UIView animateWithDuration:0.15f animations:^{ self.center = CGPointMake(WIDTH/2+25, kScreenHeight-HEIGHT/2-25); }]; } else { CGFloat pointy = panPoint.y < HEIGHT/2 ? HEIGHT/2 :panPoint.y; [UIView animateWithDuration:0.15f animations:^{ self.center = CGPointMake(WIDTH/2+25, pointy); }]; } } else if(panPoint.x > kScreenWidth/2) { if(panPoint.y <= 40+HEIGHT/2 && panPoint.x < kScreenWidth-WIDTH/2-20 ) { [UIView animateWithDuration:0.15f animations:^{ self.center = CGPointMake(panPoint.x, HEIGHT/2 + 25); }]; } else if(panPoint.y >= kScreenHeight-40-HEIGHT/2 && panPoint.x < kScreenWidth-WIDTH/2-20) { [UIView animateWithDuration:0.15f animations:^{ self.center = CGPointMake(panPoint.x, kScreenHeight-HEIGHT/2 - 25); }]; } else if (panPoint.x > kScreenWidth-WIDTH/2 - 15 && panPoint.y < HEIGHT/2) { [UIView animateWithDuration:0.15f animations:^{ self.center = CGPointMake(kScreenWidth-WIDTH/2 - 25, HEIGHT/2 + 25); }]; } else { CGFloat pointy = panPoint.y > kScreenHeight-HEIGHT/2 ? kScreenHeight-HEIGHT/2 :panPoint.y; [UIView animateWithDuration:0.15f animations:^{ self.center = CGPointMake(kScreenWidth-WIDTH/2 - 25, pointy); }]; } } } } - (void)click:(UITapGestureRecognizer*)t { if (self.isCannotTouch) { return; } self.isExit = YES; [self makeOuttoAnimation]; } - (NSString *)changeTimeFormater:(NSInteger)time{ NSInteger minutecount = time / 60; NSInteger secondcount = time % 60; NSString *timeString; if (minutecount > 60) { NSInteger hour = minutecount / 60; minutecount = hour % 60; if (hour > 10) { if (minutecount < 10 && secondcount < 10) { timeString = [NSString stringWithFormat:@"%ld:0%ld:0%ld",hour,minutecount,secondcount]; return timeString; } if (minutecount < 10) { timeString = [NSString stringWithFormat:@"%ld:%ld:%ld",hour,minutecount,secondcount]; return timeString; } if (secondcount < 10) { timeString = [NSString stringWithFormat:@"%ld:%ld:0%ld",hour,minutecount,secondcount]; return timeString; } } else { if (minutecount < 10 && secondcount < 10) { timeString = [NSString stringWithFormat:@"0%ld:0%ld:0%ld",hour,minutecount,secondcount]; return timeString; } if (minutecount < 10) { timeString = [NSString stringWithFormat:@"0%ld:%ld:%ld",hour,minutecount,secondcount]; return timeString; } if (secondcount < 10) { timeString = [NSString stringWithFormat:@"0%ld:%ld:0%ld",hour,minutecount,secondcount]; return timeString; } } } if (minutecount < 10 && secondcount < 10) { timeString = [NSString stringWithFormat:@"0%ld:0%ld",minutecount,secondcount]; return timeString; } if (minutecount < 10) { timeString = [NSString stringWithFormat:@"0%ld:%ld",minutecount,secondcount]; return timeString; } if (secondcount < 10) { timeString = [NSString stringWithFormat:@"%ld:0%ld",minutecount,secondcount]; return timeString; } return [NSString stringWithFormat:@"%ld:%ld",minutecount,secondcount]; } #pragma mark -裁剪库 - (UIImage *)imageFromView:(UIView *)theView { UIGraphicsBeginImageContextWithOptions(CGSizeMake(CGRectGetWidth(theView.frame), CGRectGetHeight(theView.frame)), NO, 1); [theView drawViewHierarchyInRect:CGRectMake(0,0, CGRectGetWidth(theView.frame), CGRectGetHeight(theView.frame)) afterScreenUpdates:NO]; UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return snapshot; } - ( UIImage *)getEllipseImageWithImage:(UIImage *)originImage size:(CGSize)size frame:(CGRect)rect { //开启上下文 UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); CGContextFillPath(UIGraphicsGetCurrentContext()); CGRect clip = rect; UIBezierPath *clipPath = [UIBezierPath bezierPathWithOvalInRect:clip]; [clipPath addClip]; [originImage drawAtPoint:CGPointMake(0, 0)]; UIImage *image; image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } - (UIImage *)clipcircleImageFromView:(UIView *)view inRect:(CGRect)frame { UIImage *image = [self imageFromView:view]; UIImage *secondImage = [UIImage imageWithCGImage:CGImageCreateWithImageInRect([image CGImage], frame)]; UIImage *thirdimage = [self getEllipseImageWithImage:secondImage size:frame.size frame:CGRectMake(0, 0, frame.size.width, frame.size.height)]; self.startFrame = frame; self.showImage = thirdimage; return thirdimage; } -(void) hidePhoneImages { _phoneFlowImageView1.hidden = YES; _phoneFlowImageView2.hidden = YES; _phoneFlowImageView3.hidden = YES; } -(void) showPhoneImages { _phoneFlowImageView1.hidden = NO; _phoneFlowImageView2.hidden = NO; _phoneFlowImageView3.hidden = NO; } -(void) convStartHere { _timeStart = YES; } @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/SecondViewController.h ================================================ // // SecondViewController.h // FloatingWindwoAmination // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import @interface SecondViewController : UIViewController @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/SecondViewController.m ================================================ // // SecondViewController.m // FloatingWindwoAmination // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import "SecondViewController.h" #import "FloatingWindow.h" #import "AppDelegate.h" @interface SecondViewController () @end @implementation SecondViewController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor redColor]; UIButton *callBackButton = [[UIButton alloc] initWithFrame:CGRectMake(100, 400, 50, 40)]; [callBackButton setTitle:@"缩小" forState:UIControlStateNormal]; [callBackButton addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside]; [callBackButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.view addSubview:callBackButton]; } - (void) click { AppDelegate *deleage = (AppDelegate *)[UIApplication sharedApplication].delegate; deleage.floatWindow.isCannotTouch = NO; __weak typeof (self) weakSelf = self; deleage.floatWindow.floatDelegate = weakSelf; [deleage.floatWindow startWithTime:30 presentview:self.view inRect:CGRectMake(100, 100, 100, 100)]; [self.navigationController dismissViewControllerAnimated:NO completion:^{ }]; } -(void)assistiveTocuhs { AppDelegate *deleage = (AppDelegate *)[UIApplication sharedApplication].delegate; deleage.floatWindow.isCannotTouch = YES; // UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self]; // navigationController.navigationBar.hidden = YES; // [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:navigationController animated:NO completion:^{ // // }]; // [deleage.floatWindow close]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/ViewController.h ================================================ // // ViewController.h // FloatingWindwoAmination // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import @interface ViewController : UIViewController @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/ViewController.m ================================================ // // ViewController.m // FloatingWindwoAmination // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import "ViewController.h" #import "SecondViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor blueColor]; UIButton *presentButton = [[UIButton alloc] initWithFrame:CGRectMake(100, 200, 40, 40)]; [presentButton setTitle:@"进入" forState:UIControlStateNormal]; [presentButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; [presentButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.view addSubview:presentButton]; } - (void)click:(id)sender{ UIButton *button = sender; button.userInteractionEnabled = NO; SecondViewController *secondViewController = [[SecondViewController alloc] init]; UINavigationController *navigationcontoller = [[UINavigationController alloc]initWithRootViewController:secondViewController]; navigationcontoller.navigationBar.hidden = YES; [self presentViewController:navigationcontoller animated:YES completion:^{ }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination/main.m ================================================ // // main.m // FloatingWindwoAmination // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import #import "AppDelegate.h" int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 55C1001D1CF5899700F870AD /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C1001C1CF5899700F870AD /* SecondViewController.m */; }; 55C100201CF58B6600F870AD /* av_call.png in Resources */ = {isa = PBXBuildFile; fileRef = 55C1001E1CF58B6600F870AD /* av_call.png */; }; 55C100211CF58B6600F870AD /* av_call@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 55C1001F1CF58B6600F870AD /* av_call@3x.png */; }; 55C1FFA31CF5840F00F870AD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C1FFA21CF5840F00F870AD /* main.m */; }; 55C1FFA61CF5840F00F870AD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C1FFA51CF5840F00F870AD /* AppDelegate.m */; }; 55C1FFA91CF5840F00F870AD /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C1FFA81CF5840F00F870AD /* ViewController.m */; }; 55C1FFAC1CF5840F00F870AD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 55C1FFAA1CF5840F00F870AD /* Main.storyboard */; }; 55C1FFAE1CF5840F00F870AD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55C1FFAD1CF5840F00F870AD /* Assets.xcassets */; }; 55C1FFB11CF5840F00F870AD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 55C1FFAF1CF5840F00F870AD /* LaunchScreen.storyboard */; }; 55C1FFBC1CF5840F00F870AD /* FloatingWindwoAminationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C1FFBB1CF5840F00F870AD /* FloatingWindwoAminationTests.m */; }; 55C1FFC71CF5840F00F870AD /* FloatingWindwoAminationUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C1FFC61CF5840F00F870AD /* FloatingWindwoAminationUITests.m */; }; 55C1FFD61CF5874F00F870AD /* FloatingWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C1FFD51CF5874F00F870AD /* FloatingWindow.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 55C1FFB81CF5840F00F870AD /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 55C1FF961CF5840F00F870AD /* Project object */; proxyType = 1; remoteGlobalIDString = 55C1FF9D1CF5840F00F870AD; remoteInfo = FloatingWindwoAmination; }; 55C1FFC31CF5840F00F870AD /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 55C1FF961CF5840F00F870AD /* Project object */; proxyType = 1; remoteGlobalIDString = 55C1FF9D1CF5840F00F870AD; remoteInfo = FloatingWindwoAmination; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 55C1001B1CF5899700F870AD /* SecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; 55C1001C1CF5899700F870AD /* SecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; 55C1001E1CF58B6600F870AD /* av_call.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = av_call.png; sourceTree = ""; }; 55C1001F1CF58B6600F870AD /* av_call@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "av_call@3x.png"; sourceTree = ""; }; 55C1FF9E1CF5840F00F870AD /* FloatingWindwoAmination.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FloatingWindwoAmination.app; sourceTree = BUILT_PRODUCTS_DIR; }; 55C1FFA21CF5840F00F870AD /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 55C1FFA41CF5840F00F870AD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 55C1FFA51CF5840F00F870AD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 55C1FFA71CF5840F00F870AD /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 55C1FFA81CF5840F00F870AD /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 55C1FFAB1CF5840F00F870AD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55C1FFAD1CF5840F00F870AD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 55C1FFB01CF5840F00F870AD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55C1FFB21CF5840F00F870AD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55C1FFB71CF5840F00F870AD /* FloatingWindwoAminationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FloatingWindwoAminationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55C1FFBB1CF5840F00F870AD /* FloatingWindwoAminationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FloatingWindwoAminationTests.m; sourceTree = ""; }; 55C1FFBD1CF5840F00F870AD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55C1FFC21CF5840F00F870AD /* FloatingWindwoAminationUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FloatingWindwoAminationUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55C1FFC61CF5840F00F870AD /* FloatingWindwoAminationUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FloatingWindwoAminationUITests.m; sourceTree = ""; }; 55C1FFC81CF5840F00F870AD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55C1FFD41CF5874F00F870AD /* FloatingWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatingWindow.h; sourceTree = ""; }; 55C1FFD51CF5874F00F870AD /* FloatingWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FloatingWindow.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 55C1FF9B1CF5840F00F870AD /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 55C1FFB41CF5840F00F870AD /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 55C1FFBF1CF5840F00F870AD /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 55C1FF951CF5840F00F870AD = { isa = PBXGroup; children = ( 55C1FFA01CF5840F00F870AD /* FloatingWindwoAmination */, 55C1FFBA1CF5840F00F870AD /* FloatingWindwoAminationTests */, 55C1FFC51CF5840F00F870AD /* FloatingWindwoAminationUITests */, 55C1FF9F1CF5840F00F870AD /* Products */, ); sourceTree = ""; }; 55C1FF9F1CF5840F00F870AD /* Products */ = { isa = PBXGroup; children = ( 55C1FF9E1CF5840F00F870AD /* FloatingWindwoAmination.app */, 55C1FFB71CF5840F00F870AD /* FloatingWindwoAminationTests.xctest */, 55C1FFC21CF5840F00F870AD /* FloatingWindwoAminationUITests.xctest */, ); name = Products; sourceTree = ""; }; 55C1FFA01CF5840F00F870AD /* FloatingWindwoAmination */ = { isa = PBXGroup; children = ( 55C1FFA41CF5840F00F870AD /* AppDelegate.h */, 55C1FFA51CF5840F00F870AD /* AppDelegate.m */, 55C1FFA71CF5840F00F870AD /* ViewController.h */, 55C1FFA81CF5840F00F870AD /* ViewController.m */, 55C1FFAA1CF5840F00F870AD /* Main.storyboard */, 55C1FFAD1CF5840F00F870AD /* Assets.xcassets */, 55C1FFAF1CF5840F00F870AD /* LaunchScreen.storyboard */, 55C1FFB21CF5840F00F870AD /* Info.plist */, 55C1FFA11CF5840F00F870AD /* Supporting Files */, 55C1FFD41CF5874F00F870AD /* FloatingWindow.h */, 55C1FFD51CF5874F00F870AD /* FloatingWindow.m */, 55C1001B1CF5899700F870AD /* SecondViewController.h */, 55C1001C1CF5899700F870AD /* SecondViewController.m */, ); path = FloatingWindwoAmination; sourceTree = ""; }; 55C1FFA11CF5840F00F870AD /* Supporting Files */ = { isa = PBXGroup; children = ( 55C1001E1CF58B6600F870AD /* av_call.png */, 55C1001F1CF58B6600F870AD /* av_call@3x.png */, 55C1FFA21CF5840F00F870AD /* main.m */, ); name = "Supporting Files"; sourceTree = ""; }; 55C1FFBA1CF5840F00F870AD /* FloatingWindwoAminationTests */ = { isa = PBXGroup; children = ( 55C1FFBB1CF5840F00F870AD /* FloatingWindwoAminationTests.m */, 55C1FFBD1CF5840F00F870AD /* Info.plist */, ); path = FloatingWindwoAminationTests; sourceTree = ""; }; 55C1FFC51CF5840F00F870AD /* FloatingWindwoAminationUITests */ = { isa = PBXGroup; children = ( 55C1FFC61CF5840F00F870AD /* FloatingWindwoAminationUITests.m */, 55C1FFC81CF5840F00F870AD /* Info.plist */, ); path = FloatingWindwoAminationUITests; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 55C1FF9D1CF5840F00F870AD /* FloatingWindwoAmination */ = { isa = PBXNativeTarget; buildConfigurationList = 55C1FFCB1CF5840F00F870AD /* Build configuration list for PBXNativeTarget "FloatingWindwoAmination" */; buildPhases = ( 55C1FF9A1CF5840F00F870AD /* Sources */, 55C1FF9B1CF5840F00F870AD /* Frameworks */, 55C1FF9C1CF5840F00F870AD /* Resources */, ); buildRules = ( ); dependencies = ( ); name = FloatingWindwoAmination; productName = FloatingWindwoAmination; productReference = 55C1FF9E1CF5840F00F870AD /* FloatingWindwoAmination.app */; productType = "com.apple.product-type.application"; }; 55C1FFB61CF5840F00F870AD /* FloatingWindwoAminationTests */ = { isa = PBXNativeTarget; buildConfigurationList = 55C1FFCE1CF5840F00F870AD /* Build configuration list for PBXNativeTarget "FloatingWindwoAminationTests" */; buildPhases = ( 55C1FFB31CF5840F00F870AD /* Sources */, 55C1FFB41CF5840F00F870AD /* Frameworks */, 55C1FFB51CF5840F00F870AD /* Resources */, ); buildRules = ( ); dependencies = ( 55C1FFB91CF5840F00F870AD /* PBXTargetDependency */, ); name = FloatingWindwoAminationTests; productName = FloatingWindwoAminationTests; productReference = 55C1FFB71CF5840F00F870AD /* FloatingWindwoAminationTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; 55C1FFC11CF5840F00F870AD /* FloatingWindwoAminationUITests */ = { isa = PBXNativeTarget; buildConfigurationList = 55C1FFD11CF5840F00F870AD /* Build configuration list for PBXNativeTarget "FloatingWindwoAminationUITests" */; buildPhases = ( 55C1FFBE1CF5840F00F870AD /* Sources */, 55C1FFBF1CF5840F00F870AD /* Frameworks */, 55C1FFC01CF5840F00F870AD /* Resources */, ); buildRules = ( ); dependencies = ( 55C1FFC41CF5840F00F870AD /* PBXTargetDependency */, ); name = FloatingWindwoAminationUITests; productName = FloatingWindwoAminationUITests; productReference = 55C1FFC21CF5840F00F870AD /* FloatingWindwoAminationUITests.xctest */; productType = "com.apple.product-type.bundle.ui-testing"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 55C1FF961CF5840F00F870AD /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0730; ORGANIZATIONNAME = huangzengquan; TargetAttributes = { 55C1FF9D1CF5840F00F870AD = { CreatedOnToolsVersion = 7.3.1; }; 55C1FFB61CF5840F00F870AD = { CreatedOnToolsVersion = 7.3.1; TestTargetID = 55C1FF9D1CF5840F00F870AD; }; 55C1FFC11CF5840F00F870AD = { CreatedOnToolsVersion = 7.3.1; TestTargetID = 55C1FF9D1CF5840F00F870AD; }; }; }; buildConfigurationList = 55C1FF991CF5840F00F870AD /* Build configuration list for PBXProject "FloatingWindwoAmination" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 55C1FF951CF5840F00F870AD; productRefGroup = 55C1FF9F1CF5840F00F870AD /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 55C1FF9D1CF5840F00F870AD /* FloatingWindwoAmination */, 55C1FFB61CF5840F00F870AD /* FloatingWindwoAminationTests */, 55C1FFC11CF5840F00F870AD /* FloatingWindwoAminationUITests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 55C1FF9C1CF5840F00F870AD /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 55C100201CF58B6600F870AD /* av_call.png in Resources */, 55C1FFB11CF5840F00F870AD /* LaunchScreen.storyboard in Resources */, 55C100211CF58B6600F870AD /* av_call@3x.png in Resources */, 55C1FFAE1CF5840F00F870AD /* Assets.xcassets in Resources */, 55C1FFAC1CF5840F00F870AD /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; 55C1FFB51CF5840F00F870AD /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 55C1FFC01CF5840F00F870AD /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 55C1FF9A1CF5840F00F870AD /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 55C1001D1CF5899700F870AD /* SecondViewController.m in Sources */, 55C1FFA91CF5840F00F870AD /* ViewController.m in Sources */, 55C1FFA61CF5840F00F870AD /* AppDelegate.m in Sources */, 55C1FFA31CF5840F00F870AD /* main.m in Sources */, 55C1FFD61CF5874F00F870AD /* FloatingWindow.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 55C1FFB31CF5840F00F870AD /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 55C1FFBC1CF5840F00F870AD /* FloatingWindwoAminationTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 55C1FFBE1CF5840F00F870AD /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 55C1FFC71CF5840F00F870AD /* FloatingWindwoAminationUITests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 55C1FFB91CF5840F00F870AD /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 55C1FF9D1CF5840F00F870AD /* FloatingWindwoAmination */; targetProxy = 55C1FFB81CF5840F00F870AD /* PBXContainerItemProxy */; }; 55C1FFC41CF5840F00F870AD /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 55C1FF9D1CF5840F00F870AD /* FloatingWindwoAmination */; targetProxy = 55C1FFC31CF5840F00F870AD /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 55C1FFAA1CF5840F00F870AD /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( 55C1FFAB1CF5840F00F870AD /* Base */, ); name = Main.storyboard; sourceTree = ""; }; 55C1FFAF1CF5840F00F870AD /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( 55C1FFB01CF5840F00F870AD /* Base */, ); name = LaunchScreen.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 55C1FFC91CF5840F00F870AD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.3; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 55C1FFCA1CF5840F00F870AD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; 55C1FFCC1CF5840F00F870AD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FloatingWindwoAmination/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = fx.FloatingWindwoAmination; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 55C1FFCD1CF5840F00F870AD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FloatingWindwoAmination/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = fx.FloatingWindwoAmination; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; 55C1FFCF1CF5840F00F870AD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = FloatingWindwoAminationTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = fx.FloatingWindwoAminationTests; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FloatingWindwoAmination.app/FloatingWindwoAmination"; }; name = Debug; }; 55C1FFD01CF5840F00F870AD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = FloatingWindwoAminationTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = fx.FloatingWindwoAminationTests; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FloatingWindwoAmination.app/FloatingWindwoAmination"; }; name = Release; }; 55C1FFD21CF5840F00F870AD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = FloatingWindwoAminationUITests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = fx.FloatingWindwoAminationUITests; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_TARGET_NAME = FloatingWindwoAmination; }; name = Debug; }; 55C1FFD31CF5840F00F870AD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = FloatingWindwoAminationUITests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = fx.FloatingWindwoAminationUITests; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_TARGET_NAME = FloatingWindwoAmination; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 55C1FF991CF5840F00F870AD /* Build configuration list for PBXProject "FloatingWindwoAmination" */ = { isa = XCConfigurationList; buildConfigurations = ( 55C1FFC91CF5840F00F870AD /* Debug */, 55C1FFCA1CF5840F00F870AD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 55C1FFCB1CF5840F00F870AD /* Build configuration list for PBXNativeTarget "FloatingWindwoAmination" */ = { isa = XCConfigurationList; buildConfigurations = ( 55C1FFCC1CF5840F00F870AD /* Debug */, 55C1FFCD1CF5840F00F870AD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 55C1FFCE1CF5840F00F870AD /* Build configuration list for PBXNativeTarget "FloatingWindwoAminationTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 55C1FFCF1CF5840F00F870AD /* Debug */, 55C1FFD01CF5840F00F870AD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 55C1FFD11CF5840F00F870AD /* Build configuration list for PBXNativeTarget "FloatingWindwoAminationUITests" */ = { isa = XCConfigurationList; buildConfigurations = ( 55C1FFD21CF5840F00F870AD /* Debug */, 55C1FFD31CF5840F00F870AD /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 55C1FF961CF5840F00F870AD /* Project object */; } ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/project.xcworkspace/xcshareddata/FloatingWindwoAmination.xccheckout ================================================ IDESourceControlProjectFavoriteDictionaryKey IDESourceControlProjectIdentifier 58C7ABBF-BD4E-4ED6-BDB8-C24673CAAD67 IDESourceControlProjectName FloatingWindwoAmination IDESourceControlProjectOriginsDictionary 4EE05246D849351171D744971FB17F5FE9FBED21 https://github.com/hzQuan/FloatingWindow.git IDESourceControlProjectPath FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj IDESourceControlProjectRelativeInstallPathDictionary 4EE05246D849351171D744971FB17F5FE9FBED21 ../../.. IDESourceControlProjectURL https://github.com/hzQuan/FloatingWindow.git IDESourceControlProjectVersion 111 IDESourceControlProjectWCCIdentifier 4EE05246D849351171D744971FB17F5FE9FBED21 IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey 4EE05246D849351171D744971FB17F5FE9FBED21 IDESourceControlWCCName FloatingWindow ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/xcuserdata/huangzengquan.xcuserdatad/xcschemes/FloatingWindwoAmination.xcscheme ================================================ ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/xcuserdata/huangzengquan.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState FloatingWindwoAmination.xcscheme orderHint 0 SuppressBuildableAutocreation 55C1FF9D1CF5840F00F870AD primary 55C1FFB61CF5840F00F870AD primary 55C1FFC11CF5840F00F870AD primary ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/xcuserdata/huangzq.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/xcuserdata/huangzq.xcuserdatad/xcschemes/FloatingWindwoAmination.xcscheme ================================================ ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/xcuserdata/huangzq.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState FloatingWindwoAmination.xcscheme orderHint 0 SuppressBuildableAutocreation 55C1FF9D1CF5840F00F870AD primary 55C1FFB61CF5840F00F870AD primary 55C1FFC11CF5840F00F870AD primary ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/xcuserdata/quan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/xcuserdata/quan.xcuserdatad/xcschemes/FloatingWindwoAmination.xcscheme ================================================ ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAmination.xcodeproj/xcuserdata/quan.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SchemeUserState FloatingWindwoAmination.xcscheme orderHint 0 SuppressBuildableAutocreation 55C1FF9D1CF5840F00F870AD primary 55C1FFB61CF5840F00F870AD primary 55C1FFC11CF5840F00F870AD primary ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAminationTests/FloatingWindwoAminationTests.m ================================================ // // FloatingWindwoAminationTests.m // FloatingWindwoAminationTests // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import @interface FloatingWindwoAminationTests : XCTestCase @end @implementation FloatingWindwoAminationTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAminationTests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAminationUITests/FloatingWindwoAminationUITests.m ================================================ // // FloatingWindwoAminationUITests.m // FloatingWindwoAminationUITests // // Created by huangzengquan on 16/5/25. // Copyright © 2016年 huangzengquan. All rights reserved. // #import @interface FloatingWindwoAminationUITests : XCTestCase @end @implementation FloatingWindwoAminationUITests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. // In UI tests it is usually best to stop immediately when a failure occurs. self.continueAfterFailure = NO; // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. [[[XCUIApplication alloc] init] launch]; // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { // Use recording to get started writing UI tests. // Use XCTAssert and related functions to verify your tests produce the correct results. } @end ================================================ FILE: FloatingWindwoAmination/FloatingWindwoAminationUITests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2016 quan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # FloatingWindow
悬浮窗圆形转场动画框架,首先是实现了悬浮窗,然后再添加了圆形缩小的入场动画和圆形扩大的出场动画,可以给所有的controller添加这个效果

Look


![image](https://github.com/hzQuan/FloatingWindow/blob/master/悬浮窗4.gif)

How to use it


1.在appdelegate中添加

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

self.floatWindow = [[FloatingWindow alloc] initWithFrame:CGRectMake(100, 100, 76, 76) imageName:@"av_call"];

[self.floatWindow makeKeyAndVisible];

self.floatWindow.hidden = YES;

return YES; }

2.你需要开启悬浮窗的viewcontroller中添加方法:

实现点击小圆点的委托 deleage.floatWindow.floatDelegate = weakSelf;
开启悬浮窗 [deleage.floatWindow startWithTime:30 presentview:self.view inRect:CGRectMake(100, 100, 100, 100)];

MORE


If you can't choice simulator,please change your development

If you find bug , please comtact me . email 1634104309@qq.com qq:1634104309