├── .DS_Store ├── SuspendView ├── SuspendView │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── SuspendView.xcdatamodeld │ │ ├── .xccurrentversion │ │ └── SuspendView.xcdatamodel │ │ │ └── contents │ ├── main.m │ ├── ViewController.h │ ├── AppDelegate.h │ ├── WQSuspendView.h │ ├── ViewController.m │ ├── Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── AppDelegate.m │ └── WQSuspendView.m └── SuspendView.xcodeproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── project.pbxproj ├── .gitignore └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liwq87112/WQSuspendView/HEAD/.DS_Store -------------------------------------------------------------------------------- /SuspendView/SuspendView/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SuspendView/SuspendView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SuspendView/SuspendView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/SuspendView.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | SuspendView.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/SuspendView.xcdatamodeld/SuspendView.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SuspendView 4 | // 5 | // Created by 李文强 on 2019/6/6. 6 | // Copyright © 2019年 WenqiangLI. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SuspendView 4 | // 5 | // Created by 李文强 on 2019/6/6. 6 | // Copyright © 2019年 WenqiangLI. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | /** 第一进来为NO 跳转过的都为YES */ 14 | @property (nonatomic, assign) BOOL type; 15 | 16 | /** 是否隐藏 */ 17 | @property (nonatomic, assign) BOOL viewHidden; 18 | 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SuspendView 4 | // 5 | // Created by 李文强 on 2019/6/6. 6 | // Copyright © 2019年 WenqiangLI. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @property (readonly, strong) NSPersistentContainer *persistentContainer; 17 | 18 | - (void)saveContext; 19 | 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/WQSuspendView.h: -------------------------------------------------------------------------------- 1 | // 2 | // WQSuspendView.h 3 | // SuspendView 4 | // 5 | // Created by 李文强 on 2019/6/6. 6 | // Copyright © 2019年 WenqiangLI. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | 14 | typedef NS_ENUM(NSUInteger, WQSuspendViewType) { 15 | WQSuspendViewTypeNone = 0, //根据左右距离的一半自动居左局右 16 | WQSuspendViewTypeLeft, //居左 17 | WQSuspendViewTypeRight, //居右 18 | }; 19 | 20 | @interface WQSuspendView : UIView 21 | 22 | @property (nonatomic, copy) void (^tapBlock)(void); 23 | 24 | /** 显示 默认为 WQSuspendViewTypeNone*/ 25 | + (void)show; 26 | /** 显示 + 显示的位置*/ 27 | + (void)showWithType:(WQSuspendViewType)type; 28 | /** 显示 + 位置 + 点击的事件 */ 29 | + (void)showWithType:(WQSuspendViewType)type tapBlock:(void (^)(void))tapBlock; 30 | /** 移除 */ 31 | + (void)remove; 32 | 33 | @end 34 | 35 | NS_ASSUME_NONNULL_END 36 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SuspendView 4 | // 5 | // Created by 李文强 on 2019/6/6. 6 | // Copyright © 2019年 WenqiangLI. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "WQSuspendView.h" 11 | @interface ViewController () 12 | 13 | @property (weak, nonatomic) IBOutlet UIButton *pushButton; 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewWillAppear:(BOOL)animated{ 20 | [super viewWillAppear:animated]; 21 | if (!_type) { 22 | // [WQSuspendView show]; 23 | // [WQSuspendView showWithType:WQSuspendViewTypeLeft]; 24 | [WQSuspendView showWithType:WQSuspendViewTypeNone tapBlock:^{ 25 | NSLog(@"点击了"); 26 | }]; 27 | } 28 | } 29 | 30 | - (void)viewDidLoad { 31 | [super viewDidLoad]; 32 | // Do any additional setup after loading the view, typically from a nib. 33 | 34 | self.view.backgroundColor = [UIColor whiteColor]; 35 | 36 | } 37 | 38 | //不隐藏 39 | - (IBAction)pushClick:(id)sender { 40 | ViewController *vc = [[ViewController alloc] init]; 41 | vc.type = YES; 42 | vc.viewHidden = NO; 43 | [self.navigationController pushViewController:vc animated:YES]; 44 | } 45 | 46 | //隐藏 47 | - (IBAction)pushHiddenClick:(id)sender { 48 | ViewController *vc = [[ViewController alloc] init]; 49 | vc.type = YES; 50 | vc.viewHidden = YES; 51 | [self.navigationController pushViewController:vc animated:YES]; 52 | } 53 | 54 | - (void)setViewHidden:(BOOL)viewHidden{ 55 | if (viewHidden) { 56 | [WQSuspendView remove]; 57 | } 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots/**/*.png 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /SuspendView/SuspendView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SuspendView 4 | // 5 | // Created by 李文强 on 2019/6/6. 6 | // Copyright © 2019年 WenqiangLI. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | // Saves changes in the application's managed object context before the application terminates. 49 | [self saveContext]; 50 | } 51 | 52 | 53 | #pragma mark - Core Data stack 54 | 55 | @synthesize persistentContainer = _persistentContainer; 56 | 57 | - (NSPersistentContainer *)persistentContainer { 58 | // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. 59 | @synchronized (self) { 60 | if (_persistentContainer == nil) { 61 | _persistentContainer = [[NSPersistentContainer alloc] initWithName:@"SuspendView"]; 62 | [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) { 63 | if (error != nil) { 64 | // Replace this implementation with code to handle the error appropriately. 65 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 66 | 67 | /* 68 | Typical reasons for an error here include: 69 | * The parent directory does not exist, cannot be created, or disallows writing. 70 | * The persistent store is not accessible, due to permissions or data protection when the device is locked. 71 | * The device is out of space. 72 | * The store could not be migrated to the current model version. 73 | Check the error message to determine what the actual problem was. 74 | */ 75 | NSLog(@"Unresolved error %@, %@", error, error.userInfo); 76 | abort(); 77 | } 78 | }]; 79 | } 80 | } 81 | 82 | return _persistentContainer; 83 | } 84 | 85 | #pragma mark - Core Data Saving support 86 | 87 | - (void)saveContext { 88 | NSManagedObjectContext *context = self.persistentContainer.viewContext; 89 | NSError *error = nil; 90 | if ([context hasChanges] && ![context save:&error]) { 91 | // Replace this implementation with code to handle the error appropriately. 92 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 93 | NSLog(@"Unresolved error %@, %@", error, error.userInfo); 94 | abort(); 95 | } 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WQSuspendView 2 | 一句demo 显示、点击. 支持自定义 3 | 先上图 4 | ![suspend.gif](https://upload-images.jianshu.io/upload_images/2835602-a7290db1e68a38a4.gif?imageMogr2/auto-orient/strip) 5 | 6 | 1、刚刚开始做是用来给测试人员用,不需要一直打包,然后就用一个固定的UIButton来代替. 7 | 2、后面有一个分享有礼功能一直悬浮,离开这个页面时移除.然后才考虑写悬浮按钮. 8 | 3、因为我们产品需求当前页面能手动点击移除,所以用UIView 来写,高度自定义. 9 | 10 | #####悬浮有2种方式能实现 11 | (1)手势 UIPanGestureRecognizer 12 | UIGestureRecognizerStateBegan 13 | UIGestureRecognizerStateChanged 14 | UIGestureRecognizerStateEnded 15 | 16 | (2)点击屏幕的几个方法 17 | -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 18 | -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 19 | -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 20 | 21 | 手势和点击屏幕事件的区别唯一就是获取当前位置不一样 22 | ``` 23 | //点击屏幕事件获取当前位置 24 | UITouch *touch = [touches anyObject]; 25 | CGPoint currentPosition = [touch locationInView:self]; 26 | 27 | // 手势获取当前位置 28 | CGPoint currentPosition = [pan locationInView:self]; 29 | ``` 30 | 31 | 下面用手势来一一讲解 32 | ``` 33 | - (void)configurationUI{ 34 | self.backgroundColor = [UIColor redColor]; 35 | //自定义图片~文字等... 36 | 37 | //点击手势 38 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]; 39 | [self addGestureRecognizer:tap]; 40 | //滑动手势 41 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; 42 | [self addGestureRecognizer:pan]; 43 | } 44 | //点击事件 45 | - (void)tap:(UITapGestureRecognizer *)tap{ 46 | if (self.tapBlock) { 47 | self.tapBlock(); 48 | } 49 | } 50 | 51 | //滑动事件 52 | - (void)pan:(UIPanGestureRecognizer *)pan{ 53 | //获取当前位置 54 | CGPoint currentPosition = [pan locationInView:self]; 55 | if (pan.state == UIGestureRecognizerStateBegan) { 56 | _originalPoint = currentPosition; 57 | }else if(pan.state == UIGestureRecognizerStateChanged){ 58 | //偏移量(当前坐标 - 起始坐标 = 偏移量) 59 | CGFloat offsetX = currentPosition.x - _originalPoint.x; 60 | CGFloat offsetY = currentPosition.y - _originalPoint.y; 61 | 62 | //移动后的按钮中心坐标 63 | CGFloat centerX = self.center.x + offsetX; 64 | CGFloat centerY = self.center.y + offsetY; 65 | self.center = CGPointMake(centerX, centerY); 66 | 67 | //父试图的宽高 68 | CGFloat superViewWidth = self.superview.frame.size.width; 69 | CGFloat superViewHeight = self.superview.frame.size.height; 70 | CGFloat btnX = self.frame.origin.x; 71 | CGFloat btnY = self.frame.origin.y; 72 | CGFloat btnW = self.frame.size.width; 73 | CGFloat btnH = self.frame.size.height; 74 | 75 | //x轴左右极限坐标 76 | if (btnX > superViewWidth){ 77 | //按钮右侧越界 78 | CGFloat centerX = superViewWidth - btnW/2; 79 | self.center = CGPointMake(centerX, centerY); 80 | }else if (btnX < 0){ 81 | //按钮左侧越界 82 | CGFloat centerX = btnW * 0.5; 83 | self.center = CGPointMake(centerX, centerY); 84 | } 85 | 86 | //默认都是有导航条的,有导航条的,父试图高度就要被导航条占据,固高度不够 87 | CGFloat defaultNaviHeight = 64; 88 | CGFloat judgeSuperViewHeight = superViewHeight - defaultNaviHeight; 89 | 90 | //y轴上下极限坐标 91 | if (btnY <= 0){ 92 | //按钮顶部越界 93 | centerY = btnH * 0.7; 94 | self.center = CGPointMake(centerX, centerY); 95 | } 96 | else if (btnY > judgeSuperViewHeight){ 97 | //按钮底部越界 98 | CGFloat y = superViewHeight - btnH * 0.5; 99 | self.center = CGPointMake(btnX, y); 100 | } 101 | }else if (pan.state == UIGestureRecognizerStateEnded){ 102 | CGFloat btnWidth = self.frame.size.width; 103 | CGFloat btnHeight = self.frame.size.height; 104 | CGFloat btnY = self.frame.origin.y; 105 | // CGFloat btnX = self.frame.origin.x; 106 | //按钮靠近右侧 107 | switch (_type) { 108 | 109 | case WQSuspendViewTypeNone:{ 110 | //自动识别贴边 111 | if (self.center.x >= self.superview.frame.size.width/2) { 112 | 113 | [UIView animateWithDuration:0.5 animations:^{ 114 | //按钮靠右自动吸边 115 | CGFloat btnX = self.superview.frame.size.width - btnWidth; 116 | self.frame = CGRectMake(btnX, btnY, btnWidth, btnHeight); 117 | }]; 118 | }else{ 119 | 120 | [UIView animateWithDuration:0.5 animations:^{ 121 | //按钮靠左吸边 122 | CGFloat btnX = 0; 123 | self.frame = CGRectMake(btnX, btnY, btnWidth, btnHeight); 124 | }]; 125 | } 126 | break; 127 | } 128 | case WQSuspendViewTypeLeft:{ 129 | [UIView animateWithDuration:0.5 animations:^{ 130 | //按钮靠左吸边 131 | CGFloat btnX = 0; 132 | self.frame = CGRectMake(btnX, btnY, btnWidth, btnHeight); 133 | }]; 134 | break; 135 | } 136 | case WQSuspendViewTypeRight:{ 137 | [UIView animateWithDuration:0.5 animations:^{ 138 | //按钮靠右自动吸边 139 | CGFloat btnX = self.superview.frame.size.width - btnWidth; 140 | self.frame = CGRectMake(btnX, btnY, btnWidth, btnHeight); 141 | }]; 142 | } 143 | } 144 | } 145 | 146 | } 147 | 148 | ``` 149 | 150 | ``` 151 | 152 | NS_ASSUME_NONNULL_BEGIN 153 | 154 | 155 | @property (nonatomic, copy) void (^tapBlock)(void); 156 | 157 | /** 显示 默认为 WQSuspendViewTypeNone*/ 158 | + (void)show; 159 | /** 显示 + 显示的位置*/ 160 | + (void)showWithType:(WQSuspendViewType)type; 161 | /** 显示 + 位置 + 点击的事件 */ 162 | + (void)showWithType:(WQSuspendViewType)type tapBlock:(void (^)(void))tapBlock; 163 | /** 移除 */ 164 | + (void)remove; 165 | 166 | 167 | NS_ASSUME_NONNULL_END 168 | ``` 169 | 详细请看demo 170 | 附上demo [WQSuspendView](https://github.com/liwq87112/WQSuspendView) 171 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 28 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /SuspendView/SuspendView/WQSuspendView.m: -------------------------------------------------------------------------------- 1 | // 2 | // WQSuspendView.m 3 | // SuspendView 4 | // 5 | // Created by 李文强 on 2019/6/6. 6 | // Copyright © 2019年 WenqiangLI. All rights reserved. 7 | // 8 | 9 | #import "WQSuspendView.h" 10 | 11 | @interface WQSuspendView (){ 12 | CGPoint _originalPoint;//之前的位置 13 | } 14 | 15 | @property (nonatomic, assign) WQSuspendViewType type; 16 | 17 | @end 18 | 19 | @implementation WQSuspendView 20 | 21 | static WQSuspendView *_suspendView; 22 | 23 | - (instancetype)initWithFrame:(CGRect)frame{ 24 | self = [super initWithFrame:frame]; 25 | if (self) { 26 | [self configurationUI]; 27 | } 28 | return self; 29 | } 30 | 31 | - (instancetype)initWithFrame:(CGRect)frame showType:(WQSuspendViewType)type tapBlock:(void (^)(void))tapBlock{ 32 | self = [super initWithFrame:frame]; 33 | if (self) { 34 | _type = type; 35 | _tapBlock = tapBlock; 36 | [self configurationUI]; 37 | } 38 | return self; 39 | } 40 | 41 | - (void)configurationUI{ 42 | //自定义 43 | self.backgroundColor = [UIColor redColor]; 44 | //图片~文字等... 45 | 46 | //点击手势 47 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]; 48 | [self addGestureRecognizer:tap]; 49 | //滑动手势 50 | UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; 51 | [self addGestureRecognizer:pan]; 52 | } 53 | 54 | //移除 55 | + (void)remove{ 56 | [_suspendView removeFromSuperview]; 57 | } 58 | 59 | //显示 60 | + (void)show{ 61 | [self showWithType:WQSuspendViewTypeNone]; 62 | } 63 | 64 | + (void)showWithType:(WQSuspendViewType)type{ 65 | static dispatch_once_t onceToken; 66 | dispatch_once(&onceToken, ^{ 67 | _suspendView = [[WQSuspendView alloc] initWithFrame:CGRectMake(0, 200, 50, 50) showType:type tapBlock:nil]; 68 | }); 69 | if (!_suspendView.superview) { 70 | [[UIApplication sharedApplication].keyWindow addSubview:_suspendView]; 71 | [[UIApplication sharedApplication].keyWindow bringSubviewToFront:_suspendView]; 72 | } 73 | } 74 | 75 | + (void)showWithType:(WQSuspendViewType)type tapBlock:(void (^)(void))tapBlock{ 76 | static dispatch_once_t onceToken; 77 | dispatch_once(&onceToken, ^{ 78 | _suspendView = [[WQSuspendView alloc] initWithFrame:CGRectMake(0, 200, 50, 50) showType:type tapBlock:tapBlock]; 79 | }); 80 | if (!_suspendView.superview) { 81 | [[UIApplication sharedApplication].keyWindow addSubview:_suspendView]; 82 | [[UIApplication sharedApplication].keyWindow bringSubviewToFront:_suspendView]; 83 | } 84 | } 85 | 86 | //点击事件 87 | - (void)tap:(UITapGestureRecognizer *)tap{ 88 | if (self.tapBlock) { 89 | self.tapBlock(); 90 | } 91 | } 92 | 93 | //滑动事件 94 | - (void)pan:(UIPanGestureRecognizer *)pan{ 95 | //获取当前位置 96 | CGPoint currentPosition = [pan locationInView:self]; 97 | if (pan.state == UIGestureRecognizerStateBegan) { 98 | _originalPoint = currentPosition; 99 | }else if(pan.state == UIGestureRecognizerStateChanged){ 100 | //偏移量(当前坐标 - 起始坐标 = 偏移量) 101 | CGFloat offsetX = currentPosition.x - _originalPoint.x; 102 | CGFloat offsetY = currentPosition.y - _originalPoint.y; 103 | 104 | //移动后的按钮中心坐标 105 | CGFloat centerX = self.center.x + offsetX; 106 | CGFloat centerY = self.center.y + offsetY; 107 | self.center = CGPointMake(centerX, centerY); 108 | 109 | //父试图的宽高 110 | CGFloat superViewWidth = self.superview.frame.size.width; 111 | CGFloat superViewHeight = self.superview.frame.size.height; 112 | CGFloat btnX = self.frame.origin.x; 113 | CGFloat btnY = self.frame.origin.y; 114 | CGFloat btnW = self.frame.size.width; 115 | CGFloat btnH = self.frame.size.height; 116 | 117 | //x轴左右极限坐标 118 | if (btnX > superViewWidth){ 119 | //按钮右侧越界 120 | CGFloat centerX = superViewWidth - btnW/2; 121 | self.center = CGPointMake(centerX, centerY); 122 | }else if (btnX < 0){ 123 | //按钮左侧越界 124 | CGFloat centerX = btnW * 0.5; 125 | self.center = CGPointMake(centerX, centerY); 126 | } 127 | 128 | //默认都是有导航条的,有导航条的,父试图高度就要被导航条占据,固高度不够 129 | CGFloat defaultNaviHeight = 64; 130 | CGFloat judgeSuperViewHeight = superViewHeight - defaultNaviHeight; 131 | 132 | //y轴上下极限坐标 133 | if (btnY <= 0){ 134 | //按钮顶部越界 135 | centerY = btnH * 0.7; 136 | self.center = CGPointMake(centerX, centerY); 137 | } 138 | else if (btnY > judgeSuperViewHeight){ 139 | //按钮底部越界 140 | CGFloat y = superViewHeight - btnH * 0.5; 141 | self.center = CGPointMake(btnX, y); 142 | } 143 | }else if (pan.state == UIGestureRecognizerStateEnded){ 144 | CGFloat btnWidth = self.frame.size.width; 145 | CGFloat btnHeight = self.frame.size.height; 146 | CGFloat btnY = self.frame.origin.y; 147 | // CGFloat btnX = self.frame.origin.x; 148 | //按钮靠近右侧 149 | switch (_type) { 150 | 151 | case WQSuspendViewTypeNone:{ 152 | //自动识别贴边 153 | if (self.center.x >= self.superview.frame.size.width/2) { 154 | 155 | [UIView animateWithDuration:0.5 animations:^{ 156 | //按钮靠右自动吸边 157 | CGFloat btnX = self.superview.frame.size.width - btnWidth; 158 | self.frame = CGRectMake(btnX, btnY, btnWidth, btnHeight); 159 | }]; 160 | }else{ 161 | 162 | [UIView animateWithDuration:0.5 animations:^{ 163 | //按钮靠左吸边 164 | CGFloat btnX = 0; 165 | self.frame = CGRectMake(btnX, btnY, btnWidth, btnHeight); 166 | }]; 167 | } 168 | break; 169 | } 170 | case WQSuspendViewTypeLeft:{ 171 | [UIView animateWithDuration:0.5 animations:^{ 172 | //按钮靠左吸边 173 | CGFloat btnX = 0; 174 | self.frame = CGRectMake(btnX, btnY, btnWidth, btnHeight); 175 | }]; 176 | break; 177 | } 178 | case WQSuspendViewTypeRight:{ 179 | [UIView animateWithDuration:0.5 animations:^{ 180 | //按钮靠右自动吸边 181 | CGFloat btnX = self.superview.frame.size.width - btnWidth; 182 | self.frame = CGRectMake(btnX, btnY, btnWidth, btnHeight); 183 | }]; 184 | } 185 | } 186 | } 187 | 188 | } 189 | 190 | 191 | 192 | 193 | 194 | @end 195 | -------------------------------------------------------------------------------- /SuspendView/SuspendView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6F60F0DF22A91A63008B954D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F60F0DE22A91A63008B954D /* AppDelegate.m */; }; 11 | 6F60F0E222A91A63008B954D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F60F0E122A91A63008B954D /* ViewController.m */; }; 12 | 6F60F0E522A91A63008B954D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6F60F0E322A91A63008B954D /* Main.storyboard */; }; 13 | 6F60F0E822A91A63008B954D /* SuspendView.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 6F60F0E622A91A63008B954D /* SuspendView.xcdatamodeld */; }; 14 | 6F60F0EA22A91A65008B954D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6F60F0E922A91A65008B954D /* Assets.xcassets */; }; 15 | 6F60F0ED22A91A65008B954D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6F60F0EB22A91A65008B954D /* LaunchScreen.storyboard */; }; 16 | 6F60F0F022A91A65008B954D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F60F0EF22A91A65008B954D /* main.m */; }; 17 | 6F60F0FB22A91DC2008B954D /* WQSuspendView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F60F0FA22A91DC2008B954D /* WQSuspendView.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 6F60F0DA22A91A63008B954D /* SuspendView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SuspendView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 6F60F0DD22A91A63008B954D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 23 | 6F60F0DE22A91A63008B954D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 24 | 6F60F0E022A91A63008B954D /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 25 | 6F60F0E122A91A63008B954D /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 26 | 6F60F0E422A91A63008B954D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 6F60F0E722A91A63008B954D /* SuspendView.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = SuspendView.xcdatamodel; sourceTree = ""; }; 28 | 6F60F0E922A91A65008B954D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 6F60F0EC22A91A65008B954D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 6F60F0EE22A91A65008B954D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 6F60F0EF22A91A65008B954D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32 | 6F60F0F922A91DC2008B954D /* WQSuspendView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WQSuspendView.h; sourceTree = ""; }; 33 | 6F60F0FA22A91DC2008B954D /* WQSuspendView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WQSuspendView.m; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | 6F60F0D722A91A63008B954D /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 6F60F0D122A91A63008B954D = { 48 | isa = PBXGroup; 49 | children = ( 50 | 6F60F0DC22A91A63008B954D /* SuspendView */, 51 | 6F60F0DB22A91A63008B954D /* Products */, 52 | ); 53 | sourceTree = ""; 54 | }; 55 | 6F60F0DB22A91A63008B954D /* Products */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | 6F60F0DA22A91A63008B954D /* SuspendView.app */, 59 | ); 60 | name = Products; 61 | sourceTree = ""; 62 | }; 63 | 6F60F0DC22A91A63008B954D /* SuspendView */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | 6F60F0F922A91DC2008B954D /* WQSuspendView.h */, 67 | 6F60F0FA22A91DC2008B954D /* WQSuspendView.m */, 68 | 6F60F0DD22A91A63008B954D /* AppDelegate.h */, 69 | 6F60F0DE22A91A63008B954D /* AppDelegate.m */, 70 | 6F60F0E022A91A63008B954D /* ViewController.h */, 71 | 6F60F0E122A91A63008B954D /* ViewController.m */, 72 | 6F60F0E322A91A63008B954D /* Main.storyboard */, 73 | 6F60F0E922A91A65008B954D /* Assets.xcassets */, 74 | 6F60F0EB22A91A65008B954D /* LaunchScreen.storyboard */, 75 | 6F60F0EE22A91A65008B954D /* Info.plist */, 76 | 6F60F0EF22A91A65008B954D /* main.m */, 77 | 6F60F0E622A91A63008B954D /* SuspendView.xcdatamodeld */, 78 | ); 79 | path = SuspendView; 80 | sourceTree = ""; 81 | }; 82 | /* End PBXGroup section */ 83 | 84 | /* Begin PBXNativeTarget section */ 85 | 6F60F0D922A91A63008B954D /* SuspendView */ = { 86 | isa = PBXNativeTarget; 87 | buildConfigurationList = 6F60F0F322A91A65008B954D /* Build configuration list for PBXNativeTarget "SuspendView" */; 88 | buildPhases = ( 89 | 6F60F0D622A91A63008B954D /* Sources */, 90 | 6F60F0D722A91A63008B954D /* Frameworks */, 91 | 6F60F0D822A91A63008B954D /* Resources */, 92 | ); 93 | buildRules = ( 94 | ); 95 | dependencies = ( 96 | ); 97 | name = SuspendView; 98 | productName = SuspendView; 99 | productReference = 6F60F0DA22A91A63008B954D /* SuspendView.app */; 100 | productType = "com.apple.product-type.application"; 101 | }; 102 | /* End PBXNativeTarget section */ 103 | 104 | /* Begin PBXProject section */ 105 | 6F60F0D222A91A63008B954D /* Project object */ = { 106 | isa = PBXProject; 107 | attributes = { 108 | LastUpgradeCheck = 1010; 109 | ORGANIZATIONNAME = WenqiangLI; 110 | TargetAttributes = { 111 | 6F60F0D922A91A63008B954D = { 112 | CreatedOnToolsVersion = 10.1; 113 | }; 114 | }; 115 | }; 116 | buildConfigurationList = 6F60F0D522A91A63008B954D /* Build configuration list for PBXProject "SuspendView" */; 117 | compatibilityVersion = "Xcode 9.3"; 118 | developmentRegion = en; 119 | hasScannedForEncodings = 0; 120 | knownRegions = ( 121 | en, 122 | Base, 123 | ); 124 | mainGroup = 6F60F0D122A91A63008B954D; 125 | productRefGroup = 6F60F0DB22A91A63008B954D /* Products */; 126 | projectDirPath = ""; 127 | projectRoot = ""; 128 | targets = ( 129 | 6F60F0D922A91A63008B954D /* SuspendView */, 130 | ); 131 | }; 132 | /* End PBXProject section */ 133 | 134 | /* Begin PBXResourcesBuildPhase section */ 135 | 6F60F0D822A91A63008B954D /* Resources */ = { 136 | isa = PBXResourcesBuildPhase; 137 | buildActionMask = 2147483647; 138 | files = ( 139 | 6F60F0ED22A91A65008B954D /* LaunchScreen.storyboard in Resources */, 140 | 6F60F0EA22A91A65008B954D /* Assets.xcassets in Resources */, 141 | 6F60F0E522A91A63008B954D /* Main.storyboard in Resources */, 142 | ); 143 | runOnlyForDeploymentPostprocessing = 0; 144 | }; 145 | /* End PBXResourcesBuildPhase section */ 146 | 147 | /* Begin PBXSourcesBuildPhase section */ 148 | 6F60F0D622A91A63008B954D /* Sources */ = { 149 | isa = PBXSourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | 6F60F0E822A91A63008B954D /* SuspendView.xcdatamodeld in Sources */, 153 | 6F60F0FB22A91DC2008B954D /* WQSuspendView.m in Sources */, 154 | 6F60F0E222A91A63008B954D /* ViewController.m in Sources */, 155 | 6F60F0F022A91A65008B954D /* main.m in Sources */, 156 | 6F60F0DF22A91A63008B954D /* AppDelegate.m in Sources */, 157 | ); 158 | runOnlyForDeploymentPostprocessing = 0; 159 | }; 160 | /* End PBXSourcesBuildPhase section */ 161 | 162 | /* Begin PBXVariantGroup section */ 163 | 6F60F0E322A91A63008B954D /* Main.storyboard */ = { 164 | isa = PBXVariantGroup; 165 | children = ( 166 | 6F60F0E422A91A63008B954D /* Base */, 167 | ); 168 | name = Main.storyboard; 169 | sourceTree = ""; 170 | }; 171 | 6F60F0EB22A91A65008B954D /* LaunchScreen.storyboard */ = { 172 | isa = PBXVariantGroup; 173 | children = ( 174 | 6F60F0EC22A91A65008B954D /* Base */, 175 | ); 176 | name = LaunchScreen.storyboard; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXVariantGroup section */ 180 | 181 | /* Begin XCBuildConfiguration section */ 182 | 6F60F0F122A91A65008B954D /* Debug */ = { 183 | isa = XCBuildConfiguration; 184 | buildSettings = { 185 | ALWAYS_SEARCH_USER_PATHS = NO; 186 | CLANG_ANALYZER_NONNULL = YES; 187 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 188 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 189 | CLANG_CXX_LIBRARY = "libc++"; 190 | CLANG_ENABLE_MODULES = YES; 191 | CLANG_ENABLE_OBJC_ARC = YES; 192 | CLANG_ENABLE_OBJC_WEAK = YES; 193 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 194 | CLANG_WARN_BOOL_CONVERSION = YES; 195 | CLANG_WARN_COMMA = YES; 196 | CLANG_WARN_CONSTANT_CONVERSION = YES; 197 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 198 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 199 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 200 | CLANG_WARN_EMPTY_BODY = YES; 201 | CLANG_WARN_ENUM_CONVERSION = YES; 202 | CLANG_WARN_INFINITE_RECURSION = YES; 203 | CLANG_WARN_INT_CONVERSION = YES; 204 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 205 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 206 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 207 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 208 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 209 | CLANG_WARN_STRICT_PROTOTYPES = YES; 210 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 211 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 212 | CLANG_WARN_UNREACHABLE_CODE = YES; 213 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 214 | CODE_SIGN_IDENTITY = "iPhone Developer"; 215 | COPY_PHASE_STRIP = NO; 216 | DEBUG_INFORMATION_FORMAT = dwarf; 217 | ENABLE_STRICT_OBJC_MSGSEND = YES; 218 | ENABLE_TESTABILITY = YES; 219 | GCC_C_LANGUAGE_STANDARD = gnu11; 220 | GCC_DYNAMIC_NO_PIC = NO; 221 | GCC_NO_COMMON_BLOCKS = YES; 222 | GCC_OPTIMIZATION_LEVEL = 0; 223 | GCC_PREPROCESSOR_DEFINITIONS = ( 224 | "DEBUG=1", 225 | "$(inherited)", 226 | ); 227 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 228 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 229 | GCC_WARN_UNDECLARED_SELECTOR = YES; 230 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 231 | GCC_WARN_UNUSED_FUNCTION = YES; 232 | GCC_WARN_UNUSED_VARIABLE = YES; 233 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 234 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 235 | MTL_FAST_MATH = YES; 236 | ONLY_ACTIVE_ARCH = YES; 237 | SDKROOT = iphoneos; 238 | }; 239 | name = Debug; 240 | }; 241 | 6F60F0F222A91A65008B954D /* Release */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ALWAYS_SEARCH_USER_PATHS = NO; 245 | CLANG_ANALYZER_NONNULL = YES; 246 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 247 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 248 | CLANG_CXX_LIBRARY = "libc++"; 249 | CLANG_ENABLE_MODULES = YES; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_ENABLE_OBJC_WEAK = YES; 252 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_COMMA = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 259 | CLANG_WARN_EMPTY_BODY = YES; 260 | CLANG_WARN_ENUM_CONVERSION = YES; 261 | CLANG_WARN_INFINITE_RECURSION = YES; 262 | CLANG_WARN_INT_CONVERSION = YES; 263 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 264 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 265 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 266 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 267 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 268 | CLANG_WARN_STRICT_PROTOTYPES = YES; 269 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 270 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 271 | CLANG_WARN_UNREACHABLE_CODE = YES; 272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 273 | CODE_SIGN_IDENTITY = "iPhone Developer"; 274 | COPY_PHASE_STRIP = NO; 275 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 276 | ENABLE_NS_ASSERTIONS = NO; 277 | ENABLE_STRICT_OBJC_MSGSEND = YES; 278 | GCC_C_LANGUAGE_STANDARD = gnu11; 279 | GCC_NO_COMMON_BLOCKS = YES; 280 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 281 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 282 | GCC_WARN_UNDECLARED_SELECTOR = YES; 283 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 284 | GCC_WARN_UNUSED_FUNCTION = YES; 285 | GCC_WARN_UNUSED_VARIABLE = YES; 286 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 287 | MTL_ENABLE_DEBUG_INFO = NO; 288 | MTL_FAST_MATH = YES; 289 | SDKROOT = iphoneos; 290 | VALIDATE_PRODUCT = YES; 291 | }; 292 | name = Release; 293 | }; 294 | 6F60F0F422A91A65008B954D /* Debug */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | CODE_SIGN_STYLE = Automatic; 299 | DEVELOPMENT_TEAM = 6L3GDK8D9J; 300 | INFOPLIST_FILE = SuspendView/Info.plist; 301 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 302 | LD_RUNPATH_SEARCH_PATHS = ( 303 | "$(inherited)", 304 | "@executable_path/Frameworks", 305 | ); 306 | PRODUCT_BUNDLE_IDENTIFIER = wenqiangli.SuspendView; 307 | PRODUCT_NAME = "$(TARGET_NAME)"; 308 | TARGETED_DEVICE_FAMILY = "1,2"; 309 | }; 310 | name = Debug; 311 | }; 312 | 6F60F0F522A91A65008B954D /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 316 | CODE_SIGN_STYLE = Automatic; 317 | DEVELOPMENT_TEAM = 6L3GDK8D9J; 318 | INFOPLIST_FILE = SuspendView/Info.plist; 319 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 320 | LD_RUNPATH_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "@executable_path/Frameworks", 323 | ); 324 | PRODUCT_BUNDLE_IDENTIFIER = wenqiangli.SuspendView; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | TARGETED_DEVICE_FAMILY = "1,2"; 327 | }; 328 | name = Release; 329 | }; 330 | /* End XCBuildConfiguration section */ 331 | 332 | /* Begin XCConfigurationList section */ 333 | 6F60F0D522A91A63008B954D /* Build configuration list for PBXProject "SuspendView" */ = { 334 | isa = XCConfigurationList; 335 | buildConfigurations = ( 336 | 6F60F0F122A91A65008B954D /* Debug */, 337 | 6F60F0F222A91A65008B954D /* Release */, 338 | ); 339 | defaultConfigurationIsVisible = 0; 340 | defaultConfigurationName = Release; 341 | }; 342 | 6F60F0F322A91A65008B954D /* Build configuration list for PBXNativeTarget "SuspendView" */ = { 343 | isa = XCConfigurationList; 344 | buildConfigurations = ( 345 | 6F60F0F422A91A65008B954D /* Debug */, 346 | 6F60F0F522A91A65008B954D /* Release */, 347 | ); 348 | defaultConfigurationIsVisible = 0; 349 | defaultConfigurationName = Release; 350 | }; 351 | /* End XCConfigurationList section */ 352 | 353 | /* Begin XCVersionGroup section */ 354 | 6F60F0E622A91A63008B954D /* SuspendView.xcdatamodeld */ = { 355 | isa = XCVersionGroup; 356 | children = ( 357 | 6F60F0E722A91A63008B954D /* SuspendView.xcdatamodel */, 358 | ); 359 | currentVersion = 6F60F0E722A91A63008B954D /* SuspendView.xcdatamodel */; 360 | path = SuspendView.xcdatamodeld; 361 | sourceTree = ""; 362 | versionGroupType = wrapper.xcdatamodel; 363 | }; 364 | /* End XCVersionGroup section */ 365 | }; 366 | rootObject = 6F60F0D222A91A63008B954D /* Project object */; 367 | } 368 | --------------------------------------------------------------------------------