├── image ├── iii.gif ├── icon1.gif ├── icon2.gif ├── icon3.gif ├── icon4.gif ├── icon5.gif ├── icon6.gif ├── icon7.gif ├── icon8.gif ├── image1.gif ├── image2.gif ├── image3.gif ├── image4.gif ├── image5.gif └── image6.gif ├── MGWidget ├── MGWidget │ ├── earth.png │ ├── plus_circle@2x.png │ ├── plus_circle@3x.png │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── plus_off.imageset │ │ │ ├── plus.png │ │ │ └── Contents.json │ │ ├── plus_on.imageset │ │ │ ├── plus-2.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── ViewController.h │ ├── MGWidget │ │ ├── LoaderView │ │ │ ├── MGChainView.h │ │ │ ├── MGWorshipView.h │ │ │ ├── MGRotaLoadView.h │ │ │ ├── MGLoadDotView.h │ │ │ ├── MGLoaderView.h │ │ │ ├── MGAlterView.h │ │ │ ├── CALayer+Common.h │ │ │ ├── NSObject+LoadTool.h │ │ │ ├── CALayer+Common.m │ │ │ ├── MGWorshipView.m │ │ │ ├── NSObject+LoadTool.m │ │ │ ├── MGChainView.m │ │ │ ├── MGLoadDotView.m │ │ │ ├── MGLoaderView.m │ │ │ ├── MGRotaLoadView.m │ │ │ └── MGAlterView.m │ │ ├── ShowView │ │ │ ├── MGShowView.h │ │ │ ├── MGPatternView.h │ │ │ ├── NSObject+common.h │ │ │ ├── NSObject+common.m │ │ │ ├── MGShowView.m │ │ │ └── MGPatternView.m │ │ ├── UIView+Frame.h │ │ └── UIView+Frame.m │ ├── AppDelegate.h │ ├── MGShowController.h │ ├── main.m │ ├── PrefixHeader.pch │ ├── Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── AppDelegate.m │ ├── MGShowController.m │ └── ViewController.m ├── MGWidget.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── project.pbxproj ├── MGWidgetTests │ ├── Info.plist │ └── MGWidgetTests.m └── MGWidgetUITests │ ├── Info.plist │ └── MGWidgetUITests.m ├── LICENSE ├── README.md └── .gitignore /image/iii.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/iii.gif -------------------------------------------------------------------------------- /image/icon1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/icon1.gif -------------------------------------------------------------------------------- /image/icon2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/icon2.gif -------------------------------------------------------------------------------- /image/icon3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/icon3.gif -------------------------------------------------------------------------------- /image/icon4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/icon4.gif -------------------------------------------------------------------------------- /image/icon5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/icon5.gif -------------------------------------------------------------------------------- /image/icon6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/icon6.gif -------------------------------------------------------------------------------- /image/icon7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/icon7.gif -------------------------------------------------------------------------------- /image/icon8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/icon8.gif -------------------------------------------------------------------------------- /image/image1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/image1.gif -------------------------------------------------------------------------------- /image/image2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/image2.gif -------------------------------------------------------------------------------- /image/image3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/image3.gif -------------------------------------------------------------------------------- /image/image4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/image4.gif -------------------------------------------------------------------------------- /image/image5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/image5.gif -------------------------------------------------------------------------------- /image/image6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/image/image6.gif -------------------------------------------------------------------------------- /MGWidget/MGWidget/earth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/MGWidget/MGWidget/earth.png -------------------------------------------------------------------------------- /MGWidget/MGWidget/plus_circle@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/MGWidget/MGWidget/plus_circle@2x.png -------------------------------------------------------------------------------- /MGWidget/MGWidget/plus_circle@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/MGWidget/MGWidget/plus_circle@3x.png -------------------------------------------------------------------------------- /MGWidget/MGWidget/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /MGWidget/MGWidget/Assets.xcassets/plus_off.imageset/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/MGWidget/MGWidget/Assets.xcassets/plus_off.imageset/plus.png -------------------------------------------------------------------------------- /MGWidget/MGWidget/Assets.xcassets/plus_on.imageset/plus-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malgee012/MGWidget/HEAD/MGWidget/MGWidget/Assets.xcassets/plus_on.imageset/plus-2.png -------------------------------------------------------------------------------- /MGWidget/MGWidget.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGChainView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGChainView.h 3 | // MGWidget 4 | // 5 | // Created by maling on 2018/4/11. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGChainView : UIView 12 | 13 | - (void)showAnimationView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGWorshipView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGWorshipView.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/5. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGWorshipView : UIView 12 | 13 | - (void)showAnimationView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MGWidget/MGWidget.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGRotaLoadView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGRotaLoadView.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/19. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGRotaLoadView : UIView 12 | 13 | - (void)showAnimationView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGLoadDotView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGLoadDotView.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/4. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGLoadDotView : UIView 12 | 13 | - (void)showAnimationView; 14 | 15 | - (void)hideAnimationView; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGShowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGShowController.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/29. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGShowController : UIViewController 12 | 13 | - (instancetype)initWithType:(MGEffectStyle)type section:(NSInteger)section; 14 | 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGLoaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGLoaderView.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/30. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGLoaderView : UIView 12 | 13 | @property (nonatomic, assign) MGLoaderStyle style; 14 | 15 | + (instancetype)loader; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/ShowView/MGShowView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGShowView.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/29. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGShowView : UIView 12 | 13 | @property (nonatomic, assign) MGEffectStyle type; 14 | 15 | + (instancetype)showWithType:(MGEffectStyle)type; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. 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 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGAlterView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGAlterView.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/12. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGAlterView : UIView 12 | 13 | - (void)showAnimationView; 14 | 15 | @end 16 | 17 | 18 | @interface MGAlternationView : UIView 19 | 20 | - (void)showAnimationView; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/Assets.xcassets/plus_off.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "plus.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /MGWidget/MGWidget/Assets.xcassets/plus_on.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "plus-2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/CALayer+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // CALayer+Common.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/12. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface CALayer (Common) 13 | 14 | - (CABasicAnimation *)animationKeyPath:(NSString *)keyPath 15 | position:(CGPoint)position 16 | duration:(CFTimeInterval)duration 17 | key:(NSString *)key 18 | isReverses:(BOOL)isReverses 19 | repeatTime:(CGFloat)repeat; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/NSObject+LoadTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+LoadTool.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/3. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (LoadTool) 12 | 13 | typedef NS_ENUM(NSInteger, MGLoaderStyle) { 14 | 15 | MGLoaderStyleTriangle, 16 | MGLoaderStyleCationDot, 17 | MGLoaderStyleExpandDot, 18 | MGLoaderStyleShipDot, 19 | MGLoaderStyleChain, 20 | MGLoaderStyleAlter, 21 | MGLoaderStyleAlternation, 22 | MGLoaderStyleRotaDot 23 | 24 | }; 25 | 26 | //@property (nonatomic, assign) CGFloat _kViewWidth; 27 | 28 | - (void)addAnimationWithLoaderStyle:(MGLoaderStyle)style; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MGWidget/MGWidgetTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /MGWidget/MGWidgetUITests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/ShowView/MGPatternView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGPatternView.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/1. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, MGMotorDirection) { 12 | 13 | MGMotorDirectionUp, 14 | MGMotorDirectionLeft, 15 | MGMotorDirectionDown, 16 | MGMotorDirectionRight 17 | }; 18 | 19 | @interface MGPatternView : UIView 20 | 21 | @property (nonatomic, copy) void(^PatterviewBlock)(NSInteger index); 22 | 23 | @property (nonatomic, assign) MGMotorDirection motorDirection; 24 | 25 | @property (nonatomic, strong) NSArray *subViews; 26 | 27 | @property (nonatomic, assign) CGFloat viewSpacing; 28 | 29 | @property (nonatomic, assign) CGFloat animationDuration; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /MGWidget/MGWidgetTests/MGWidgetTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGWidgetTests.m 3 | // MGWidgetTests 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGWidgetTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation MGWidgetTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 malgee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/UIView+Frame.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Frame.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (Frame) 12 | 13 | /** 14 | * 起点x坐标 15 | */ 16 | @property (nonatomic, assign) CGFloat x; 17 | /** 18 | * 起点y坐标 19 | */ 20 | @property (nonatomic, assign) CGFloat y; 21 | /** 22 | * 中心点x坐标 23 | */ 24 | @property (nonatomic, assign) CGFloat centerX; 25 | /** 26 | * 中心点y坐标 27 | */ 28 | @property (nonatomic, assign) CGFloat centerY; 29 | /** 30 | * 宽度 31 | */ 32 | @property (nonatomic, assign) CGFloat width; 33 | /** 34 | * 高度 35 | */ 36 | @property (nonatomic, assign) CGFloat height; 37 | /** 38 | * 顶部 39 | */ 40 | @property (nonatomic, assign) CGFloat top; 41 | /** 42 | * 底部 43 | */ 44 | @property (nonatomic, assign) CGFloat bottom; 45 | /** 46 | * 左边 47 | */ 48 | @property (nonatomic, assign) CGFloat left; 49 | /** 50 | * 右边 51 | */ 52 | @property (nonatomic, assign) CGFloat right; 53 | /** 54 | * size 55 | */ 56 | @property (nonatomic, assign) CGSize size; 57 | /** 58 | * 起点坐标 59 | */ 60 | @property (nonatomic, assign) CGPoint origin; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MGWidget 2 | **效果图** 3 | 4 | [demo地址在这里](https://github.com/Maling1255/MGWidget) 5 | 6 | ### MGEffectStyle 7 |

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

16 | 17 | ### MGLoaderStyle 18 |

19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |

29 | 30 | 31 | 32 | 33 | 34 | 35 | ###### 该效果分为2个部分(MGEffectStyle & MGLoaderStyle),还在继续补充... 36 | 37 | ### MGEffectStyle 38 | 39 | - 一些动画,使用`CAReplicatorLayer`复制效果 40 | 41 | ### MGLoaderStyle 42 | 43 | - 加载动画 -------------------------------------------------------------------------------- /MGWidget/MGWidgetUITests/MGWidgetUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGWidgetUITests.m 3 | // MGWidgetUITests 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MGWidgetUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation MGWidgetUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // 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. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/ShowView/NSObject+common.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+common.h 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/29. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, MGEffectStyle) { 12 | 13 | MGEffectStyleDrop, 14 | MGEffectStyleThimble, 15 | MGEffectStyleCircle, 16 | MGEffectStyleStrip, 17 | MGEffectStyleWoody, 18 | MGEffectStyleShape, 19 | MGEffectStyleLinear, 20 | MGEffectStyleInverted, 21 | }; 22 | 23 | 24 | @interface NSObject (common) 25 | 26 | - (UIBezierPath *)pathWithEffectType:(MGEffectStyle)type; 27 | 28 | - (void)addAnimationWithEffectType:(MGEffectStyle)type; 29 | 30 | //- (CABasicAnimation *)animationKeyPath:(NSString *)keyPath 31 | // from:(NSNumber *)fromValue 32 | // to:(NSNumber *)toValue 33 | // duration:(CFTimeInterval)duration 34 | // repeatTime:(CGFloat)repeat; 35 | 36 | - (CABasicAnimation *)animationKeyPath:(NSString *)keyPath 37 | to:(NSNumber *)toValue 38 | duration:(CFTimeInterval)duration 39 | isReverses:(BOOL)isReverses 40 | repeatTime:(CGFloat)repeat; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/PrefixHeader.pch: -------------------------------------------------------------------------------- 1 | // 2 | // PrefixHeader.pch 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #ifndef PrefixHeader_pch 10 | #define PrefixHeader_pch 11 | 12 | #import "UIView+Frame.h" 13 | #import "NSObject+common.h" 14 | #import "NSObject+LoadTool.h" 15 | #import "CALayer+Common.h" 16 | 17 | #define kScreenWidth [UIScreen mainScreen].bounds.size.width 18 | #define kScreenHeight [UIScreen mainScreen].bounds.size.height 19 | 20 | #define kStatusBarHeight [[UIApplication sharedApplication] statusBarFrame].size.height 21 | #define kNavigationBarHeight self.navigationController.navigationBar.frame.size.height 22 | 23 | #define kNavigationStatusHeiht (isPhoneX ? 88 : 64) 24 | 25 | #define isPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) 26 | 27 | #define kMinValue(a,b) (a 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 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 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/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 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/CALayer+Common.m: -------------------------------------------------------------------------------- 1 | // 2 | // CALayer+Common.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/12. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "CALayer+Common.h" 10 | 11 | @implementation CALayer (Common) 12 | 13 | - (CABasicAnimation *)animationKeyPath:(NSString *)keyPath 14 | position:(CGPoint)position 15 | duration:(CFTimeInterval)duration 16 | key:(NSString *)key 17 | isReverses:(BOOL)isReverses 18 | repeatTime:(CGFloat)repeat; 19 | { 20 | 21 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:keyPath]; 22 | 23 | animation.toValue = @(position.x); 24 | 25 | animation.duration = duration; 26 | 27 | animation.autoreverses = isReverses; 28 | 29 | animation.repeatCount = repeat; 30 | 31 | animation.delegate = self; 32 | 33 | [animation setValue:key forKey:@"animatioin"]; 34 | 35 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 36 | 37 | animation.removedOnCompletion = NO; 38 | 39 | animation.fillMode = kCAFillModeForwards; 40 | 41 | 42 | return animation; 43 | } 44 | 45 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag 46 | { 47 | if ([[anim valueForKey:@"animatioin"] isEqualToString:@"animation1"]) { 48 | 49 | DLog(@"动画结束了1"); 50 | 51 | 52 | } 53 | else if ([[anim valueForKey:@"animatioin"] isEqualToString:@"animation2"]) 54 | { 55 | DLog(@"动画结束了2"); 56 | } 57 | } 58 | @end 59 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/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 | } -------------------------------------------------------------------------------- /MGWidget/MGWidget/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. 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 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGWorshipView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGWorshipView.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/5. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "MGWorshipView.h" 10 | @interface MGWorshipView () 11 | 12 | @property (nonatomic, strong) CAShapeLayer *bgLayer; 13 | 14 | @property (nonatomic, strong) CAShapeLayer *subLayer; 15 | 16 | @property (nonatomic, strong) CAShapeLayer *subLayer2; 17 | 18 | @end 19 | @implementation MGWorshipView 20 | 21 | - (instancetype)initWithFrame:(CGRect)frame 22 | { 23 | if (self = [super initWithFrame:frame]) { 24 | 25 | self.bgLayer = [[CAShapeLayer alloc] init]; 26 | 27 | _bgLayer.frame = self.bounds; 28 | 29 | [self.layer addSublayer:_bgLayer]; 30 | 31 | } 32 | return self; 33 | } 34 | 35 | - (void)showAnimationView 36 | { 37 | self.subLayer = [self setupSubLayerWithStartAngle:-M_PI_4 * 1.2 endAngle:M_PI_4 * 1.2]; 38 | 39 | self.subLayer2 = [self setupSubLayerWithStartAngle:M_PI_4 * 0.8 + M_PI_2 endAngle:M_PI_4 * 1.2 + M_PI]; 40 | 41 | [self performSelector:@selector(addAnimation) withObject:self afterDelay:1]; 42 | 43 | [self performSelector:@selector(addAnimation2) withObject:self afterDelay:1.5]; 44 | } 45 | 46 | - (CAShapeLayer *)setupSubLayerWithStartAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle 47 | { 48 | UIBezierPath *path = [UIBezierPath bezierPath]; 49 | 50 | [path addArcWithCenter:CGPointMake(self.width * 0.5 , self.width * 0.5 ) radius:25 startAngle:startAngle endAngle:endAngle clockwise:YES]; 51 | 52 | CAShapeLayer *layer = [[CAShapeLayer alloc] init]; 53 | 54 | layer.frame = self.bounds; 55 | 56 | layer.fillColor = [UIColor clearColor].CGColor; 57 | 58 | layer.strokeColor = kBgColor.CGColor; 59 | 60 | layer.lineWidth = 5; 61 | 62 | layer.lineCap = kCALineJoinRound; 63 | 64 | layer.path = path.CGPath; 65 | 66 | layer.strokeEnd = 0.0; 67 | 68 | [_bgLayer addSublayer:layer]; 69 | 70 | return layer; 71 | } 72 | 73 | - (void)addAnimation 74 | { 75 | [CATransaction begin]; 76 | 77 | [CATransaction setDisableActions:NO]; // 关闭animation动画效果,开启隐式动画 78 | 79 | [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 80 | 81 | [CATransaction setAnimationDuration:0.5]; 82 | 83 | self.subLayer.strokeEnd = 1; 84 | 85 | self.subLayer2.strokeEnd = 1; 86 | 87 | [CATransaction commit]; 88 | } 89 | 90 | - (void)addAnimation2 91 | { 92 | CABasicAnimation* rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 93 | 94 | rotationAnimation.toValue = [NSNumber numberWithFloat:2 * M_PI]; 95 | 96 | rotationAnimation.duration = 1.0f; 97 | 98 | rotationAnimation.repeatCount = MAXFLOAT; 99 | 100 | rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 101 | 102 | [self.bgLayer addAnimation:rotationAnimation forKey:rotationAnimation.keyPath]; 103 | } 104 | 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/NSObject+LoadTool.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+LoadTool.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/3. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "NSObject+LoadTool.h" 10 | #import 11 | 12 | static char *kViewWidthKey = "kViewWidthKey"; 13 | @implementation NSObject (LoadTool) 14 | 15 | - (UIBezierPath *)pathWithLoaderStyle:(MGLoaderStyle)style 16 | { 17 | UIBezierPath *tPath = nil; 18 | 19 | switch (style) { 20 | case MGLoaderStyleTriangle: 21 | { 22 | CGFloat topRatio = 0.3; 23 | 24 | CGFloat ratio = 1 - topRatio * 2; 25 | 26 | CGFloat kTop = self.kViewWidth * topRatio; 27 | 28 | CGFloat kHeight = self.kViewWidth * ratio; 29 | 30 | tPath = [UIBezierPath bezierPath]; 31 | 32 | [tPath moveToPoint:CGPointMake(self.kViewWidth/2.0, kTop)]; 33 | 34 | [tPath addLineToPoint:CGPointMake(self.kViewWidth/2.0 + sqrt(kHeight * kHeight / 3.0), kTop + kHeight)]; 35 | 36 | [tPath addLineToPoint:CGPointMake(self.kViewWidth/2.0 - sqrt(kHeight * kHeight / 3.0), kTop + kHeight)]; 37 | 38 | [tPath closePath]; 39 | } 40 | break; 41 | default: 42 | break; 43 | } 44 | 45 | return tPath; 46 | } 47 | 48 | - (void)setKViewWidth:(CGFloat)kViewWidth 49 | { 50 | objc_setAssociatedObject(self, &kViewWidthKey, @(kViewWidth), OBJC_ASSOCIATION_RETAIN); 51 | } 52 | 53 | - (CGFloat)kViewWidth 54 | { 55 | return [objc_getAssociatedObject(self, &kViewWidthKey) floatValue]; 56 | } 57 | 58 | - (void)addAnimationWithLoaderStyle:(MGLoaderStyle)style 59 | { 60 | CALayer *layer = (CALayer *)self; 61 | 62 | [self setKViewWidth:layer.superlayer.superlayer.frame.size.width]; 63 | 64 | switch (style) { 65 | case MGLoaderStyleTriangle: 66 | { 67 | CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 68 | 69 | animation.path = [self pathWithLoaderStyle:style].CGPath; 70 | 71 | animation.duration = 2; 72 | 73 | animation.repeatCount = MAXFLOAT; 74 | 75 | [layer addAnimation:animation forKey:animation.keyPath]; 76 | } 77 | break; 78 | case MGLoaderStyleCationDot: 79 | { 80 | 81 | } 82 | break; 83 | case MGLoaderStyleExpandDot: 84 | { 85 | CABasicAnimation *animation = [self animationKeyPath:@"transform.scale" 86 | to:@(1.5) 87 | duration:0.5 88 | isReverses:YES 89 | repeatTime:INFINITY]; 90 | 91 | [layer addAnimation:animation forKey:animation.keyPath]; 92 | 93 | } 94 | break; 95 | default: 96 | break; 97 | } 98 | } 99 | 100 | 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/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 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGChainView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGChainView.m 3 | // MGWidget 4 | // 5 | // Created by maling on 2018/4/11. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "MGChainView.h" 10 | #define kRadians(x) (M_PI * (x) / 180.0) 11 | @interface MGChainView () 12 | 13 | @property (nonatomic, strong) UIView *bgView; 14 | @property (nonatomic, strong) CAShapeLayer *chainLayer; 15 | 16 | @end 17 | @implementation MGChainView 18 | 19 | - (instancetype)initWithFrame:(CGRect)frame 20 | { 21 | if (self = [super initWithFrame:frame]) { 22 | 23 | [self addSubview:self.bgView]; 24 | } 25 | return self; 26 | } 27 | 28 | - (void)showAnimationView 29 | { 30 | CGFloat startAngle = -M_PI_2; 31 | 32 | UIBezierPath *path = [self setupSubLayerWithStartAngle:startAngle 33 | endAngle:startAngle + kRadians(360)]; 34 | 35 | [self.chainLayer addAnimation:[self addAniamtion:path.CGPath durTimes:2 repeatTimes:MAXFLOAT] 36 | forKey:@"groupAnimation1"] ; 37 | } 38 | 39 | - (CABasicAnimation *)addAniamtion:(CGPathRef)path durTimes:(CGFloat)time repeatTimes:(CGFloat)repeatTimes 40 | { 41 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 42 | 43 | animation.fromValue = [NSNumber numberWithFloat:0]; 44 | 45 | animation.toValue = [NSNumber numberWithFloat:0.95]; 46 | 47 | animation.repeatCount = repeatTimes; 48 | 49 | animation.autoreverses = YES; 50 | 51 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 52 | 53 | animation.duration = time; 54 | 55 | CABasicAnimation* rotationAnimation; 56 | 57 | rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 58 | 59 | rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2 ]; 60 | 61 | rotationAnimation.duration = 1.0; 62 | 63 | rotationAnimation.repeatCount = repeatTimes; 64 | 65 | [self.bgView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"]; 66 | 67 | return animation; 68 | } 69 | 70 | - (UIBezierPath *)setupSubLayerWithStartAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle 71 | { 72 | UIBezierPath *path = [UIBezierPath bezierPath]; 73 | 74 | [path addArcWithCenter:CGPointMake(self.width * 0.5 , self.width * 0.5 ) radius:self.width * 0.25 startAngle:startAngle endAngle:endAngle clockwise:YES]; 75 | 76 | CAShapeLayer *layer = [[CAShapeLayer alloc] init]; 77 | 78 | layer.frame = self.bounds; 79 | 80 | layer.fillColor = [UIColor clearColor].CGColor; 81 | 82 | layer.strokeColor = kBgColor.CGColor; 83 | 84 | layer.lineWidth = 5; 85 | 86 | layer.lineCap = kCALineJoinRound; 87 | 88 | layer.path = path.CGPath; 89 | 90 | self.chainLayer = layer; 91 | 92 | [self.bgView.layer addSublayer:layer]; 93 | 94 | return path; 95 | } 96 | 97 | - (UIView *)bgView 98 | { 99 | if (!_bgView) { 100 | _bgView = [[UIView alloc] initWithFrame:self.bounds]; 101 | } 102 | return _bgView; 103 | } 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/UIView+Frame.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Frame.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "UIView+Frame.h" 10 | 11 | @implementation UIView (Frame) 12 | 13 | - (void)setX:(CGFloat)x 14 | { 15 | CGRect frame = self.frame; 16 | 17 | frame.origin.x = x; 18 | 19 | self.frame = frame; 20 | } 21 | 22 | - (void)setY:(CGFloat)y 23 | { 24 | CGRect frame = self.frame; 25 | 26 | frame.origin.y = y; 27 | 28 | self.frame = frame; 29 | } 30 | 31 | - (CGFloat)x 32 | { 33 | return self.frame.origin.x; 34 | } 35 | 36 | - (CGFloat)y 37 | { 38 | return self.frame.origin.y; 39 | } 40 | 41 | - (void)setCenterX:(CGFloat)centerX 42 | { 43 | CGPoint center = self.center; 44 | 45 | center.x = centerX; 46 | 47 | self.center = center; 48 | 49 | } 50 | 51 | - (CGFloat)centerX 52 | { 53 | return self.center.x; 54 | } 55 | 56 | - (void)setCenterY:(CGFloat)centerY 57 | { 58 | CGPoint center = self.center; 59 | 60 | center.y = centerY; 61 | 62 | self.center = center; 63 | } 64 | 65 | - (CGFloat)centerY 66 | { 67 | return self.center.y; 68 | } 69 | 70 | - (void)setWidth:(CGFloat)width 71 | { 72 | CGRect frame = self.frame; 73 | 74 | frame.size.width = width; 75 | 76 | self.frame = frame; 77 | } 78 | 79 | - (void)setHeight:(CGFloat)height 80 | { 81 | CGRect frame = self.frame; 82 | 83 | frame.size.height = height; 84 | 85 | self.frame = frame; 86 | } 87 | 88 | - (CGFloat)height 89 | { 90 | return self.frame.size.height; 91 | } 92 | 93 | - (CGFloat)width 94 | { 95 | return self.frame.size.width; 96 | } 97 | 98 | - (void)setSize:(CGSize)size 99 | { 100 | CGRect frame = self.frame; 101 | 102 | frame.size = size; 103 | 104 | self.frame = frame; 105 | } 106 | 107 | - (CGSize)size 108 | { 109 | return self.frame.size; 110 | } 111 | 112 | - (void)setOrigin:(CGPoint)origin 113 | { 114 | CGRect frame = self.frame; 115 | 116 | frame.origin = origin; 117 | 118 | self.frame = frame; 119 | } 120 | 121 | - (CGPoint)origin 122 | { 123 | return self.frame.origin; 124 | } 125 | - (CGFloat)top 126 | { 127 | return self.frame.origin.y; 128 | } 129 | 130 | - (void)setTop:(CGFloat)top 131 | { 132 | CGRect frame = self.frame; 133 | 134 | frame.origin.y = top; 135 | 136 | self.frame = frame; 137 | } 138 | 139 | - (CGFloat)left 140 | { 141 | return self.frame.origin.x; 142 | } 143 | 144 | - (void)setLeft:(CGFloat)left 145 | { 146 | CGRect frame = self.frame; 147 | 148 | frame.origin.x = left; 149 | 150 | self.frame = frame; 151 | } 152 | 153 | 154 | - (CGFloat)bottom 155 | { 156 | return self.frame.size.height + self.frame.origin.y; 157 | } 158 | 159 | - (void)setBottom:(CGFloat)bottom 160 | { 161 | CGRect frame = self.frame; 162 | 163 | frame.origin.y = bottom - frame.size.height; 164 | 165 | self.frame = frame; 166 | } 167 | 168 | - (CGFloat)right 169 | { 170 | return self.frame.size.width + self.frame.origin.x; 171 | } 172 | 173 | - (void)setRight:(CGFloat)right 174 | { 175 | CGRect frame = self.frame; 176 | 177 | frame.origin.x = right - frame.size.width; 178 | 179 | self.frame = frame; 180 | } 181 | 182 | @end 183 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGShowController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGShowController.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/29. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "MGShowController.h" 10 | #import "MGShowView.h" 11 | #import "MGLoaderView.h" 12 | #import "MGPatternView.h" 13 | @interface MGShowController () 14 | 15 | @property (nonatomic, assign) MGEffectStyle type; 16 | 17 | @property (nonatomic, assign) NSInteger section; 18 | 19 | @end 20 | 21 | @implementation MGShowController 22 | 23 | - (instancetype)initWithType:(MGEffectStyle)type section:(NSInteger)section 24 | { 25 | if (self = [super init]) { 26 | 27 | self.type = type; 28 | 29 | self.section = section; 30 | } 31 | return self; 32 | } 33 | 34 | - (void)viewDidLoad { 35 | [super viewDidLoad]; 36 | 37 | self.view.backgroundColor = [UIColor whiteColor]; 38 | 39 | if (self.section == 0) 40 | { 41 | MGShowView *showView = [MGShowView showWithType:_type]; 42 | 43 | [self.view addSubview:showView]; 44 | } 45 | else 46 | { 47 | 48 | MGLoaderView *loaderView = [MGLoaderView loader]; 49 | 50 | loaderView.centerX = self.view.centerX; 51 | 52 | loaderView.centerY = self.view.centerY; 53 | 54 | loaderView.style = (MGLoaderStyle)self.type; 55 | 56 | [self.view addSubview:loaderView]; 57 | 58 | 59 | MGPatternView *patterView = [[MGPatternView alloc] initWithFrame:CGRectMake(kScreenWidth - 60, self.view.height - 60, 50, 50)]; 60 | 61 | patterView.motorDirection = MGMotorDirectionUp; 62 | 63 | patterView.subViews = [self countItems]; 64 | 65 | [patterView setPatterviewBlock:^(NSInteger index) { 66 | 67 | [self selectLoaderStyle:index]; 68 | }]; 69 | 70 | [self.view addSubview:patterView]; 71 | } 72 | } 73 | 74 | - (void)selectLoaderStyle:(MGLoaderStyle)style 75 | { 76 | for (UIView *view in self.view.subviews) { 77 | 78 | if (![view isKindOfClass:[MGPatternView class]]) { 79 | 80 | [view removeFromSuperview]; 81 | } 82 | } 83 | 84 | MGLoaderView *loaderView = [MGLoaderView loader]; 85 | 86 | loaderView.centerX = self.view.centerX; 87 | 88 | loaderView.centerY = self.view.centerY; 89 | 90 | loaderView.style = style; 91 | 92 | [self.view addSubview:loaderView]; 93 | 94 | } 95 | 96 | - (NSArray *)countItems 97 | { 98 | NSMutableArray *array = [[NSMutableArray alloc] init]; 99 | 100 | NSInteger tag = 0; 101 | for (NSString *title in @[@"0️⃣", @"1️⃣", @"2️⃣", @"3️⃣", @"4️⃣", @"5️⃣", @"6️⃣", @"7️⃣"]) { 102 | 103 | UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; 104 | 105 | [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 106 | 107 | [button setTitle:title forState:UIControlStateNormal]; 108 | 109 | button.frame = CGRectMake(0, 0, 40, 40); 110 | 111 | button.layer.cornerRadius = button.height / 2.0f; 112 | 113 | button.backgroundColor = [UIColor colorWithRed:0.f green:0.f blue:0.f alpha:0.5f]; 114 | 115 | button.clipsToBounds = YES; 116 | 117 | button.tag = tag++; 118 | 119 | [array addObject:button]; 120 | } 121 | return array.copy; 122 | } 123 | 124 | - (void)didReceiveMemoryWarning { 125 | [super didReceiveMemoryWarning]; 126 | // Dispose of any resources that can be recreated. 127 | } 128 | 129 | /* 130 | #pragma mark - Navigation 131 | 132 | // In a storyboard-based application, you will often want to do a little preparation before navigation 133 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 134 | // Get the new view controller using [segue destinationViewController]. 135 | // Pass the selected object to the new view controller. 136 | } 137 | */ 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/28. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "MGShowController.h" 11 | @interface ViewController () 12 | 13 | @property (nonatomic, strong) UITableView *displayTableView; 14 | 15 | @property (nonatomic, strong) NSMutableArray *styleArray; 16 | 17 | @end 18 | 19 | static NSString *const reuseIdentifiter = @"cellID"; 20 | @implementation ViewController 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | self.edgesForExtendedLayout = UIRectEdgeNone; 26 | 27 | [self.view addSubview:self.displayTableView]; 28 | 29 | self.displayTableView.rowHeight = 50; 30 | 31 | _styleArray = @[ 32 | @[@"MGEffectStyleDrop", 33 | @"MGEffectStyleThimble", 34 | @"MGEffectStyleCircle", 35 | @"MGEffectStyleStrip", 36 | @"MGEffectStyleWoody", 37 | @"MGEffectStyleShape", 38 | @"MGEffectStyleLinear", 39 | @"MGEffectStyleInverted"], 40 | @[@"MGLoaderStyleTriangle", 41 | @"MGLoaderStyleCationDot", 42 | @"MGLoaderStyleExpandDot", 43 | @"MGLoaderStyleShipDot", 44 | @"MGLoaderStyleChain", 45 | @"MGLoaderStyleAlter", 46 | @"MGLoaderStyleAlternation", 47 | @"MGLoaderStyleRotaDot"] 48 | ].mutableCopy; 49 | } 50 | 51 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 52 | { 53 | return _styleArray.count; 54 | } 55 | 56 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 57 | { 58 | NSArray *dateArray = _styleArray[section]; 59 | 60 | return dateArray.count; 61 | } 62 | 63 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 64 | { 65 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifiter]; 66 | 67 | if (!cell) { 68 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifiter]; 69 | } 70 | 71 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 72 | 73 | NSArray *dateArray = _styleArray[indexPath.section]; 74 | 75 | cell.textLabel.text = dateArray[indexPath.row]; 76 | 77 | NSInteger rows = [tableView numberOfRowsInSection:indexPath.section]; 78 | 79 | cell.backgroundColor = [MGColor colorWithAlphaComponent:(rows - indexPath.row *0.5) / rows]; 80 | 81 | return cell; 82 | } 83 | 84 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 85 | { 86 | UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 44)]; 87 | 88 | label.textAlignment = NSTextAlignmentCenter; 89 | 90 | label.textColor = kBgColor; 91 | 92 | if (section == 0) 93 | { 94 | label.text = @"MGEffectStyle"; 95 | } 96 | else if (section == 1) 97 | { 98 | label.text = @"MGLoaderStyle"; 99 | } 100 | 101 | return label; 102 | } 103 | 104 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section 105 | { 106 | return nil; 107 | } 108 | 109 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 110 | { 111 | return 44; 112 | } 113 | 114 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 115 | { 116 | return 0.01; 117 | } 118 | 119 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 120 | { 121 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 122 | 123 | MGShowController *showVC = [[MGShowController alloc] initWithType:indexPath.row section:indexPath.section]; 124 | 125 | showVC.title = _styleArray[indexPath.section][indexPath.row]; 126 | 127 | [self.navigationController pushViewController:showVC animated:YES]; 128 | } 129 | 130 | - (UITableView *)displayTableView 131 | { 132 | if (!_displayTableView) { 133 | 134 | _displayTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; 135 | 136 | _displayTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 137 | 138 | _displayTableView.delegate = self; 139 | 140 | _displayTableView.dataSource = self; 141 | 142 | _displayTableView.separatorColor = [UIColor whiteColor]; 143 | 144 | _displayTableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0); 145 | 146 | } 147 | return _displayTableView; 148 | } 149 | 150 | @end 151 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGLoadDotView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGLoadDotView.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/4. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "MGLoadDotView.h" 10 | @interface MGLoadDotView () 11 | 12 | @property (nonatomic, strong) UIView *dotView1; 13 | 14 | @property (nonatomic, strong) UIView *dotView2; 15 | 16 | @property (nonatomic, strong) UIView *dotView3; 17 | @end 18 | @implementation MGLoadDotView 19 | 20 | - (instancetype)initWithFrame:(CGRect)frame 21 | { 22 | if (self = [super initWithFrame:frame]) { 23 | 24 | [self addSubview:self.dotView1]; 25 | 26 | [self addSubview:self.dotView2]; 27 | 28 | [self addSubview:self.dotView3]; 29 | 30 | } 31 | return self; 32 | } 33 | 34 | - (void)showAnimationView 35 | { 36 | CGFloat duration = 1.2; 37 | 38 | CAKeyframeAnimation *animation1 = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 39 | 40 | animation1.path = [self pathTrace1].CGPath; 41 | 42 | animation1.duration = duration; 43 | 44 | animation1.repeatCount = MAXFLOAT; 45 | 46 | animation1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 47 | 48 | [_dotView1.layer addAnimation:animation1 forKey:animation1.keyPath]; 49 | 50 | CAKeyframeAnimation *animation2 = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 51 | 52 | animation2.path = [self pathTrace2].CGPath; 53 | 54 | animation2.duration = duration; 55 | 56 | animation2.repeatCount = MAXFLOAT; 57 | 58 | animation2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 59 | 60 | [_dotView2.layer addAnimation:animation2 forKey:animation2.keyPath]; 61 | 62 | CAKeyframeAnimation *animation3 = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 63 | 64 | animation3.path = [self pathTrace3].CGPath; 65 | 66 | animation3.duration = duration; 67 | 68 | animation3.repeatCount = MAXFLOAT; 69 | 70 | animation3.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 71 | 72 | [_dotView3.layer addAnimation:animation3 forKey:animation3.keyPath]; 73 | } 74 | 75 | - (void)hideAnimationView 76 | { 77 | [_dotView1 removeFromSuperview]; 78 | 79 | [_dotView2 removeFromSuperview]; 80 | 81 | [_dotView3 removeFromSuperview]; 82 | 83 | } 84 | 85 | - (UIBezierPath *)pathTrace1 86 | { 87 | UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.centerX - 10, self.centerY) 88 | radius:10 89 | startAngle:M_PI 90 | endAngle:0 91 | clockwise:YES]; 92 | 93 | UIBezierPath *path1 = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.centerX + 10, self.centerY) 94 | radius:10 95 | startAngle:-M_PI 96 | endAngle:0 97 | clockwise:NO]; 98 | [path appendPath:path1]; 99 | 100 | return path; 101 | } 102 | 103 | - (UIBezierPath *)pathTrace2 104 | { 105 | UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.centerX - 10, self.centerY) 106 | radius:10 107 | startAngle:0 108 | endAngle:M_PI 109 | clockwise:YES]; 110 | return path; 111 | } 112 | 113 | - (UIBezierPath *)pathTrace3 114 | { 115 | UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.centerX + 10, self.centerY) 116 | radius:10 117 | startAngle:0 118 | endAngle:M_PI 119 | clockwise:NO]; 120 | return path; 121 | } 122 | 123 | - (UIView *)dotView1 124 | { 125 | if (!_dotView1) { 126 | _dotView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 127 | 128 | _dotView1.centerY = self.centerY; 129 | 130 | _dotView1.centerX = self.centerX - 20; 131 | 132 | _dotView1.layer.cornerRadius = 5; 133 | 134 | _dotView1.layer.masksToBounds = YES; 135 | 136 | _dotView1.backgroundColor = kBgColor; 137 | } 138 | return _dotView1; 139 | } 140 | 141 | - (UIView *)dotView2 142 | { 143 | if (!_dotView2) { 144 | _dotView2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 145 | 146 | _dotView2.centerY = self.centerY; 147 | 148 | _dotView2.centerX = self.centerX; 149 | 150 | _dotView2.layer.cornerRadius = 5; 151 | 152 | _dotView2.layer.masksToBounds = YES; 153 | 154 | _dotView2.backgroundColor = kBgColor; 155 | } 156 | return _dotView2; 157 | } 158 | 159 | - (UIView *)dotView3 160 | { 161 | if (!_dotView3) { 162 | _dotView3 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 163 | 164 | _dotView3.centerY = self.centerY; 165 | 166 | _dotView3.centerX = self.centerX + 20; 167 | 168 | _dotView3.layer.cornerRadius = 5; 169 | 170 | _dotView3.layer.masksToBounds = YES; 171 | 172 | _dotView3.backgroundColor = kBgColor; 173 | } 174 | return _dotView3; 175 | } 176 | 177 | @end 178 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGLoaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGLoaderView.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/30. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "MGLoaderView.h" 10 | #import "MGLoadDotView.h" 11 | #import "MGWorshipView.h" 12 | #import "MGChainView.h" 13 | #import "MGAlterView.h" 14 | #import "MGRotaLoadView.h" 15 | @interface MGLoaderView () 16 | 17 | @property (strong, nonatomic) CAShapeLayer *indicatorLayer; 18 | 19 | @property (strong, nonatomic) CAReplicatorLayer *replicatorLayer; 20 | 21 | @end 22 | @implementation MGLoaderView 23 | 24 | + (instancetype)loader 25 | { 26 | MGLoaderView *loader = [[MGLoaderView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; 27 | 28 | return loader; 29 | } 30 | 31 | - (instancetype)initWithFrame:(CGRect)frame 32 | { 33 | if (self = [super initWithFrame:frame]) { 34 | 35 | self.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.3]; 36 | 37 | [self.layer addSublayer:self.replicatorLayer]; 38 | 39 | [self.replicatorLayer addSublayer:self.indicatorLayer]; 40 | 41 | // CGFloat kMargin = 0.5; 42 | // 43 | // CALayer *line = [[CALayer alloc] init]; 44 | // 45 | // line.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5].CGColor; 46 | // 47 | // line.frame = CGRectMake((self.width - kMargin) * 0.5, 0, kMargin, self.height); 48 | // 49 | // [self.layer addSublayer:line]; 50 | // 51 | // CALayer *line2 = [[CALayer alloc] init]; 52 | // 53 | // line2.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5].CGColor; 54 | // 55 | // line2.frame = CGRectMake(0, (self.height - kMargin) * 0.5, self.width, kMargin); 56 | // 57 | // [self.layer addSublayer:line2]; 58 | } 59 | return self; 60 | } 61 | 62 | - (void)setStyle:(MGLoaderStyle)style 63 | { 64 | switch (style) { 65 | case MGLoaderStyleTriangle: 66 | { 67 | _indicatorLayer.frame = CGRectMake((self.width - 8) / 2.0, self.width * 0.3, 8, 8); 68 | 69 | _indicatorLayer.cornerRadius = 4; 70 | 71 | _indicatorLayer.backgroundColor = kBgColor.CGColor; 72 | 73 | _replicatorLayer.instanceCount = 3; 74 | 75 | _replicatorLayer.instanceDelay = 2.0 / 3.0; 76 | 77 | _replicatorLayer.instanceColor = kBgColor.CGColor; 78 | 79 | } 80 | break; 81 | case MGLoaderStyleCationDot: 82 | { 83 | MGLoadDotView *loadView = [[MGLoadDotView alloc] initWithFrame:self.bounds]; 84 | 85 | [loadView showAnimationView]; 86 | 87 | [self addSubview:loadView]; 88 | } 89 | break; 90 | case MGLoaderStyleExpandDot: 91 | { 92 | _indicatorLayer.frame = CGRectMake(20, (self.height - 6) * 0.5, 6, 6); 93 | 94 | _indicatorLayer.cornerRadius = 3; 95 | 96 | _indicatorLayer.backgroundColor = kBgColor.CGColor; 97 | 98 | _replicatorLayer.instanceCount = 5; 99 | 100 | _replicatorLayer.instanceDelay = 1.0 / 5; 101 | 102 | _replicatorLayer.instanceColor = kBgColor.CGColor; 103 | 104 | _replicatorLayer.instanceTransform = CATransform3DMakeTranslation(12, 0, 0); 105 | 106 | } 107 | break; 108 | case MGLoaderStyleShipDot: 109 | { 110 | MGWorshipView *shipView = [[MGWorshipView alloc] initWithFrame:self.bounds]; 111 | 112 | [shipView showAnimationView]; 113 | 114 | [self addSubview:shipView]; 115 | } 116 | break; 117 | case MGLoaderStyleChain: 118 | { 119 | MGChainView *chainView = [[MGChainView alloc] initWithFrame:self.bounds]; 120 | 121 | [chainView showAnimationView]; 122 | 123 | [self addSubview:chainView]; 124 | 125 | } 126 | break; 127 | case MGLoaderStyleAlter: 128 | { 129 | MGAlterView *alterView = [[MGAlterView alloc] initWithFrame:self.bounds]; 130 | 131 | [alterView showAnimationView]; 132 | 133 | [self addSubview:alterView]; 134 | } 135 | break; 136 | case MGLoaderStyleAlternation: 137 | { 138 | MGAlternationView *alterView = [[MGAlternationView alloc] initWithFrame:self.bounds]; 139 | 140 | [alterView showAnimationView]; 141 | 142 | [self addSubview:alterView]; 143 | } 144 | break; 145 | case MGLoaderStyleRotaDot: 146 | { 147 | MGRotaLoadView *loadView = [[MGRotaLoadView alloc] initWithFrame:self.bounds]; 148 | 149 | [loadView showAnimationView]; 150 | 151 | [self addSubview:loadView]; 152 | } 153 | break; 154 | 155 | } 156 | 157 | [_indicatorLayer addAnimationWithLoaderStyle:style]; 158 | } 159 | 160 | - (void)layoutSubviews 161 | { 162 | [super layoutSubviews]; 163 | 164 | self.replicatorLayer.frame = self.bounds; 165 | } 166 | 167 | - (CAShapeLayer *)indicatorLayer 168 | { 169 | if (!_indicatorLayer) { 170 | 171 | _indicatorLayer = [CAShapeLayer layer]; 172 | 173 | _indicatorLayer.contentsScale = [[UIScreen mainScreen] scale]; 174 | } 175 | return _indicatorLayer; 176 | } 177 | 178 | - (CAReplicatorLayer *)replicatorLayer 179 | { 180 | if (!_replicatorLayer) { 181 | 182 | _replicatorLayer = [CAReplicatorLayer layer]; 183 | 184 | _replicatorLayer.backgroundColor = [UIColor clearColor].CGColor; 185 | 186 | _replicatorLayer.shouldRasterize = YES; 187 | 188 | _replicatorLayer.rasterizationScale = [[UIScreen mainScreen] scale]; 189 | } 190 | return _replicatorLayer; 191 | } 192 | @end 193 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGRotaLoadView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGRotaLoadView.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/19. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "MGRotaLoadView.h" 10 | 11 | #define DURATION 2 12 | #define SCALE 1.5 13 | @interface MGRotaLoadView () 14 | 15 | @property (nonatomic, strong) UIView *leftDot; 16 | 17 | @property (nonatomic, strong) UIView *middleDot; 18 | 19 | @property (nonatomic, strong) UIView *rightDot; 20 | 21 | @property (nonatomic, strong) NSMutableArray *colors; 22 | 23 | @end 24 | @implementation MGRotaLoadView 25 | 26 | - (instancetype)initWithFrame:(CGRect)frame 27 | { 28 | if (self = [super initWithFrame:frame]) { 29 | 30 | self.colors = @[[UIColor redColor], [UIColor blueColor], [UIColor greenColor]].mutableCopy; 31 | 32 | [self addSubview:self.leftDot]; 33 | 34 | [self addSubview:self.middleDot]; 35 | 36 | [self addSubview:self.rightDot]; 37 | 38 | } 39 | return self; 40 | } 41 | 42 | - (void)showAnimationView 43 | { 44 | [self addAnimationForScale]; 45 | } 46 | 47 | - (void)addAnimationForScale 48 | { 49 | CAKeyframeAnimation *animation1 = [self keyframeAnimationWithPath:[self leftDotPath]]; 50 | 51 | [self.leftDot.layer addAnimation:animation1 forKey:animation1.keyPath]; 52 | 53 | CAKeyframeAnimation *animation2 = [self keyframeAnimationWithPath:[self rightDotPath]]; 54 | 55 | [self.rightDot.layer addAnimation:animation2 forKey:animation2.keyPath]; 56 | 57 | [self performSelector:@selector(addAnimation) withObject:nil afterDelay:0.2f]; 58 | 59 | } 60 | 61 | - (void)addAnimation 62 | { 63 | [self.leftDot.layer addAnimation:[self animationScale] forKey:@"animationScale"]; 64 | 65 | [self.rightDot.layer addAnimation:[self animationScale] forKey:@"animationScale"]; 66 | 67 | [self.middleDot.layer addAnimation:[self animationScale] forKey:@"animationScale"]; 68 | } 69 | 70 | - (CABasicAnimation *)animationScale 71 | { 72 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 73 | 74 | animation.fromValue = [NSNumber numberWithFloat:1]; 75 | 76 | animation.toValue = [NSNumber numberWithFloat:SCALE]; 77 | 78 | animation.repeatCount = INFINITY; 79 | 80 | animation.autoreverses = YES; 81 | 82 | animation.duration = DURATION / 2.0; 83 | 84 | animation.removedOnCompletion = NO; 85 | 86 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 87 | 88 | return animation; 89 | } 90 | 91 | - (CAKeyframeAnimation *)keyframeAnimationWithPath:(UIBezierPath *)path 92 | { 93 | CAKeyframeAnimation *animation1 = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 94 | 95 | animation1.path = path.CGPath; 96 | 97 | animation1.repeatCount = CGFLOAT_MAX; 98 | 99 | animation1.duration = DURATION; 100 | 101 | animation1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 102 | 103 | return animation1; 104 | } 105 | 106 | - (UIBezierPath *)leftDotPath 107 | { 108 | CGFloat r = self.leftDot.width * SCALE; 109 | 110 | CGFloat R = (fabs(self.leftDot.centerX - self.middleDot.centerX) + r) / 2.0; 111 | 112 | UIBezierPath *path1 = [UIBezierPath bezierPath]; 113 | 114 | [path1 moveToPoint:_leftDot.center]; 115 | 116 | [path1 addArcWithCenter:CGPointMake(self.centerX - R + r, self.centerY) radius:R startAngle:-M_PI endAngle:0 clockwise:NO]; 117 | 118 | UIBezierPath *path11 = [UIBezierPath bezierPath]; 119 | 120 | [path11 addArcWithCenter:self.center radius:r startAngle:0 endAngle:-M_PI clockwise:NO]; 121 | 122 | [path1 appendPath:path11]; 123 | 124 | [path1 addLineToPoint:self.leftDot.center]; 125 | 126 | return path1; 127 | } 128 | 129 | - (UIBezierPath *)rightDotPath 130 | { 131 | CGFloat r = self.rightDot.width * SCALE; 132 | 133 | CGFloat R = (fabs(self.rightDot.centerX - self.middleDot.centerX) + r) / 2.0; 134 | 135 | UIBezierPath *path1 = [UIBezierPath bezierPath]; 136 | 137 | [path1 moveToPoint:_rightDot.center]; 138 | 139 | [path1 addArcWithCenter:CGPointMake(self.centerX + R - r, self.centerY) radius:R startAngle:0 endAngle:-M_PI clockwise:NO]; 140 | 141 | UIBezierPath *path11 = [UIBezierPath bezierPath]; 142 | 143 | [path11 addArcWithCenter:self.center radius:r startAngle:-M_PI endAngle:0 clockwise:NO]; 144 | 145 | [path1 appendPath:path11]; 146 | 147 | [path1 addLineToPoint:self.rightDot.center]; 148 | 149 | return path1; 150 | } 151 | 152 | 153 | - (UIView *)leftDot 154 | { 155 | if (!_leftDot) { 156 | _leftDot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 157 | 158 | _leftDot.centerY = self.centerY; 159 | 160 | _leftDot.centerX = self.centerX - 30; 161 | 162 | _leftDot.layer.cornerRadius = 5; 163 | 164 | _leftDot.layer.masksToBounds = YES; 165 | 166 | _leftDot.backgroundColor = self.colors[0]; 167 | } 168 | return _leftDot; 169 | } 170 | 171 | - (UIView *)middleDot 172 | { 173 | if (!_middleDot) { 174 | _middleDot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 175 | 176 | _middleDot.centerY = self.centerY; 177 | 178 | _middleDot.centerX = self.centerX; 179 | 180 | _middleDot.layer.cornerRadius = 5; 181 | 182 | _middleDot.layer.masksToBounds = YES; 183 | 184 | _middleDot.backgroundColor = self.colors[1]; 185 | } 186 | return _middleDot; 187 | } 188 | 189 | - (UIView *)rightDot 190 | { 191 | if (!_rightDot) { 192 | _rightDot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 193 | 194 | _rightDot.centerY = self.centerY; 195 | 196 | _rightDot.centerX = self.centerX + 30; 197 | 198 | _rightDot.layer.cornerRadius = 5; 199 | 200 | _rightDot.layer.masksToBounds = YES; 201 | 202 | _rightDot.backgroundColor = self.colors[2]; 203 | } 204 | return _rightDot; 205 | } 206 | 207 | @end 208 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/ShowView/NSObject+common.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+common.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/29. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "NSObject+common.h" 10 | #import 11 | 12 | @implementation NSObject (common) 13 | 14 | - (UIBezierPath *)pathWithEffectType:(MGEffectStyle)type 15 | { 16 | UIBezierPath *tPath = nil; 17 | switch (type) { 18 | case MGEffectStyleDrop: 19 | { 20 | 21 | } 22 | break; 23 | case MGEffectStyleThimble: 24 | { 25 | tPath = [UIBezierPath bezierPath]; 26 | 27 | [tPath moveToPoint:CGPointMake(kScreenWidth/2.0, 200)]; 28 | 29 | [tPath addQuadCurveToPoint:CGPointMake(kScreenWidth/2.0, 400) controlPoint:CGPointMake(kScreenWidth/2.0 + 200, 100)]; 30 | 31 | [tPath addQuadCurveToPoint:CGPointMake(kScreenWidth/2.0, 200) controlPoint:CGPointMake(kScreenWidth/2.0 - 200, 100)]; 32 | 33 | [tPath closePath]; 34 | } 35 | break; 36 | case MGEffectStyleCircle: 37 | break; 38 | case MGEffectStyleStrip: 39 | break; 40 | case MGEffectStyleWoody: 41 | break; 42 | case MGEffectStyleShape: 43 | { 44 | UIView *view = (UIView *)self; 45 | 46 | CGFloat layerY = (view.height - 45) / 2.0; 47 | 48 | tPath = [UIBezierPath bezierPath]; 49 | 50 | [tPath moveToPoint:CGPointMake(kScreenWidth/2.0, layerY)]; 51 | 52 | [tPath addQuadCurveToPoint:CGPointMake(kScreenWidth/2.0, layerY + 45) controlPoint:CGPointMake(kScreenWidth/2.0 + 55, layerY - 20)]; 53 | 54 | [tPath addQuadCurveToPoint:CGPointMake(kScreenWidth/2.0, layerY) controlPoint:CGPointMake(kScreenWidth/2.0 - 55, layerY - 20)]; 55 | 56 | [tPath closePath]; 57 | } 58 | break; 59 | case MGEffectStyleLinear: 60 | break; 61 | case MGEffectStyleInverted: 62 | break; 63 | 64 | } 65 | return tPath; 66 | } 67 | 68 | 69 | - (void)addAnimationWithEffectType:(MGEffectStyle)type 70 | { 71 | CALayer *layer = (CALayer *)self; 72 | 73 | switch (type) { 74 | case MGEffectStyleDrop: 75 | { 76 | 77 | } 78 | break; 79 | case MGEffectStyleThimble: 80 | { 81 | 82 | CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 83 | 84 | animation.path = [self pathWithEffectType:type].CGPath; 85 | 86 | animation.duration = 5; 87 | 88 | animation.repeatCount = MAXFLOAT; 89 | 90 | [layer addAnimation:animation forKey:animation.keyPath]; 91 | } 92 | break; 93 | case MGEffectStyleCircle: 94 | { 95 | CABasicAnimation *circleAnimation = [self animationKeyPath:@"transform.scale" 96 | from:@(1.0) 97 | to:@(0.2) 98 | duration:1 99 | repeatTime:INFINITY]; 100 | 101 | [layer addAnimation:circleAnimation forKey:circleAnimation.keyPath]; 102 | } 103 | break; 104 | case MGEffectStyleStrip: 105 | { 106 | CABasicAnimation *stripAnimation = [self animationKeyPath:@"position.y" 107 | to:@(layer.position.y - layer.frame.size.height * 0.7) 108 | duration:0.7 109 | isReverses:YES 110 | repeatTime:INFINITY]; 111 | 112 | [layer addAnimation:stripAnimation forKey:stripAnimation.keyPath]; 113 | } 114 | break; 115 | case MGEffectStyleWoody: 116 | { 117 | CABasicAnimation *woodyAnimation = [self animationKeyPath:@"transform.scale.y" 118 | to:@(0.2) 119 | duration:0.7 120 | isReverses:YES 121 | repeatTime:INFINITY]; 122 | [layer addAnimation:woodyAnimation forKey:woodyAnimation.keyPath]; 123 | } 124 | break; 125 | case MGEffectStyleShape: 126 | { 127 | [self addAnimationWithLayer:layer]; 128 | } 129 | case MGEffectStyleLinear: 130 | { 131 | 132 | } 133 | break; 134 | case MGEffectStyleInverted: 135 | { 136 | 137 | } 138 | break; 139 | } 140 | } 141 | 142 | - (CABasicAnimation *)animationKeyPath:(NSString *)keyPath 143 | from:(NSNumber *)fromValue 144 | to:(NSNumber *)toValue 145 | duration:(CFTimeInterval)duration 146 | repeatTime:(CGFloat)repeat 147 | { 148 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:keyPath]; 149 | 150 | animation.fromValue = fromValue; 151 | 152 | animation.toValue = toValue; 153 | 154 | animation.duration = duration; 155 | 156 | animation.repeatCount = repeat; 157 | 158 | animation.removedOnCompletion = NO; 159 | 160 | return animation; 161 | } 162 | 163 | - (CABasicAnimation *)animationKeyPath:(NSString *)keyPath 164 | to:(NSNumber *)toValue 165 | duration:(CFTimeInterval)duration 166 | isReverses:(BOOL)isReverses 167 | repeatTime:(CGFloat)repeat 168 | { 169 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:keyPath]; 170 | 171 | animation.toValue = toValue; 172 | 173 | animation.duration = duration; 174 | 175 | animation.autoreverses = isReverses; 176 | 177 | animation.repeatCount = repeat; 178 | 179 | 180 | animation.removedOnCompletion = NO; 181 | 182 | return animation; 183 | } 184 | 185 | - (void)addAnimationWithLayer:(CALayer *)layer 186 | { 187 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"]; 188 | 189 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(10, 10, 1)]; 190 | 191 | animation.duration = 3; 192 | 193 | CABasicAnimation *animation1 = [CABasicAnimation animationWithKeyPath:@"opacity"]; 194 | 195 | animation1.fromValue = @1; 196 | 197 | animation1.toValue = @0; 198 | 199 | animation1.duration = 3; 200 | 201 | CAAnimationGroup *group = [CAAnimationGroup animation]; 202 | 203 | group.animations = @[animation,animation1]; 204 | 205 | group.duration = 3; 206 | 207 | group.repeatCount = HUGE; 208 | 209 | [layer addAnimation:group forKey:nil]; 210 | } 211 | 212 | @end 213 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/ShowView/MGShowView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGShowView.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/3/29. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "MGShowView.h" 10 | #import "MGPatternView.h" 11 | @interface MGShowView () 12 | 13 | @property (nonatomic, strong) NSMutableArray *btnArray; 14 | 15 | @property (strong, nonatomic) CAShapeLayer *indicatorLayer; 16 | 17 | @property (strong, nonatomic) CAReplicatorLayer *replicatorLayer; 18 | 19 | @end 20 | 21 | @implementation MGShowView 22 | 23 | + (instancetype)showWithType:(MGEffectStyle)type 24 | { 25 | MGShowView *show = [[self alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)]; 26 | 27 | show.type = type; 28 | 29 | show.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.2]; 30 | 31 | 32 | return show; 33 | } 34 | 35 | - (instancetype)initWithFrame:(CGRect)frame 36 | { 37 | if (self = [super initWithFrame:frame]) { 38 | 39 | [self.layer addSublayer:self.replicatorLayer]; 40 | 41 | [self.replicatorLayer addSublayer:self.indicatorLayer]; 42 | 43 | 44 | // CALayer *line = [[CALayer alloc] init]; 45 | // 46 | // line.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5].CGColor; 47 | // 48 | // line.frame = CGRectMake((kScreenWidth - 0.5) * 0.5, 0, 0.5, kScreenHeight); 49 | // 50 | // [self.layer addSublayer:line]; 51 | // 52 | // CALayer *line2 = [[CALayer alloc] init]; 53 | // 54 | // line2.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5].CGColor; 55 | // 56 | // line2.frame = CGRectMake(0, (self.height - 0.5) * 0.5, kScreenWidth, 0.5); 57 | // 58 | // [self.layer addSublayer:line2]; 59 | 60 | } 61 | return self; 62 | } 63 | 64 | - (void)setType:(MGEffectStyle)type 65 | { 66 | 67 | switch (type) { 68 | case MGEffectStyleDrop: 69 | { 70 | 71 | 72 | 73 | 74 | } 75 | break; 76 | case MGEffectStyleThimble: 77 | { 78 | _indicatorLayer.frame = CGRectMake((kScreenWidth - 10) * 0.5, 196, 10, 10); 79 | 80 | _indicatorLayer.cornerRadius = 5; 81 | 82 | _indicatorLayer.backgroundColor = MGColor.CGColor; 83 | 84 | 85 | _replicatorLayer.instanceCount = 30; 86 | 87 | _replicatorLayer.instanceDelay = 5.0 / 30; 88 | 89 | _replicatorLayer.instanceColor = MGColor.CGColor; 90 | 91 | _replicatorLayer.instanceGreenOffset = -0.03; 92 | 93 | _replicatorLayer.instanceRedOffset = -0.02; 94 | 95 | _replicatorLayer.instanceBlueOffset = -0.01; 96 | 97 | } 98 | break; 99 | case MGEffectStyleCircle: 100 | { 101 | _indicatorLayer.frame = CGRectMake(kScreenWidth/2.0, 330, 10, 10); 102 | 103 | _indicatorLayer.cornerRadius = 5; 104 | 105 | _indicatorLayer.transform = CATransform3DMakeScale(0.2, 0.2, 0.2); 106 | 107 | _indicatorLayer.backgroundColor = MGColor.CGColor; 108 | 109 | 110 | _replicatorLayer.instanceCount = 12; 111 | 112 | _replicatorLayer.instanceDelay = 1.0 / 12; 113 | 114 | CGFloat angle = (2 * M_PI)/self.replicatorLayer.instanceCount; 115 | 116 | _replicatorLayer.instanceColor = MGColor.CGColor; 117 | 118 | _replicatorLayer.instanceTransform = CATransform3DMakeRotation(angle, 0, 0, 0.1); 119 | 120 | _replicatorLayer.instanceBlueOffset = -0.01; 121 | 122 | _replicatorLayer.instanceGreenOffset = -0.01; 123 | 124 | } 125 | break; 126 | case MGEffectStyleStrip: 127 | { 128 | _indicatorLayer.frame = CGRectMake(0, 0, 30, self.height * 0.8); 129 | 130 | _indicatorLayer.backgroundColor = MGColor.CGColor; 131 | 132 | _indicatorLayer.anchorPoint = CGPointMake(0, 0); 133 | 134 | _indicatorLayer.position = CGPointMake(self.x + 10, self.y + self.height * 0.8); 135 | 136 | _indicatorLayer.cornerRadius = 3; 137 | 138 | 139 | _replicatorLayer.instanceCount = 9; 140 | 141 | _replicatorLayer.instanceTransform = CATransform3DMakeTranslation(40, 0, 0); 142 | 143 | _replicatorLayer.instanceDelay = 0.3; 144 | 145 | _replicatorLayer.masksToBounds = YES; 146 | 147 | } 148 | break; 149 | case MGEffectStyleWoody: 150 | { 151 | _indicatorLayer.frame = CGRectMake(0, 0, 5, 100); 152 | 153 | _indicatorLayer.backgroundColor = MGColor.CGColor; 154 | 155 | _indicatorLayer.anchorPoint = CGPointMake(0, 0); 156 | 157 | _indicatorLayer.position = CGPointMake(self.centerX - 120, self.centerY); 158 | 159 | _indicatorLayer.anchorPoint = CGPointMake(0.5, 0.5); 160 | 161 | _indicatorLayer.cornerRadius = 2.5; 162 | 163 | 164 | _replicatorLayer.instanceCount = 25; 165 | 166 | _replicatorLayer.instanceTransform = CATransform3DMakeTranslation(10, 0, 0); 167 | 168 | _replicatorLayer.instanceDelay = 1.0 / 5; 169 | 170 | 171 | } 172 | break; 173 | case MGEffectStyleShape: 174 | { 175 | _indicatorLayer.frame = self.bounds; 176 | 177 | _indicatorLayer.path = [self pathWithEffectType:type].CGPath; 178 | 179 | _indicatorLayer.fillColor = [UIColor redColor].CGColor; 180 | 181 | 182 | _replicatorLayer.instanceCount = 5; 183 | 184 | _replicatorLayer.instanceDelay = 3.0 / 5; 185 | 186 | _replicatorLayer.instanceColor = [UIColor redColor].CGColor; 187 | 188 | } 189 | break; 190 | case MGEffectStyleLinear: 191 | { 192 | 193 | MGPatternView *patterView = [[MGPatternView alloc] initWithFrame:CGRectMake(10,kNavigationStatusHeiht + 10, 50, 50)]; 194 | 195 | patterView.motorDirection = MGMotorDirectionRight; 196 | 197 | patterView.subViews = [self subViews]; 198 | 199 | [patterView setPatterviewBlock:^(NSInteger index) { 200 | 201 | UIButton *btn = [self subViews][index]; 202 | 203 | DLog(@">>> %@", btn.titleLabel.text); 204 | 205 | }]; 206 | 207 | [self addSubview:patterView]; 208 | 209 | MGPatternView *patterView3 = [[MGPatternView alloc] initWithFrame:CGRectMake(kScreenWidth - 60, self.height - 60, 50, 50)]; 210 | 211 | patterView3.motorDirection = MGMotorDirectionUp; 212 | 213 | patterView3.subViews = [self subViews]; 214 | 215 | patterView3.viewSpacing = 50; 216 | 217 | [patterView3 setPatterviewBlock:^(NSInteger index) { 218 | 219 | UIButton *btn = [self subViews][index]; 220 | 221 | DLog(@">>> %@", btn.titleLabel.text); 222 | 223 | }]; 224 | 225 | [self addSubview:patterView3]; 226 | 227 | } 228 | break; 229 | case MGEffectStyleInverted: 230 | { 231 | 232 | 233 | } 234 | break; 235 | 236 | } 237 | 238 | [_indicatorLayer addAnimationWithEffectType:type]; 239 | } 240 | 241 | - (void)layoutSubviews 242 | { 243 | [super layoutSubviews]; 244 | 245 | self.replicatorLayer.frame = self.bounds; 246 | } 247 | 248 | - (NSArray *)subViews 249 | { 250 | NSMutableArray *array = [[NSMutableArray alloc] init]; 251 | 252 | NSInteger tag = 0; 253 | for (NSString *title in @[@"唐", @"宋", @"元", @"明", @"清"]) { 254 | 255 | UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; 256 | 257 | [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 258 | 259 | [button setTitleColor:MGColor forState:UIControlStateHighlighted]; 260 | 261 | [button setTitle:title forState:UIControlStateNormal]; 262 | 263 | button.frame = CGRectMake(0, 0, 40, 40); 264 | 265 | button.layer.cornerRadius = button.height / 2.0f; 266 | 267 | button.backgroundColor = [UIColor colorWithRed:0.f green:0.f blue:0.f alpha:0.5f]; 268 | 269 | button.clipsToBounds = YES; 270 | 271 | button.tag = tag++; 272 | 273 | [array addObject:button]; 274 | } 275 | return array.copy; 276 | } 277 | 278 | - (CAShapeLayer *)indicatorLayer 279 | { 280 | if (!_indicatorLayer) { 281 | 282 | _indicatorLayer = [CAShapeLayer layer]; 283 | 284 | _indicatorLayer.contentsScale = [[UIScreen mainScreen] scale]; 285 | } 286 | return _indicatorLayer; 287 | } 288 | 289 | - (CAReplicatorLayer *)replicatorLayer 290 | { 291 | if (!_replicatorLayer) { 292 | 293 | _replicatorLayer = [CAReplicatorLayer layer]; 294 | 295 | _replicatorLayer.backgroundColor = [UIColor clearColor].CGColor; 296 | 297 | _replicatorLayer.shouldRasterize = YES; 298 | 299 | _replicatorLayer.rasterizationScale = [[UIScreen mainScreen] scale]; 300 | } 301 | return _replicatorLayer; 302 | } 303 | 304 | - (NSMutableArray *)btnArray 305 | { 306 | if (!_btnArray) { 307 | _btnArray = [[NSMutableArray alloc] init]; 308 | } 309 | return _btnArray; 310 | } 311 | 312 | @end 313 | 314 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/LoaderView/MGAlterView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGAlterView.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/12. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "MGAlterView.h" 10 | 11 | @interface MGAlterView () 12 | { 13 | BOOL _isReversal; 14 | } 15 | @property (nonatomic, strong) UIView *leftDot; 16 | 17 | @property (nonatomic, strong) UIView *middleDot; 18 | 19 | @property (nonatomic, strong) UIView *rightDot; 20 | 21 | @property (nonatomic, strong) NSMutableArray *colors; 22 | 23 | @end 24 | @implementation MGAlterView 25 | 26 | - (instancetype)initWithFrame:(CGRect)frame 27 | { 28 | if (self = [super initWithFrame:frame]) { 29 | 30 | self.colors = @[[UIColor redColor], [UIColor blueColor], [UIColor greenColor]].mutableCopy; 31 | 32 | [self addSubview:self.rightDot]; 33 | 34 | [self addSubview:self.middleDot]; 35 | 36 | [self addSubview:self.leftDot]; 37 | 38 | } 39 | return self; 40 | } 41 | 42 | - (void)showAnimationView 43 | { 44 | 45 | CABasicAnimation *animation1 = [self animationKeyPath1:@"position.x" 46 | to:@(self.leftDot.layer.position.x + 40) 47 | duration:1 48 | key:@"animation1" 49 | isReverses:NO 50 | repeatTime:1]; 51 | 52 | [self.leftDot.layer addAnimation:animation1 forKey:animation1.keyPath]; 53 | 54 | CABasicAnimation *animation2 = [self animationKeyPath1:@"position.x" 55 | to:@(self.rightDot.layer.position.x - 40) 56 | duration:1 57 | key:@"animation2" 58 | isReverses:NO 59 | repeatTime:1]; 60 | 61 | [self.rightDot.layer addAnimation:animation2 forKey:animation2.keyPath]; 62 | } 63 | 64 | - (CABasicAnimation *)animationKeyPath1:(NSString *)keyPath 65 | to:(NSNumber *)toValue 66 | duration:(CFTimeInterval)duration 67 | key:(NSString *)key 68 | isReverses:(BOOL)isReverses 69 | repeatTime:(CGFloat)repeat 70 | { 71 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:keyPath]; 72 | 73 | animation.toValue = toValue; 74 | 75 | animation.duration = duration; 76 | 77 | animation.autoreverses = isReverses; 78 | 79 | animation.repeatCount = repeat; 80 | 81 | animation.delegate = self; 82 | 83 | [animation setValue:key forKey:@"animatioin"]; 84 | 85 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 86 | 87 | return animation; 88 | } 89 | 90 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag 91 | { 92 | if ([[anim valueForKey:@"animatioin"] isEqualToString:@"animation1"]) { 93 | 94 | _isReversal = !_isReversal; 95 | 96 | if (_isReversal) 97 | { 98 | self.leftDot.backgroundColor = self.colors.lastObject; 99 | 100 | self.rightDot.backgroundColor = self.colors.firstObject; 101 | } 102 | else 103 | { 104 | self.leftDot.backgroundColor = self.colors.firstObject; 105 | 106 | self.rightDot.backgroundColor = self.colors.lastObject; 107 | } 108 | 109 | [self showAnimationView]; 110 | } 111 | 112 | } 113 | 114 | - (UIView *)leftDot 115 | { 116 | if (!_leftDot) { 117 | _leftDot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 118 | 119 | _leftDot.centerY = self.centerY; 120 | 121 | _leftDot.centerX = self.centerX - 20; 122 | 123 | _leftDot.layer.cornerRadius = 5; 124 | 125 | _leftDot.layer.masksToBounds = YES; 126 | 127 | _leftDot.backgroundColor = self.colors[0]; 128 | } 129 | return _leftDot; 130 | } 131 | 132 | - (UIView *)middleDot 133 | { 134 | if (!_middleDot) { 135 | _middleDot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 136 | 137 | _middleDot.centerY = self.centerY; 138 | 139 | _middleDot.centerX = self.centerX; 140 | 141 | _middleDot.layer.cornerRadius = 5; 142 | 143 | _middleDot.layer.masksToBounds = YES; 144 | 145 | _middleDot.backgroundColor = self.colors[1]; 146 | } 147 | return _middleDot; 148 | } 149 | 150 | - (UIView *)rightDot 151 | { 152 | if (!_rightDot) { 153 | _rightDot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 154 | 155 | _rightDot.centerY = self.centerY; 156 | 157 | _rightDot.centerX = self.centerX + 20; 158 | 159 | _rightDot.layer.cornerRadius = 5; 160 | 161 | _rightDot.layer.masksToBounds = YES; 162 | 163 | _rightDot.backgroundColor = self.colors[2]; 164 | } 165 | return _rightDot; 166 | } 167 | 168 | @end 169 | 170 | #pragma mark - 171 | #pragma mark - MGAlternationView 172 | 173 | @interface MGAlternationView () 174 | 175 | @property (nonatomic, strong) UIView *leftDot; 176 | 177 | @property (nonatomic, strong) UIView *middleDot; 178 | 179 | @property (nonatomic, strong) UIView *rightDot; 180 | 181 | @property (nonatomic, strong) NSMutableArray *colors; 182 | 183 | @end 184 | @implementation MGAlternationView 185 | 186 | - (instancetype)initWithFrame:(CGRect)frame 187 | { 188 | if (self = [super initWithFrame:frame]) { 189 | 190 | self.colors = @[[UIColor redColor], [UIColor blueColor], [UIColor greenColor]].mutableCopy; 191 | 192 | [self addSubview:self.rightDot]; 193 | 194 | [self addSubview:self.middleDot]; 195 | 196 | [self addSubview:self.leftDot]; 197 | 198 | } 199 | return self; 200 | } 201 | 202 | - (void)showAnimationView 203 | { 204 | [UIView animateWithDuration:1 animations:^{ 205 | 206 | self.leftDot.center = CGPointMake(self.leftDot.layer.position.x + 20, self.centerY); 207 | 208 | self.rightDot.center = CGPointMake(self.rightDot.layer.position.x - 20, self.centerY); 209 | 210 | } completion:^(BOOL finished) { 211 | 212 | [UIView animateWithDuration:1 animations:^{ 213 | 214 | self.rightDot.center = CGPointMake(self.rightDot.layer.position.x - 20, self.centerY); 215 | 216 | self.middleDot.center = CGPointMake(self.leftDot.layer.position.x + 20, self.centerY); 217 | 218 | 219 | } completion:^(BOOL finished) { 220 | 221 | [UIView animateWithDuration:1 animations:^{ 222 | 223 | self.rightDot.center = CGPointMake(self.rightDot.layer.position.x + 20, self.centerY); 224 | 225 | self.middleDot.center = CGPointMake(self.middleDot.layer.position.x - 20, self.centerY); 226 | 227 | [self bringSubviewToFront:self.rightDot]; 228 | 229 | } completion:^(BOOL finished) { 230 | 231 | [UIView animateWithDuration:1 animations:^{ 232 | 233 | self.middleDot.center = CGPointMake(self.middleDot.layer.position.x - 20, self.centerY); 234 | 235 | self.leftDot.center = CGPointMake(self.leftDot.layer.position.x + 20, self.centerY); 236 | 237 | } completion:^(BOOL finished) { 238 | 239 | 240 | [UIView animateWithDuration:1 animations:^{ 241 | 242 | self.middleDot.center = CGPointMake(self.middleDot.layer.position.x + 20, self.centerY); 243 | 244 | self.leftDot.center = CGPointMake(self.leftDot.layer.position.x - 20, self.centerY); 245 | 246 | [self bringSubviewToFront:self.middleDot]; 247 | 248 | } completion:^(BOOL finished) { 249 | 250 | [UIView animateWithDuration:1 animations:^{ 251 | 252 | self.leftDot.center = CGPointMake(self.leftDot.layer.position.x - 20, self.centerY); 253 | 254 | self.rightDot.center = CGPointMake(self.rightDot.layer.position.x + 20, self.centerY); 255 | 256 | } completion:^(BOOL finished) { 257 | 258 | [self bringSubviewToFront:self.leftDot]; 259 | 260 | [self showAnimationView]; 261 | }]; 262 | 263 | }]; 264 | 265 | }]; 266 | 267 | }]; 268 | }]; 269 | }]; 270 | } 271 | 272 | - (UIView *)leftDot 273 | { 274 | if (!_leftDot) { 275 | _leftDot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 276 | 277 | _leftDot.centerY = self.centerY; 278 | 279 | _leftDot.centerX = self.centerX - 20; 280 | 281 | _leftDot.layer.cornerRadius = 5; 282 | 283 | _leftDot.layer.masksToBounds = YES; 284 | 285 | _leftDot.backgroundColor = self.colors[0]; 286 | } 287 | return _leftDot; 288 | } 289 | 290 | - (UIView *)middleDot 291 | { 292 | if (!_middleDot) { 293 | _middleDot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 294 | 295 | _middleDot.centerY = self.centerY; 296 | 297 | _middleDot.centerX = self.centerX; 298 | 299 | _middleDot.layer.cornerRadius = 5; 300 | 301 | _middleDot.layer.masksToBounds = YES; 302 | 303 | _middleDot.backgroundColor = self.colors[1]; 304 | } 305 | return _middleDot; 306 | } 307 | 308 | - (UIView *)rightDot 309 | { 310 | if (!_rightDot) { 311 | _rightDot = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)]; 312 | 313 | _rightDot.centerY = self.centerY; 314 | 315 | _rightDot.centerX = self.centerX + 20; 316 | 317 | _rightDot.layer.cornerRadius = 5; 318 | 319 | _rightDot.layer.masksToBounds = YES; 320 | 321 | _rightDot.backgroundColor = self.colors[2]; 322 | } 323 | return _rightDot; 324 | } 325 | 326 | @end 327 | 328 | 329 | 330 | -------------------------------------------------------------------------------- /MGWidget/MGWidget/MGWidget/ShowView/MGPatternView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGPatternView.m 3 | // MGWidget 4 | // 5 | // Created by acmeway on 2018/4/1. 6 | // Copyright © 2018年 acmeway. All rights reserved. 7 | // 8 | 9 | #import "MGPatternView.h" 10 | 11 | @interface MGPatternView () 12 | { 13 | BOOL _isClick; 14 | NSInteger _frequency; 15 | } 16 | @property (nonatomic, weak) UIButton *plusBtn; 17 | 18 | @end 19 | @implementation MGPatternView 20 | 21 | - (void)setSubViews:(NSArray *)subViews 22 | { 23 | _subViews = subViews; 24 | 25 | for (UIButton *btn in self.subViews) { 26 | 27 | if (btn != nil) 28 | { 29 | [self addSubview:btn]; 30 | 31 | btn.centerX = self.width / 2.0; 32 | 33 | btn.centerY = self.height / 2.0; 34 | 35 | btn.hidden = YES; 36 | 37 | [self sendSubviewToBack:btn]; 38 | } 39 | 40 | [btn addTarget:self action:@selector(clickBtn:) forControlEvents:UIControlEventTouchUpInside]; 41 | } 42 | } 43 | 44 | - (void)clickBtn:(UIButton *)btn 45 | { 46 | if (self.PatterviewBlock) { 47 | 48 | self.PatterviewBlock(btn.tag); 49 | } 50 | if (_isClick) [self hidePattern]; 51 | 52 | self.plusBtn.selected = NO; 53 | } 54 | 55 | - (void)setMotorDirection:(MGMotorDirection)motorDirection 56 | { 57 | _motorDirection = motorDirection; 58 | } 59 | 60 | - (instancetype)initWithFrame:(CGRect)frame 61 | { 62 | if (self = [super initWithFrame:frame]) { 63 | 64 | self.viewSpacing = 20; 65 | 66 | self.animationDuration = 0.5; 67 | 68 | _isClick = YES; 69 | 70 | [self setupPlusLinearBtns]; 71 | } 72 | return self; 73 | } 74 | 75 | - (void)setupPlusLinearBtns 76 | { 77 | UIButton *plusBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50)]; 78 | 79 | self.plusBtn = plusBtn; 80 | 81 | [plusBtn setBackgroundImage:[UIImage imageNamed:@"plus_circle"] forState:UIControlStateNormal]; 82 | 83 | [plusBtn addTarget:self action:@selector(clickPlusBtn:) forControlEvents:UIControlEventTouchUpInside]; 84 | 85 | plusBtn.backgroundColor = MGColor; 86 | 87 | plusBtn.layer.cornerRadius = 25; 88 | 89 | plusBtn.layer.masksToBounds = YES; 90 | 91 | [self addSubview:plusBtn]; 92 | } 93 | 94 | - (void)clickPlusBtn:(UIButton *)btn 95 | { 96 | if (_isClick ) 97 | { 98 | CGFloat minvalue = kMinValue(self.width, self.height); 99 | 100 | CGFloat maxValue = kMaxValue(self.width, self.height); 101 | 102 | if (minvalue == maxValue) 103 | { 104 | [self showPattern]; 105 | } 106 | else 107 | { 108 | [self hidePattern]; 109 | } 110 | } 111 | } 112 | 113 | - (void)showPattern 114 | { 115 | if (self.subViews.count == 0) return; 116 | 117 | CGPoint fromPosition = CGPointZero; 118 | 119 | CGPoint toPosition = CGPointZero; 120 | 121 | [CATransaction begin]; 122 | 123 | [CATransaction setAnimationDuration:_animationDuration]; 124 | 125 | [CATransaction setCompletionBlock:^{ 126 | 127 | for (UIButton *btn in self.subViews) { 128 | 129 | btn.transform = CGAffineTransformIdentity; 130 | 131 | } 132 | self.userInteractionEnabled = YES; 133 | }]; 134 | 135 | switch (self.motorDirection) { 136 | 137 | case MGMotorDirectionLeft: 138 | { 139 | self.plusBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; 140 | 141 | for (UIButton *btn in self.subViews) { 142 | 143 | self.width += (_viewSpacing + btn.width); 144 | 145 | self.x -= (_viewSpacing + btn.width); 146 | } 147 | 148 | int i = 0; 149 | for (UIButton * btn in self.subViews) { 150 | 151 | btn.hidden = NO; 152 | 153 | fromPosition = CGPointMake(self.width - self.height * 0.5, self.height * 0.5); 154 | 155 | toPosition = CGPointMake(btn.width * 0.5 + (_viewSpacing + btn.width) * i, self.height * 0.5); 156 | 157 | [self addAinmationWithView:btn fromValue:fromPosition toValue:toPosition duration:_animationDuration index:i]; 158 | 159 | btn.backgroundColor = [UIColor redColor]; 160 | 161 | i++; 162 | } 163 | } 164 | break; 165 | case MGMotorDirectionRight: 166 | { 167 | for (UIButton *btn in self.subViews) { 168 | self.width += (_viewSpacing + btn.width) ; 169 | } 170 | 171 | int i = 0; 172 | for (UIButton * btn in self.subViews) { 173 | 174 | btn.hidden = NO; 175 | 176 | fromPosition = CGPointMake(self.height * 0.5, self.height * 0.5); 177 | 178 | toPosition = CGPointMake(self.height + (_viewSpacing + btn.width) * (self.subViews.count - i) - btn.width/2.0, 179 | self.height * 0.5); 180 | 181 | [self addAinmationWithView:btn fromValue:fromPosition toValue:toPosition duration:_animationDuration index:i]; 182 | 183 | btn.backgroundColor = [UIColor redColor]; 184 | 185 | i++; 186 | } 187 | } 188 | break; 189 | case MGMotorDirectionUp: 190 | { 191 | self.plusBtn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin; 192 | 193 | for (UIButton *btn in self.subViews) { 194 | 195 | self.height += (_viewSpacing + btn.height); 196 | 197 | self.y -= (_viewSpacing + btn.height); 198 | } 199 | 200 | int i = 0; 201 | for (UIButton * btn in self.subViews) { 202 | 203 | btn.hidden = NO; 204 | 205 | fromPosition = CGPointMake(self.width * 0.5, self.height - self.width * 0.5); 206 | 207 | toPosition = CGPointMake(self.width * 0.5, btn.height / 2.0 + (_viewSpacing + btn.height) * i ); 208 | 209 | [self addAinmationWithView:btn fromValue:fromPosition toValue:toPosition duration:_animationDuration index:i]; 210 | 211 | btn.backgroundColor = [UIColor redColor]; 212 | 213 | i++; 214 | } 215 | } 216 | break; 217 | case MGMotorDirectionDown: 218 | { 219 | for (UIButton *btn in self.subViews) { 220 | self.height += (_viewSpacing + btn.height) ; 221 | } 222 | 223 | int i = 0; 224 | for (UIButton * btn in self.subViews) { 225 | 226 | btn.hidden = NO; 227 | 228 | fromPosition = CGPointMake(self.width * 0.5, self.width * 0.5); 229 | 230 | toPosition = CGPointMake(self.width * 0.5, 231 | self.width + (_viewSpacing + btn.height) * (self.subViews.count - i) - btn.height/2.0); 232 | 233 | [self addAinmationWithView:btn fromValue:fromPosition toValue:toPosition duration:_animationDuration index:i]; 234 | 235 | btn.backgroundColor = [UIColor redColor]; 236 | 237 | i++; 238 | } 239 | } 240 | break; 241 | } 242 | [CATransaction commit]; 243 | } 244 | 245 | - (void)hidePattern 246 | { 247 | [CATransaction begin]; 248 | 249 | [CATransaction setAnimationDuration:_animationDuration]; 250 | 251 | [CATransaction setCompletionBlock:^{ 252 | 253 | for (UIButton *btn in self.subViews) { 254 | 255 | btn.transform = CGAffineTransformIdentity; 256 | 257 | btn.hidden = YES; 258 | } 259 | 260 | self.userInteractionEnabled = YES; 261 | }]; 262 | 263 | CGFloat kSize = kMinValue(self.width, self.height); 264 | 265 | for (NSInteger i = self.subViews.count - 1; i >= 0; i--) { 266 | 267 | UIButton *btn = self.subViews[i]; 268 | 269 | CGPoint fromPosition = CGPointZero; 270 | 271 | CGPoint toPosition = CGPointZero; 272 | 273 | switch (self.motorDirection) { 274 | 275 | case MGMotorDirectionLeft: 276 | { 277 | self.width -= (_viewSpacing + btn.width); 278 | 279 | self.x += (_viewSpacing + btn.height); 280 | 281 | fromPosition = CGPointMake(btn.width / 2.0 - (_viewSpacing + btn.width) * (self.subViews.count - i), 282 | self.height * 0.5); 283 | 284 | toPosition = CGPointMake(kSize * 0.5, kSize * 0.5); 285 | 286 | [self hideAinmationWithView:btn fromValue:fromPosition toValue:toPosition duration:_animationDuration index:i]; 287 | 288 | } 289 | break; 290 | case MGMotorDirectionRight: 291 | { 292 | self.width -= (_viewSpacing + btn.width) ; 293 | 294 | fromPosition = CGPointMake(self.height + (_viewSpacing + btn.height) * (self.subViews.count - i) - btn.height / 2.0, 295 | self.height * 0.5); 296 | toPosition = CGPointMake(kSize * 0.5, kSize * 0.5); 297 | 298 | [self hideAinmationWithView:btn fromValue:fromPosition toValue:toPosition duration:_animationDuration index:i]; 299 | 300 | } 301 | break; 302 | case MGMotorDirectionUp: 303 | { 304 | self.height -= (_viewSpacing + btn.height); 305 | 306 | self.y += (_viewSpacing + btn.height); 307 | 308 | fromPosition = CGPointMake(self.width * 0.5, 309 | btn.height / 2.0 - (_viewSpacing + btn.height) * (self.subViews.count - i)); 310 | 311 | toPosition = CGPointMake(kSize * 0.5, kSize * 0.5); 312 | 313 | [self hideAinmationWithView:btn fromValue:fromPosition toValue:toPosition duration:_animationDuration index:i]; 314 | 315 | } 316 | break; 317 | case MGMotorDirectionDown: 318 | { 319 | self.height -= (_viewSpacing + btn.height); 320 | 321 | fromPosition = CGPointMake(self.width * 0.5, 322 | self.width + (_viewSpacing + btn.height) * (self.subViews.count - i) - btn.height / 2.0); 323 | 324 | toPosition = CGPointMake(kSize * 0.5, kSize * 0.5); 325 | 326 | [self hideAinmationWithView:btn fromValue:fromPosition toValue:toPosition duration:_animationDuration index:i]; 327 | } 328 | 329 | break; 330 | } 331 | 332 | btn.backgroundColor = [UIColor redColor]; 333 | 334 | } 335 | 336 | [CATransaction commit]; 337 | } 338 | 339 | - (void)addAinmationWithView:(UIView *)view 340 | fromValue:(CGPoint)fromeValue 341 | toValue:(CGPoint)toValue 342 | duration:(CGFloat)animationDuration 343 | index:(NSInteger)index 344 | { 345 | CABasicAnimation *positionAnimation = [CABasicAnimation animationWithKeyPath:@"position"]; 346 | 347 | positionAnimation.duration = animationDuration; 348 | 349 | positionAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 350 | 351 | positionAnimation.fromValue = [NSValue valueWithCGPoint:fromeValue]; 352 | 353 | positionAnimation.toValue = [NSValue valueWithCGPoint:toValue]; 354 | 355 | positionAnimation.beginTime = CACurrentMediaTime() + (animationDuration * 1.0/self.subViews.count * (index - 1) ); 356 | 357 | positionAnimation.fillMode = kCAFillModeForwards; 358 | 359 | positionAnimation.removedOnCompletion = NO; 360 | 361 | [view.layer addAnimation:positionAnimation forKey:positionAnimation.keyPath]; 362 | 363 | view.layer.position = toValue; 364 | 365 | view.center = toValue; 366 | 367 | CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 368 | 369 | scaleAnimation.duration = animationDuration; 370 | 371 | scaleAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 372 | 373 | scaleAnimation.fromValue = [NSNumber numberWithFloat:0.01f]; 374 | 375 | scaleAnimation.toValue = [NSNumber numberWithFloat:1.f]; 376 | 377 | scaleAnimation.beginTime = CACurrentMediaTime() + (animationDuration * 1.0/self.subViews.count * index); 378 | 379 | scaleAnimation.fillMode = kCAFillModeForwards; 380 | 381 | scaleAnimation.removedOnCompletion = NO; 382 | 383 | scaleAnimation.delegate = self; 384 | 385 | [view.layer addAnimation:scaleAnimation forKey:scaleAnimation.keyPath]; 386 | 387 | view.transform = CGAffineTransformMakeScale(0.01f, 0.01f); 388 | 389 | _isClick = NO; 390 | 391 | } 392 | 393 | - (void)hideAinmationWithView:(UIView *)view 394 | fromValue:(CGPoint)fromeValue 395 | toValue:(CGPoint)toValue 396 | duration:(CGFloat)animationDuration 397 | index:(NSInteger)index 398 | { 399 | CABasicAnimation *positionAnimation = [CABasicAnimation animationWithKeyPath:@"position"]; 400 | 401 | positionAnimation.duration = animationDuration; 402 | 403 | positionAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 404 | 405 | positionAnimation.fromValue = [NSValue valueWithCGPoint:fromeValue]; 406 | 407 | positionAnimation.toValue = [NSValue valueWithCGPoint:toValue]; 408 | 409 | positionAnimation.beginTime = CACurrentMediaTime() + (animationDuration * 1.0/self.subViews.count * (self.subViews.count - index - 1)); 410 | 411 | positionAnimation.fillMode = kCAFillModeForwards; 412 | 413 | positionAnimation.removedOnCompletion = NO; 414 | 415 | [view.layer addAnimation:positionAnimation forKey:positionAnimation.keyPath]; 416 | 417 | view.layer.position = fromeValue; 418 | 419 | CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; 420 | 421 | scaleAnimation.duration = animationDuration; 422 | 423 | scaleAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 424 | 425 | scaleAnimation.fromValue = [NSNumber numberWithFloat:1.f]; 426 | 427 | scaleAnimation.toValue = [NSNumber numberWithFloat:0.001f]; 428 | 429 | scaleAnimation.beginTime = CACurrentMediaTime() + (animationDuration * 1.0/self.subViews.count * (self.subViews.count - index - 1)); 430 | 431 | scaleAnimation.fillMode = kCAFillModeForwards; 432 | 433 | scaleAnimation.removedOnCompletion = NO; 434 | 435 | scaleAnimation.delegate = self; 436 | 437 | [view.layer addAnimation:scaleAnimation forKey:scaleAnimation.keyPath]; 438 | 439 | view.transform = CGAffineTransformMakeScale(1.f, 1.f); 440 | 441 | _isClick = NO; 442 | } 443 | 444 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag 445 | { 446 | if (++_frequency == self.subViews.count) { 447 | 448 | _isClick = YES; 449 | 450 | _frequency = 0; 451 | } 452 | } 453 | 454 | @end 455 | -------------------------------------------------------------------------------- /MGWidget/MGWidget.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1542E10820707DCA000E8330 /* MGPatternView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1542E10720707DCA000E8330 /* MGPatternView.m */; }; 11 | 1548D01B20735696006DA610 /* earth.png in Resources */ = {isa = PBXBuildFile; fileRef = 1548D01A20735696006DA610 /* earth.png */; }; 12 | 1548D01F20737045006DA610 /* NSObject+LoadTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 1548D01E20737045006DA610 /* NSObject+LoadTool.m */; }; 13 | 1548D02220747D7D006DA610 /* MGLoadDotView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1548D02120747D7D006DA610 /* MGLoadDotView.m */; }; 14 | 1548D0272075A6AB006DA610 /* MGWorshipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1548D0262075A6AB006DA610 /* MGWorshipView.m */; }; 15 | 156C376020888E5F002D9339 /* MGRotaLoadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 156C375F20888E5F002D9339 /* MGRotaLoadView.m */; }; 16 | 157D46E6206BAABC00A0BC22 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D46E5206BAABC00A0BC22 /* AppDelegate.m */; }; 17 | 157D46E9206BAABC00A0BC22 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D46E8206BAABC00A0BC22 /* ViewController.m */; }; 18 | 157D46EC206BAABC00A0BC22 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 157D46EA206BAABC00A0BC22 /* Main.storyboard */; }; 19 | 157D46EE206BAABC00A0BC22 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 157D46ED206BAABC00A0BC22 /* Assets.xcassets */; }; 20 | 157D46F1206BAABC00A0BC22 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 157D46EF206BAABC00A0BC22 /* LaunchScreen.storyboard */; }; 21 | 157D46F4206BAABC00A0BC22 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D46F3206BAABC00A0BC22 /* main.m */; }; 22 | 157D46FE206BAABC00A0BC22 /* MGWidgetTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D46FD206BAABC00A0BC22 /* MGWidgetTests.m */; }; 23 | 157D4709206BAABC00A0BC22 /* MGWidgetUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D4708206BAABC00A0BC22 /* MGWidgetUITests.m */; }; 24 | 157D4718206BABBA00A0BC22 /* UIView+Frame.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D4717206BABBA00A0BC22 /* UIView+Frame.m */; }; 25 | 157D4722206CCCC000A0BC22 /* MGShowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D4721206CCCC000A0BC22 /* MGShowController.m */; }; 26 | 157D4725206CD18700A0BC22 /* MGShowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D4724206CD18700A0BC22 /* MGShowView.m */; }; 27 | 157D4728206CEAA400A0BC22 /* NSObject+common.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D4727206CEAA400A0BC22 /* NSObject+common.m */; }; 28 | 157D4732206E0FEF00A0BC22 /* MGLoaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 157D4731206E0FEF00A0BC22 /* MGLoaderView.m */; }; 29 | 157D4735206E3BB700A0BC22 /* plus_circle@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 157D4733206E3BB600A0BC22 /* plus_circle@2x.png */; }; 30 | 157D4736206E3BB700A0BC22 /* plus_circle@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 157D4734206E3BB600A0BC22 /* plus_circle@3x.png */; }; 31 | 15A97BF0207F359A006A61AF /* MGAlterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 15A97BEF207F359A006A61AF /* MGAlterView.m */; }; 32 | 15A97BF6207F6AC0006A61AF /* CALayer+Common.m in Sources */ = {isa = PBXBuildFile; fileRef = 15A97BF5207F6AC0006A61AF /* CALayer+Common.m */; }; 33 | F8778897207E553700DF1559 /* MGChainView.m in Sources */ = {isa = PBXBuildFile; fileRef = F8778896207E553700DF1559 /* MGChainView.m */; }; 34 | /* End PBXBuildFile section */ 35 | 36 | /* Begin PBXContainerItemProxy section */ 37 | 157D46FA206BAABC00A0BC22 /* PBXContainerItemProxy */ = { 38 | isa = PBXContainerItemProxy; 39 | containerPortal = 157D46D9206BAABC00A0BC22 /* Project object */; 40 | proxyType = 1; 41 | remoteGlobalIDString = 157D46E0206BAABC00A0BC22; 42 | remoteInfo = MGWidget; 43 | }; 44 | 157D4705206BAABC00A0BC22 /* PBXContainerItemProxy */ = { 45 | isa = PBXContainerItemProxy; 46 | containerPortal = 157D46D9206BAABC00A0BC22 /* Project object */; 47 | proxyType = 1; 48 | remoteGlobalIDString = 157D46E0206BAABC00A0BC22; 49 | remoteInfo = MGWidget; 50 | }; 51 | /* End PBXContainerItemProxy section */ 52 | 53 | /* Begin PBXFileReference section */ 54 | 1542E10620707DCA000E8330 /* MGPatternView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGPatternView.h; sourceTree = ""; }; 55 | 1542E10720707DCA000E8330 /* MGPatternView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGPatternView.m; sourceTree = ""; }; 56 | 1548D01A20735696006DA610 /* earth.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = earth.png; sourceTree = ""; }; 57 | 1548D01D20737045006DA610 /* NSObject+LoadTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+LoadTool.h"; sourceTree = ""; }; 58 | 1548D01E20737045006DA610 /* NSObject+LoadTool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+LoadTool.m"; sourceTree = ""; }; 59 | 1548D02020747D7D006DA610 /* MGLoadDotView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLoadDotView.h; sourceTree = ""; }; 60 | 1548D02120747D7D006DA610 /* MGLoadDotView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLoadDotView.m; sourceTree = ""; }; 61 | 1548D0252075A6AB006DA610 /* MGWorshipView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGWorshipView.h; sourceTree = ""; }; 62 | 1548D0262075A6AB006DA610 /* MGWorshipView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGWorshipView.m; sourceTree = ""; }; 63 | 156C375E20888E5F002D9339 /* MGRotaLoadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGRotaLoadView.h; sourceTree = ""; }; 64 | 156C375F20888E5F002D9339 /* MGRotaLoadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGRotaLoadView.m; sourceTree = ""; }; 65 | 157D46E1206BAABC00A0BC22 /* MGWidget.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MGWidget.app; sourceTree = BUILT_PRODUCTS_DIR; }; 66 | 157D46E4206BAABC00A0BC22 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 67 | 157D46E5206BAABC00A0BC22 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 68 | 157D46E7206BAABC00A0BC22 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 69 | 157D46E8206BAABC00A0BC22 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 70 | 157D46EB206BAABC00A0BC22 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 71 | 157D46ED206BAABC00A0BC22 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 72 | 157D46F0206BAABC00A0BC22 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 73 | 157D46F2206BAABC00A0BC22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 74 | 157D46F3206BAABC00A0BC22 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 75 | 157D46F9206BAABC00A0BC22 /* MGWidgetTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MGWidgetTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 76 | 157D46FD206BAABC00A0BC22 /* MGWidgetTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGWidgetTests.m; sourceTree = ""; }; 77 | 157D46FF206BAABC00A0BC22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 78 | 157D4704206BAABC00A0BC22 /* MGWidgetUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MGWidgetUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 79 | 157D4708206BAABC00A0BC22 /* MGWidgetUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGWidgetUITests.m; sourceTree = ""; }; 80 | 157D470A206BAABC00A0BC22 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 81 | 157D4716206BABBA00A0BC22 /* UIView+Frame.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Frame.h"; sourceTree = ""; }; 82 | 157D4717206BABBA00A0BC22 /* UIView+Frame.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+Frame.m"; sourceTree = ""; }; 83 | 157D4719206BABDA00A0BC22 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; 84 | 157D4720206CCCC000A0BC22 /* MGShowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGShowController.h; sourceTree = ""; }; 85 | 157D4721206CCCC000A0BC22 /* MGShowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGShowController.m; sourceTree = ""; }; 86 | 157D4723206CD18700A0BC22 /* MGShowView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGShowView.h; sourceTree = ""; }; 87 | 157D4724206CD18700A0BC22 /* MGShowView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGShowView.m; sourceTree = ""; }; 88 | 157D4726206CEAA400A0BC22 /* NSObject+common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+common.h"; sourceTree = ""; }; 89 | 157D4727206CEAA400A0BC22 /* NSObject+common.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+common.m"; sourceTree = ""; }; 90 | 157D4730206E0FEF00A0BC22 /* MGLoaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLoaderView.h; sourceTree = ""; }; 91 | 157D4731206E0FEF00A0BC22 /* MGLoaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLoaderView.m; sourceTree = ""; }; 92 | 157D4733206E3BB600A0BC22 /* plus_circle@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "plus_circle@2x.png"; sourceTree = ""; }; 93 | 157D4734206E3BB600A0BC22 /* plus_circle@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "plus_circle@3x.png"; sourceTree = ""; }; 94 | 15A97BEE207F359A006A61AF /* MGAlterView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGAlterView.h; sourceTree = ""; }; 95 | 15A97BEF207F359A006A61AF /* MGAlterView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGAlterView.m; sourceTree = ""; }; 96 | 15A97BF4207F6AC0006A61AF /* CALayer+Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CALayer+Common.h"; sourceTree = ""; }; 97 | 15A97BF5207F6AC0006A61AF /* CALayer+Common.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CALayer+Common.m"; sourceTree = ""; }; 98 | F8778895207E553700DF1559 /* MGChainView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGChainView.h; sourceTree = ""; }; 99 | F8778896207E553700DF1559 /* MGChainView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGChainView.m; sourceTree = ""; }; 100 | /* End PBXFileReference section */ 101 | 102 | /* Begin PBXFrameworksBuildPhase section */ 103 | 157D46DE206BAABC00A0BC22 /* Frameworks */ = { 104 | isa = PBXFrameworksBuildPhase; 105 | buildActionMask = 2147483647; 106 | files = ( 107 | ); 108 | runOnlyForDeploymentPostprocessing = 0; 109 | }; 110 | 157D46F6206BAABC00A0BC22 /* Frameworks */ = { 111 | isa = PBXFrameworksBuildPhase; 112 | buildActionMask = 2147483647; 113 | files = ( 114 | ); 115 | runOnlyForDeploymentPostprocessing = 0; 116 | }; 117 | 157D4701206BAABC00A0BC22 /* Frameworks */ = { 118 | isa = PBXFrameworksBuildPhase; 119 | buildActionMask = 2147483647; 120 | files = ( 121 | ); 122 | runOnlyForDeploymentPostprocessing = 0; 123 | }; 124 | /* End PBXFrameworksBuildPhase section */ 125 | 126 | /* Begin PBXGroup section */ 127 | 1548D0232075A46B006DA610 /* LoaderView */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 157D4730206E0FEF00A0BC22 /* MGLoaderView.h */, 131 | 157D4731206E0FEF00A0BC22 /* MGLoaderView.m */, 132 | 1548D02020747D7D006DA610 /* MGLoadDotView.h */, 133 | 1548D02120747D7D006DA610 /* MGLoadDotView.m */, 134 | 1548D0252075A6AB006DA610 /* MGWorshipView.h */, 135 | 1548D0262075A6AB006DA610 /* MGWorshipView.m */, 136 | F8778895207E553700DF1559 /* MGChainView.h */, 137 | F8778896207E553700DF1559 /* MGChainView.m */, 138 | 15A97BEE207F359A006A61AF /* MGAlterView.h */, 139 | 15A97BEF207F359A006A61AF /* MGAlterView.m */, 140 | 156C375E20888E5F002D9339 /* MGRotaLoadView.h */, 141 | 156C375F20888E5F002D9339 /* MGRotaLoadView.m */, 142 | 15A97BF4207F6AC0006A61AF /* CALayer+Common.h */, 143 | 15A97BF5207F6AC0006A61AF /* CALayer+Common.m */, 144 | 1548D01D20737045006DA610 /* NSObject+LoadTool.h */, 145 | 1548D01E20737045006DA610 /* NSObject+LoadTool.m */, 146 | ); 147 | path = LoaderView; 148 | sourceTree = ""; 149 | }; 150 | 1548D0242075A47C006DA610 /* ShowView */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 157D4723206CD18700A0BC22 /* MGShowView.h */, 154 | 157D4724206CD18700A0BC22 /* MGShowView.m */, 155 | 1542E10620707DCA000E8330 /* MGPatternView.h */, 156 | 1542E10720707DCA000E8330 /* MGPatternView.m */, 157 | 157D4726206CEAA400A0BC22 /* NSObject+common.h */, 158 | 157D4727206CEAA400A0BC22 /* NSObject+common.m */, 159 | ); 160 | path = ShowView; 161 | sourceTree = ""; 162 | }; 163 | 157D46D8206BAABC00A0BC22 = { 164 | isa = PBXGroup; 165 | children = ( 166 | 157D46E3206BAABC00A0BC22 /* MGWidget */, 167 | 157D46FC206BAABC00A0BC22 /* MGWidgetTests */, 168 | 157D4707206BAABC00A0BC22 /* MGWidgetUITests */, 169 | 157D46E2206BAABC00A0BC22 /* Products */, 170 | ); 171 | sourceTree = ""; 172 | }; 173 | 157D46E2206BAABC00A0BC22 /* Products */ = { 174 | isa = PBXGroup; 175 | children = ( 176 | 157D46E1206BAABC00A0BC22 /* MGWidget.app */, 177 | 157D46F9206BAABC00A0BC22 /* MGWidgetTests.xctest */, 178 | 157D4704206BAABC00A0BC22 /* MGWidgetUITests.xctest */, 179 | ); 180 | name = Products; 181 | sourceTree = ""; 182 | }; 183 | 157D46E3206BAABC00A0BC22 /* MGWidget */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | 157D4729206CFD8D00A0BC22 /* MGWidget */, 187 | 157D46E4206BAABC00A0BC22 /* AppDelegate.h */, 188 | 157D46E5206BAABC00A0BC22 /* AppDelegate.m */, 189 | 157D46E7206BAABC00A0BC22 /* ViewController.h */, 190 | 157D46E8206BAABC00A0BC22 /* ViewController.m */, 191 | 157D4720206CCCC000A0BC22 /* MGShowController.h */, 192 | 157D4721206CCCC000A0BC22 /* MGShowController.m */, 193 | 157D4719206BABDA00A0BC22 /* PrefixHeader.pch */, 194 | 157D46EA206BAABC00A0BC22 /* Main.storyboard */, 195 | 157D46ED206BAABC00A0BC22 /* Assets.xcassets */, 196 | 157D4733206E3BB600A0BC22 /* plus_circle@2x.png */, 197 | 157D4734206E3BB600A0BC22 /* plus_circle@3x.png */, 198 | 1548D01A20735696006DA610 /* earth.png */, 199 | 157D46EF206BAABC00A0BC22 /* LaunchScreen.storyboard */, 200 | 157D46F2206BAABC00A0BC22 /* Info.plist */, 201 | 157D46F3206BAABC00A0BC22 /* main.m */, 202 | ); 203 | path = MGWidget; 204 | sourceTree = ""; 205 | }; 206 | 157D46FC206BAABC00A0BC22 /* MGWidgetTests */ = { 207 | isa = PBXGroup; 208 | children = ( 209 | 157D46FD206BAABC00A0BC22 /* MGWidgetTests.m */, 210 | 157D46FF206BAABC00A0BC22 /* Info.plist */, 211 | ); 212 | path = MGWidgetTests; 213 | sourceTree = ""; 214 | }; 215 | 157D4707206BAABC00A0BC22 /* MGWidgetUITests */ = { 216 | isa = PBXGroup; 217 | children = ( 218 | 157D4708206BAABC00A0BC22 /* MGWidgetUITests.m */, 219 | 157D470A206BAABC00A0BC22 /* Info.plist */, 220 | ); 221 | path = MGWidgetUITests; 222 | sourceTree = ""; 223 | }; 224 | 157D4729206CFD8D00A0BC22 /* MGWidget */ = { 225 | isa = PBXGroup; 226 | children = ( 227 | 1548D0242075A47C006DA610 /* ShowView */, 228 | 1548D0232075A46B006DA610 /* LoaderView */, 229 | 157D4716206BABBA00A0BC22 /* UIView+Frame.h */, 230 | 157D4717206BABBA00A0BC22 /* UIView+Frame.m */, 231 | ); 232 | path = MGWidget; 233 | sourceTree = ""; 234 | }; 235 | /* End PBXGroup section */ 236 | 237 | /* Begin PBXNativeTarget section */ 238 | 157D46E0206BAABC00A0BC22 /* MGWidget */ = { 239 | isa = PBXNativeTarget; 240 | buildConfigurationList = 157D470D206BAABC00A0BC22 /* Build configuration list for PBXNativeTarget "MGWidget" */; 241 | buildPhases = ( 242 | 157D46DD206BAABC00A0BC22 /* Sources */, 243 | 157D46DE206BAABC00A0BC22 /* Frameworks */, 244 | 157D46DF206BAABC00A0BC22 /* Resources */, 245 | ); 246 | buildRules = ( 247 | ); 248 | dependencies = ( 249 | ); 250 | name = MGWidget; 251 | productName = MGWidget; 252 | productReference = 157D46E1206BAABC00A0BC22 /* MGWidget.app */; 253 | productType = "com.apple.product-type.application"; 254 | }; 255 | 157D46F8206BAABC00A0BC22 /* MGWidgetTests */ = { 256 | isa = PBXNativeTarget; 257 | buildConfigurationList = 157D4710206BAABC00A0BC22 /* Build configuration list for PBXNativeTarget "MGWidgetTests" */; 258 | buildPhases = ( 259 | 157D46F5206BAABC00A0BC22 /* Sources */, 260 | 157D46F6206BAABC00A0BC22 /* Frameworks */, 261 | 157D46F7206BAABC00A0BC22 /* Resources */, 262 | ); 263 | buildRules = ( 264 | ); 265 | dependencies = ( 266 | 157D46FB206BAABC00A0BC22 /* PBXTargetDependency */, 267 | ); 268 | name = MGWidgetTests; 269 | productName = MGWidgetTests; 270 | productReference = 157D46F9206BAABC00A0BC22 /* MGWidgetTests.xctest */; 271 | productType = "com.apple.product-type.bundle.unit-test"; 272 | }; 273 | 157D4703206BAABC00A0BC22 /* MGWidgetUITests */ = { 274 | isa = PBXNativeTarget; 275 | buildConfigurationList = 157D4713206BAABC00A0BC22 /* Build configuration list for PBXNativeTarget "MGWidgetUITests" */; 276 | buildPhases = ( 277 | 157D4700206BAABC00A0BC22 /* Sources */, 278 | 157D4701206BAABC00A0BC22 /* Frameworks */, 279 | 157D4702206BAABC00A0BC22 /* Resources */, 280 | ); 281 | buildRules = ( 282 | ); 283 | dependencies = ( 284 | 157D4706206BAABC00A0BC22 /* PBXTargetDependency */, 285 | ); 286 | name = MGWidgetUITests; 287 | productName = MGWidgetUITests; 288 | productReference = 157D4704206BAABC00A0BC22 /* MGWidgetUITests.xctest */; 289 | productType = "com.apple.product-type.bundle.ui-testing"; 290 | }; 291 | /* End PBXNativeTarget section */ 292 | 293 | /* Begin PBXProject section */ 294 | 157D46D9206BAABC00A0BC22 /* Project object */ = { 295 | isa = PBXProject; 296 | attributes = { 297 | LastUpgradeCheck = 0920; 298 | ORGANIZATIONNAME = acmeway; 299 | TargetAttributes = { 300 | 157D46E0206BAABC00A0BC22 = { 301 | CreatedOnToolsVersion = 9.2; 302 | ProvisioningStyle = Automatic; 303 | }; 304 | 157D46F8206BAABC00A0BC22 = { 305 | CreatedOnToolsVersion = 9.2; 306 | ProvisioningStyle = Automatic; 307 | TestTargetID = 157D46E0206BAABC00A0BC22; 308 | }; 309 | 157D4703206BAABC00A0BC22 = { 310 | CreatedOnToolsVersion = 9.2; 311 | ProvisioningStyle = Automatic; 312 | TestTargetID = 157D46E0206BAABC00A0BC22; 313 | }; 314 | }; 315 | }; 316 | buildConfigurationList = 157D46DC206BAABC00A0BC22 /* Build configuration list for PBXProject "MGWidget" */; 317 | compatibilityVersion = "Xcode 8.0"; 318 | developmentRegion = en; 319 | hasScannedForEncodings = 0; 320 | knownRegions = ( 321 | en, 322 | Base, 323 | ); 324 | mainGroup = 157D46D8206BAABC00A0BC22; 325 | productRefGroup = 157D46E2206BAABC00A0BC22 /* Products */; 326 | projectDirPath = ""; 327 | projectRoot = ""; 328 | targets = ( 329 | 157D46E0206BAABC00A0BC22 /* MGWidget */, 330 | 157D46F8206BAABC00A0BC22 /* MGWidgetTests */, 331 | 157D4703206BAABC00A0BC22 /* MGWidgetUITests */, 332 | ); 333 | }; 334 | /* End PBXProject section */ 335 | 336 | /* Begin PBXResourcesBuildPhase section */ 337 | 157D46DF206BAABC00A0BC22 /* Resources */ = { 338 | isa = PBXResourcesBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | 157D4736206E3BB700A0BC22 /* plus_circle@3x.png in Resources */, 342 | 157D4735206E3BB700A0BC22 /* plus_circle@2x.png in Resources */, 343 | 157D46F1206BAABC00A0BC22 /* LaunchScreen.storyboard in Resources */, 344 | 157D46EE206BAABC00A0BC22 /* Assets.xcassets in Resources */, 345 | 1548D01B20735696006DA610 /* earth.png in Resources */, 346 | 157D46EC206BAABC00A0BC22 /* Main.storyboard in Resources */, 347 | ); 348 | runOnlyForDeploymentPostprocessing = 0; 349 | }; 350 | 157D46F7206BAABC00A0BC22 /* Resources */ = { 351 | isa = PBXResourcesBuildPhase; 352 | buildActionMask = 2147483647; 353 | files = ( 354 | ); 355 | runOnlyForDeploymentPostprocessing = 0; 356 | }; 357 | 157D4702206BAABC00A0BC22 /* Resources */ = { 358 | isa = PBXResourcesBuildPhase; 359 | buildActionMask = 2147483647; 360 | files = ( 361 | ); 362 | runOnlyForDeploymentPostprocessing = 0; 363 | }; 364 | /* End PBXResourcesBuildPhase section */ 365 | 366 | /* Begin PBXSourcesBuildPhase section */ 367 | 157D46DD206BAABC00A0BC22 /* Sources */ = { 368 | isa = PBXSourcesBuildPhase; 369 | buildActionMask = 2147483647; 370 | files = ( 371 | 156C376020888E5F002D9339 /* MGRotaLoadView.m in Sources */, 372 | 15A97BF6207F6AC0006A61AF /* CALayer+Common.m in Sources */, 373 | 1542E10820707DCA000E8330 /* MGPatternView.m in Sources */, 374 | 157D4728206CEAA400A0BC22 /* NSObject+common.m in Sources */, 375 | 157D4722206CCCC000A0BC22 /* MGShowController.m in Sources */, 376 | 1548D01F20737045006DA610 /* NSObject+LoadTool.m in Sources */, 377 | 157D4718206BABBA00A0BC22 /* UIView+Frame.m in Sources */, 378 | 157D46E9206BAABC00A0BC22 /* ViewController.m in Sources */, 379 | 157D46F4206BAABC00A0BC22 /* main.m in Sources */, 380 | 157D46E6206BAABC00A0BC22 /* AppDelegate.m in Sources */, 381 | 157D4725206CD18700A0BC22 /* MGShowView.m in Sources */, 382 | F8778897207E553700DF1559 /* MGChainView.m in Sources */, 383 | 1548D0272075A6AB006DA610 /* MGWorshipView.m in Sources */, 384 | 1548D02220747D7D006DA610 /* MGLoadDotView.m in Sources */, 385 | 157D4732206E0FEF00A0BC22 /* MGLoaderView.m in Sources */, 386 | 15A97BF0207F359A006A61AF /* MGAlterView.m in Sources */, 387 | ); 388 | runOnlyForDeploymentPostprocessing = 0; 389 | }; 390 | 157D46F5206BAABC00A0BC22 /* Sources */ = { 391 | isa = PBXSourcesBuildPhase; 392 | buildActionMask = 2147483647; 393 | files = ( 394 | 157D46FE206BAABC00A0BC22 /* MGWidgetTests.m in Sources */, 395 | ); 396 | runOnlyForDeploymentPostprocessing = 0; 397 | }; 398 | 157D4700206BAABC00A0BC22 /* Sources */ = { 399 | isa = PBXSourcesBuildPhase; 400 | buildActionMask = 2147483647; 401 | files = ( 402 | 157D4709206BAABC00A0BC22 /* MGWidgetUITests.m in Sources */, 403 | ); 404 | runOnlyForDeploymentPostprocessing = 0; 405 | }; 406 | /* End PBXSourcesBuildPhase section */ 407 | 408 | /* Begin PBXTargetDependency section */ 409 | 157D46FB206BAABC00A0BC22 /* PBXTargetDependency */ = { 410 | isa = PBXTargetDependency; 411 | target = 157D46E0206BAABC00A0BC22 /* MGWidget */; 412 | targetProxy = 157D46FA206BAABC00A0BC22 /* PBXContainerItemProxy */; 413 | }; 414 | 157D4706206BAABC00A0BC22 /* PBXTargetDependency */ = { 415 | isa = PBXTargetDependency; 416 | target = 157D46E0206BAABC00A0BC22 /* MGWidget */; 417 | targetProxy = 157D4705206BAABC00A0BC22 /* PBXContainerItemProxy */; 418 | }; 419 | /* End PBXTargetDependency section */ 420 | 421 | /* Begin PBXVariantGroup section */ 422 | 157D46EA206BAABC00A0BC22 /* Main.storyboard */ = { 423 | isa = PBXVariantGroup; 424 | children = ( 425 | 157D46EB206BAABC00A0BC22 /* Base */, 426 | ); 427 | name = Main.storyboard; 428 | sourceTree = ""; 429 | }; 430 | 157D46EF206BAABC00A0BC22 /* LaunchScreen.storyboard */ = { 431 | isa = PBXVariantGroup; 432 | children = ( 433 | 157D46F0206BAABC00A0BC22 /* Base */, 434 | ); 435 | name = LaunchScreen.storyboard; 436 | sourceTree = ""; 437 | }; 438 | /* End PBXVariantGroup section */ 439 | 440 | /* Begin XCBuildConfiguration section */ 441 | 157D470B206BAABC00A0BC22 /* Debug */ = { 442 | isa = XCBuildConfiguration; 443 | buildSettings = { 444 | ALWAYS_SEARCH_USER_PATHS = NO; 445 | CLANG_ANALYZER_NONNULL = YES; 446 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 447 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 448 | CLANG_CXX_LIBRARY = "libc++"; 449 | CLANG_ENABLE_MODULES = YES; 450 | CLANG_ENABLE_OBJC_ARC = YES; 451 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 452 | CLANG_WARN_BOOL_CONVERSION = YES; 453 | CLANG_WARN_COMMA = YES; 454 | CLANG_WARN_CONSTANT_CONVERSION = YES; 455 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 456 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 457 | CLANG_WARN_EMPTY_BODY = YES; 458 | CLANG_WARN_ENUM_CONVERSION = YES; 459 | CLANG_WARN_INFINITE_RECURSION = YES; 460 | CLANG_WARN_INT_CONVERSION = YES; 461 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 462 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 463 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 464 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 465 | CLANG_WARN_STRICT_PROTOTYPES = YES; 466 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 467 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 468 | CLANG_WARN_UNREACHABLE_CODE = YES; 469 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 470 | CODE_SIGN_IDENTITY = "iPhone Developer"; 471 | COPY_PHASE_STRIP = NO; 472 | DEBUG_INFORMATION_FORMAT = dwarf; 473 | ENABLE_STRICT_OBJC_MSGSEND = YES; 474 | ENABLE_TESTABILITY = YES; 475 | GCC_C_LANGUAGE_STANDARD = gnu11; 476 | GCC_DYNAMIC_NO_PIC = NO; 477 | GCC_NO_COMMON_BLOCKS = YES; 478 | GCC_OPTIMIZATION_LEVEL = 0; 479 | GCC_PREPROCESSOR_DEFINITIONS = ( 480 | "DEBUG=1", 481 | "$(inherited)", 482 | ); 483 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 484 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 485 | GCC_WARN_UNDECLARED_SELECTOR = YES; 486 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 487 | GCC_WARN_UNUSED_FUNCTION = YES; 488 | GCC_WARN_UNUSED_VARIABLE = YES; 489 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 490 | MTL_ENABLE_DEBUG_INFO = YES; 491 | ONLY_ACTIVE_ARCH = YES; 492 | SDKROOT = iphoneos; 493 | }; 494 | name = Debug; 495 | }; 496 | 157D470C206BAABC00A0BC22 /* Release */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | ALWAYS_SEARCH_USER_PATHS = NO; 500 | CLANG_ANALYZER_NONNULL = YES; 501 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 502 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 503 | CLANG_CXX_LIBRARY = "libc++"; 504 | CLANG_ENABLE_MODULES = YES; 505 | CLANG_ENABLE_OBJC_ARC = YES; 506 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 507 | CLANG_WARN_BOOL_CONVERSION = YES; 508 | CLANG_WARN_COMMA = YES; 509 | CLANG_WARN_CONSTANT_CONVERSION = YES; 510 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 511 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 512 | CLANG_WARN_EMPTY_BODY = YES; 513 | CLANG_WARN_ENUM_CONVERSION = YES; 514 | CLANG_WARN_INFINITE_RECURSION = YES; 515 | CLANG_WARN_INT_CONVERSION = YES; 516 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 517 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 518 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 519 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 520 | CLANG_WARN_STRICT_PROTOTYPES = YES; 521 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 522 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 523 | CLANG_WARN_UNREACHABLE_CODE = YES; 524 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 525 | CODE_SIGN_IDENTITY = "iPhone Developer"; 526 | COPY_PHASE_STRIP = NO; 527 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 528 | ENABLE_NS_ASSERTIONS = NO; 529 | ENABLE_STRICT_OBJC_MSGSEND = YES; 530 | GCC_C_LANGUAGE_STANDARD = gnu11; 531 | GCC_NO_COMMON_BLOCKS = YES; 532 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 533 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 534 | GCC_WARN_UNDECLARED_SELECTOR = YES; 535 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 536 | GCC_WARN_UNUSED_FUNCTION = YES; 537 | GCC_WARN_UNUSED_VARIABLE = YES; 538 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 539 | MTL_ENABLE_DEBUG_INFO = NO; 540 | SDKROOT = iphoneos; 541 | VALIDATE_PRODUCT = YES; 542 | }; 543 | name = Release; 544 | }; 545 | 157D470E206BAABC00A0BC22 /* Debug */ = { 546 | isa = XCBuildConfiguration; 547 | buildSettings = { 548 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 549 | CODE_SIGN_STYLE = Automatic; 550 | DEVELOPMENT_TEAM = S354XQCX43; 551 | GCC_PREFIX_HEADER = "$(SRCROOT)/MGWidget/PrefixHeader.pch"; 552 | INFOPLIST_FILE = MGWidget/Info.plist; 553 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 554 | PRODUCT_BUNDLE_IDENTIFIER = com.ACMEWAY.MGWidget; 555 | PRODUCT_NAME = "$(TARGET_NAME)"; 556 | TARGETED_DEVICE_FAMILY = "1,2"; 557 | }; 558 | name = Debug; 559 | }; 560 | 157D470F206BAABC00A0BC22 /* Release */ = { 561 | isa = XCBuildConfiguration; 562 | buildSettings = { 563 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 564 | CODE_SIGN_STYLE = Automatic; 565 | DEVELOPMENT_TEAM = S354XQCX43; 566 | GCC_PREFIX_HEADER = "$(SRCROOT)/MGWidget/PrefixHeader.pch"; 567 | INFOPLIST_FILE = MGWidget/Info.plist; 568 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 569 | PRODUCT_BUNDLE_IDENTIFIER = com.ACMEWAY.MGWidget; 570 | PRODUCT_NAME = "$(TARGET_NAME)"; 571 | TARGETED_DEVICE_FAMILY = "1,2"; 572 | }; 573 | name = Release; 574 | }; 575 | 157D4711206BAABC00A0BC22 /* Debug */ = { 576 | isa = XCBuildConfiguration; 577 | buildSettings = { 578 | BUNDLE_LOADER = "$(TEST_HOST)"; 579 | CODE_SIGN_STYLE = Automatic; 580 | DEVELOPMENT_TEAM = S354XQCX43; 581 | INFOPLIST_FILE = MGWidgetTests/Info.plist; 582 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 583 | PRODUCT_BUNDLE_IDENTIFIER = com.ACMEWAY.MGWidgetTests; 584 | PRODUCT_NAME = "$(TARGET_NAME)"; 585 | TARGETED_DEVICE_FAMILY = "1,2"; 586 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MGWidget.app/MGWidget"; 587 | }; 588 | name = Debug; 589 | }; 590 | 157D4712206BAABC00A0BC22 /* Release */ = { 591 | isa = XCBuildConfiguration; 592 | buildSettings = { 593 | BUNDLE_LOADER = "$(TEST_HOST)"; 594 | CODE_SIGN_STYLE = Automatic; 595 | DEVELOPMENT_TEAM = S354XQCX43; 596 | INFOPLIST_FILE = MGWidgetTests/Info.plist; 597 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 598 | PRODUCT_BUNDLE_IDENTIFIER = com.ACMEWAY.MGWidgetTests; 599 | PRODUCT_NAME = "$(TARGET_NAME)"; 600 | TARGETED_DEVICE_FAMILY = "1,2"; 601 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MGWidget.app/MGWidget"; 602 | }; 603 | name = Release; 604 | }; 605 | 157D4714206BAABC00A0BC22 /* Debug */ = { 606 | isa = XCBuildConfiguration; 607 | buildSettings = { 608 | CODE_SIGN_STYLE = Automatic; 609 | DEVELOPMENT_TEAM = S354XQCX43; 610 | INFOPLIST_FILE = MGWidgetUITests/Info.plist; 611 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 612 | PRODUCT_BUNDLE_IDENTIFIER = com.ACMEWAY.MGWidgetUITests; 613 | PRODUCT_NAME = "$(TARGET_NAME)"; 614 | TARGETED_DEVICE_FAMILY = "1,2"; 615 | TEST_TARGET_NAME = MGWidget; 616 | }; 617 | name = Debug; 618 | }; 619 | 157D4715206BAABC00A0BC22 /* Release */ = { 620 | isa = XCBuildConfiguration; 621 | buildSettings = { 622 | CODE_SIGN_STYLE = Automatic; 623 | DEVELOPMENT_TEAM = S354XQCX43; 624 | INFOPLIST_FILE = MGWidgetUITests/Info.plist; 625 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 626 | PRODUCT_BUNDLE_IDENTIFIER = com.ACMEWAY.MGWidgetUITests; 627 | PRODUCT_NAME = "$(TARGET_NAME)"; 628 | TARGETED_DEVICE_FAMILY = "1,2"; 629 | TEST_TARGET_NAME = MGWidget; 630 | }; 631 | name = Release; 632 | }; 633 | /* End XCBuildConfiguration section */ 634 | 635 | /* Begin XCConfigurationList section */ 636 | 157D46DC206BAABC00A0BC22 /* Build configuration list for PBXProject "MGWidget" */ = { 637 | isa = XCConfigurationList; 638 | buildConfigurations = ( 639 | 157D470B206BAABC00A0BC22 /* Debug */, 640 | 157D470C206BAABC00A0BC22 /* Release */, 641 | ); 642 | defaultConfigurationIsVisible = 0; 643 | defaultConfigurationName = Release; 644 | }; 645 | 157D470D206BAABC00A0BC22 /* Build configuration list for PBXNativeTarget "MGWidget" */ = { 646 | isa = XCConfigurationList; 647 | buildConfigurations = ( 648 | 157D470E206BAABC00A0BC22 /* Debug */, 649 | 157D470F206BAABC00A0BC22 /* Release */, 650 | ); 651 | defaultConfigurationIsVisible = 0; 652 | defaultConfigurationName = Release; 653 | }; 654 | 157D4710206BAABC00A0BC22 /* Build configuration list for PBXNativeTarget "MGWidgetTests" */ = { 655 | isa = XCConfigurationList; 656 | buildConfigurations = ( 657 | 157D4711206BAABC00A0BC22 /* Debug */, 658 | 157D4712206BAABC00A0BC22 /* Release */, 659 | ); 660 | defaultConfigurationIsVisible = 0; 661 | defaultConfigurationName = Release; 662 | }; 663 | 157D4713206BAABC00A0BC22 /* Build configuration list for PBXNativeTarget "MGWidgetUITests" */ = { 664 | isa = XCConfigurationList; 665 | buildConfigurations = ( 666 | 157D4714206BAABC00A0BC22 /* Debug */, 667 | 157D4715206BAABC00A0BC22 /* Release */, 668 | ); 669 | defaultConfigurationIsVisible = 0; 670 | defaultConfigurationName = Release; 671 | }; 672 | /* End XCConfigurationList section */ 673 | }; 674 | rootObject = 157D46D9206BAABC00A0BC22 /* Project object */; 675 | } 676 | --------------------------------------------------------------------------------