├── Screenshots
├── screenshot.gif
└── 273069_189_13551417508560c372cf84c15b0f4.jpg
├── UUColorSwitch
├── Images.xcassets
│ ├── btn_next.imageset
│ │ ├── next.png
│ │ └── Contents.json
│ ├── img_users1.imageset
│ │ ├── users1.png
│ │ └── Contents.json
│ ├── img_users2.imageset
│ │ ├── users2.png
│ │ └── Contents.json
│ ├── img_phone_off.imageset
│ │ ├── phone_off.png
│ │ └── Contents.json
│ ├── img_phone_on.imageset
│ │ ├── phone_on.png
│ │ └── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── ViewController.h
├── ColorSwitch
│ ├── UUColorSwitch.h
│ └── UUColorSwitch.m
├── AppDelegate.h
├── main.m
├── Info.plist
├── AppDelegate.m
├── ViewController.m
└── Base.lproj
│ ├── LaunchScreen.xib
│ └── Main.storyboard
├── UUColorSwitch.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── zhangyu.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── UUColorSwitch.xccheckout
├── xcuserdata
│ └── zhangyu.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── UUColorSwitch.xcscheme
└── project.pbxproj
├── README.md
└── UUColorSwitchTests
├── Info.plist
└── UUColorSwitchTests.m
/Screenshots/screenshot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangyu9050/UUColorSwitch/HEAD/Screenshots/screenshot.gif
--------------------------------------------------------------------------------
/Screenshots/273069_189_13551417508560c372cf84c15b0f4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangyu9050/UUColorSwitch/HEAD/Screenshots/273069_189_13551417508560c372cf84c15b0f4.jpg
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/btn_next.imageset/next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangyu9050/UUColorSwitch/HEAD/UUColorSwitch/Images.xcassets/btn_next.imageset/next.png
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/img_users1.imageset/users1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangyu9050/UUColorSwitch/HEAD/UUColorSwitch/Images.xcassets/img_users1.imageset/users1.png
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/img_users2.imageset/users2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangyu9050/UUColorSwitch/HEAD/UUColorSwitch/Images.xcassets/img_users2.imageset/users2.png
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/img_phone_off.imageset/phone_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangyu9050/UUColorSwitch/HEAD/UUColorSwitch/Images.xcassets/img_phone_off.imageset/phone_off.png
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/img_phone_on.imageset/phone_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangyu9050/UUColorSwitch/HEAD/UUColorSwitch/Images.xcassets/img_phone_on.imageset/phone_on.png
--------------------------------------------------------------------------------
/UUColorSwitch.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UUColorSwitch
2 |
3 | # Screenshot
4 |
5 | 
6 |
7 |
8 | # User
9 |
10 | _buleSwitch.completion = ^(BOOL isFinish){
11 |
12 | //TODO:
13 | };
14 |
--------------------------------------------------------------------------------
/UUColorSwitch.xcodeproj/project.xcworkspace/xcuserdata/zhangyu.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangyu9050/UUColorSwitch/HEAD/UUColorSwitch.xcodeproj/project.xcworkspace/xcuserdata/zhangyu.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/UUColorSwitch/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // UUColorSwitch
4 | //
5 | // Created by zhangyu on 15/7/20.
6 | // Copyright (c) 2015年 zhangyu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/UUColorSwitch/ColorSwitch/UUColorSwitch.h:
--------------------------------------------------------------------------------
1 | //
2 | // UUColorSwitch.h
3 | // UUColorSwitch
4 | //
5 | // Created by zhangyu on 15/7/20.
6 | // Copyright (c) 2015年 zhangyu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UUColorSwitch : UISwitch
12 |
13 | @property (nonatomic, copy) void (^completion)(BOOL isFinish);
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/UUColorSwitch/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // UUColorSwitch
4 | //
5 | // Created by zhangyu on 15/7/20.
6 | // Copyright (c) 2015年 zhangyu. 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 |
--------------------------------------------------------------------------------
/UUColorSwitch/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // UUColorSwitch
4 | //
5 | // Created by zhangyu on 15/7/20.
6 | // Copyright (c) 2015年 zhangyu. 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 |
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/btn_next.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "next.png"
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 | }
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/img_users1.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "users1.png"
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 | }
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/img_users2.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "users2.png"
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 | }
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/img_phone_off.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "phone_off.png"
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 | }
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/img_phone_on.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x",
6 | "filename" : "phone_on.png"
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 | }
--------------------------------------------------------------------------------
/UUColorSwitch.xcodeproj/xcuserdata/zhangyu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/UUColorSwitch.xcodeproj/xcuserdata/zhangyu.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | UUColorSwitch.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 2A9169C81B5C0D350076A0AC
16 |
17 | primary
18 |
19 |
20 | 2A9169E11B5C0D350076A0AC
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/UUColorSwitch/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/UUColorSwitchTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.debug.demo.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/UUColorSwitchTests/UUColorSwitchTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // UUColorSwitchTests.m
3 | // UUColorSwitchTests
4 | //
5 | // Created by zhangyu on 15/7/20.
6 | // Copyright (c) 2015年 zhangyu. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface UUColorSwitchTests : XCTestCase
13 |
14 | @end
15 |
16 | @implementation UUColorSwitchTests
17 |
18 | - (void)setUp {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testExample {
29 | // This is an example of a functional test case.
30 | XCTAssert(YES, @"Pass");
31 | }
32 |
33 | - (void)testPerformanceExample {
34 | // This is an example of a performance test case.
35 | [self measureBlock:^{
36 | // Put the code you want to measure the time of here.
37 | }];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/UUColorSwitch/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.debug.demo.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/UUColorSwitch.xcodeproj/project.xcworkspace/xcshareddata/UUColorSwitch.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 95A61F4F-DE29-4147-ADEA-18F2A3FEBDDB
9 | IDESourceControlProjectName
10 | UUColorSwitch
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 6B82D4063ADB83F30DFE8F96B036C7D6068B64C7
14 | https://github.com/zhangyu9050/UUColorSwitch.git
15 |
16 | IDESourceControlProjectPath
17 | UUColorSwitch.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 6B82D4063ADB83F30DFE8F96B036C7D6068B64C7
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/zhangyu9050/UUColorSwitch.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | 6B82D4063ADB83F30DFE8F96B036C7D6068B64C7
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 6B82D4063ADB83F30DFE8F96B036C7D6068B64C7
36 | IDESourceControlWCCName
37 | UUColorSwitch
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/UUColorSwitch/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // UUColorSwitch
4 | //
5 | // Created by zhangyu on 15/7/20.
6 | // Copyright (c) 2015年 zhangyu. 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 | - (void)applicationWillResignActive:(UIApplication *)application {
24 | // 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.
25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26 | }
27 |
28 | - (void)applicationDidEnterBackground:(UIApplication *)application {
29 | // 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.
30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
31 | }
32 |
33 | - (void)applicationWillEnterForeground:(UIApplication *)application {
34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
35 | }
36 |
37 | - (void)applicationDidBecomeActive:(UIApplication *)application {
38 | // 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.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application {
42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/UUColorSwitch/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // UUColorSwitch
4 | //
5 | // Created by zhangyu on 15/7/20.
6 | // Copyright (c) 2015年 zhangyu. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "UUColorSwitch.h"
11 |
12 | @interface ViewController ()
13 |
14 | @property (nonatomic, strong) IBOutlet UILabel *lblBule;
15 | @property (nonatomic, strong) IBOutlet UIImageView *buleImageView;
16 | @property (nonatomic, strong) IBOutlet UUColorSwitch *buleSwitch;
17 |
18 | @property (nonatomic, strong) IBOutlet UILabel *lblGreen;
19 | @property (nonatomic, strong) IBOutlet UIImageView *greenImageView;
20 | @property (nonatomic, strong) IBOutlet UUColorSwitch *greenSwitch;
21 |
22 |
23 |
24 | @end
25 |
26 | @implementation ViewController
27 |
28 | - (void)viewDidLoad {
29 | [super viewDidLoad];
30 | // Do any additional setup after loading the view, typically from a nib.
31 |
32 | [self configSwitch];
33 | }
34 |
35 | - (void)didReceiveMemoryWarning {
36 | [super didReceiveMemoryWarning];
37 | // Dispose of any resources that can be recreated.
38 | }
39 |
40 | - (void)configSwitch{
41 |
42 | __weak ViewController *weakSelf = self;
43 | _buleSwitch.completion = ^(BOOL isFinish){
44 |
45 | [weakSelf animateLabel:weakSelf.lblBule duration:.35f onAnimation:isFinish];
46 | [weakSelf animateImage:weakSelf.buleImageView duration:.35f onAnimation:isFinish];
47 | };
48 |
49 | _greenSwitch.completion = ^(BOOL isFinish){
50 |
51 | [weakSelf animateLabel:weakSelf.lblGreen duration:.35f onAnimation:isFinish];
52 | [weakSelf animateImage:weakSelf.greenImageView duration:.35f onAnimation:isFinish];
53 | };
54 |
55 | }
56 |
57 | - (void)animateLabel:(UILabel *)label duration:(NSTimeInterval )duration onAnimation:(BOOL )onAnimation{
58 |
59 | [UIView transitionWithView:label
60 | duration:duration
61 | options:UIViewAnimationOptionTransitionCrossDissolve
62 | animations:^{
63 |
64 | UIColor *color = !onAnimation ? [UIColor colorWithRed:81/255.0 green:155/255.0 blue:249/255.0 alpha:1] : [UIColor whiteColor];
65 | [label setTextColor:color];
66 | }
67 | completion:nil];
68 | }
69 |
70 | - (void)animateImage:(UIImageView *)imageView duration:(NSTimeInterval )duration onAnimation:(BOOL )onAnimation{
71 |
72 | [UIView transitionWithView:imageView
73 | duration:duration
74 | options:UIViewAnimationOptionTransitionCrossDissolve
75 | animations:^{
76 |
77 | imageView.image = [UIImage imageNamed:onAnimation ? @"img_phone_on" : @"img_phone_off"];
78 | }
79 | completion:nil];
80 | }
81 |
82 | @end
83 |
--------------------------------------------------------------------------------
/UUColorSwitch/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/UUColorSwitch.xcodeproj/xcuserdata/zhangyu.xcuserdatad/xcschemes/UUColorSwitch.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
77 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/UUColorSwitch/ColorSwitch/UUColorSwitch.m:
--------------------------------------------------------------------------------
1 | //
2 | // UUColorSwitch.m
3 | // UUColorSwitch
4 | //
5 | // Created by zhangyu on 15/7/20.
6 | // Copyright (c) 2015年 zhangyu. All rights reserved.
7 | //
8 |
9 | #import "UUColorSwitch.h"
10 |
11 | @interface UUColorSwitch()
12 |
13 | @property (nonatomic, strong) CAShapeLayer *shapeCircle;
14 |
15 | @property (nonatomic, assign) CGFloat radius;
16 |
17 | @end
18 |
19 | @implementation UUColorSwitch
20 |
21 | - (void)layoutSubviews {
22 |
23 | //计算坐标点到原点距离
24 | CGFloat x = MAX(CGRectGetMidX(self.frame), self.superview.frame.size.width - CGRectGetMidX(self.frame));
25 | CGFloat y = MAX(CGRectGetMidY(self.frame), self.superview.frame.size.height - CGRectGetMidY(self.frame));
26 | self.radius = sqrt(x * x + y * y);
27 |
28 | _shapeCircle.frame = CGRectMake(CGRectGetMidX(self.frame) - self.radius,
29 | CGRectGetMidY(self.frame) - self.radius,
30 | self.radius * 2,
31 | self.radius * 2);
32 |
33 | _shapeCircle.anchorPoint = CGPointMake(0.5, 0.5);
34 | _shapeCircle.path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0,
35 | 0,
36 | self.radius * 2,
37 | self.radius * 2)].CGPath;
38 | }
39 |
40 | - (void)didMoveToSuperview {
41 |
42 | [self.superview setClipsToBounds:YES];
43 |
44 | _shapeCircle = [CAShapeLayer layer];
45 | _shapeCircle.fillColor = self.onTintColor.CGColor;
46 | _shapeCircle.transform = CATransform3DMakeScale(0.0001, 0.0001, 0.0001);
47 | [self.superview.layer insertSublayer:_shapeCircle atIndex:0];
48 |
49 | self.layer.borderColor = [UIColor whiteColor].CGColor;
50 | self.layer.cornerRadius = self.frame.size.height / 2;
51 |
52 | if (self.superview) [self addObserver:self forKeyPath:@"on" options:(NSKeyValueObservingOptionNew) context:nil];
53 |
54 | [self addTarget:self action:@selector(switchChanged:) forControlEvents:UIControlEventValueChanged];
55 | }
56 |
57 | #pragma mark - Event Action
58 |
59 | - (void)switchChanged:(UISwitch *)sender {
60 |
61 | if (sender.on) {
62 | [CATransaction begin];
63 |
64 |
65 | // Reset
66 | [_shapeCircle removeAnimationForKey:@"scaleDown"];
67 | [_shapeCircle removeAnimationForKey:@"borderDown"];
68 | self.layer.borderWidth = 0;
69 |
70 | CABasicAnimation *scaleAnimation = [self animateKeyPath:@"transform.scale"
71 | fromValue:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0001, 0.0001, 0.0001)]
72 | toValue:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]
73 | timing:kCAMediaTimingFunctionEaseIn];
74 | [_shapeCircle addAnimation:scaleAnimation forKey:@"scaleUp"];
75 |
76 | CABasicAnimation *borderAnimation = [self animateKeyPath:@"borderWidth"
77 | fromValue:@0
78 | toValue:@1
79 | timing:kCAMediaTimingFunctionEaseIn];
80 |
81 | [self.layer addAnimation:borderAnimation forKey:@"borderUp"];
82 |
83 | if (self.completion) self.completion(YES);
84 | [CATransaction commit];
85 |
86 | } else {
87 |
88 | [CATransaction begin];
89 |
90 |
91 | // Reset
92 | [_shapeCircle removeAnimationForKey:@"scaleUp"];
93 | [_shapeCircle removeAnimationForKey:@"borderUp"];
94 | self.layer.borderWidth = 1;
95 |
96 | CABasicAnimation *scaleAnimation = [self animateKeyPath:@"transform.scale"
97 | fromValue:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]
98 | toValue:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0001, 0.0001, 0.0001)]
99 | timing:kCAMediaTimingFunctionEaseOut];
100 |
101 | [_shapeCircle addAnimation:scaleAnimation forKey:@"scaleDown"];
102 |
103 | CABasicAnimation *borderAnimation = [self animateKeyPath:@"borderWidth"
104 | fromValue:@1
105 | toValue:@0
106 | timing:kCAMediaTimingFunctionEaseOut];
107 |
108 | [self.layer addAnimation:borderAnimation forKey:@"borderDown"];
109 |
110 | if (self.completion) self.completion(NO);
111 | [CATransaction commit];
112 |
113 | }
114 | }
115 |
116 | - (void)setOn:(BOOL)on animated:(BOOL)animated {
117 |
118 | [super setOn:on animated:animated];
119 | [self switchChanged:self];
120 | }
121 |
122 | #pragma mark - Observe
123 |
124 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
125 |
126 | [self switchChanged:self];
127 | }
128 |
129 | #pragma mark - Private
130 |
131 | - (CABasicAnimation *)animateKeyPath:(NSString *)keyPath fromValue:(id)from toValue:(id)to timing:(NSString *)timing {
132 |
133 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:keyPath];
134 | animation.fromValue = from;
135 | animation.toValue = to;
136 | animation.repeatCount = 1;
137 | animation.timingFunction = [CAMediaTimingFunction functionWithName:timing];
138 | animation.removedOnCompletion = NO;
139 | animation.fillMode = kCAFillModeForwards;
140 | animation.duration = .35f;
141 | return animation;
142 | }
143 |
144 |
145 | - (void)dealloc {
146 |
147 | [self removeObserver:self forKeyPath:@"on"];
148 | }
149 |
150 | @end
151 |
--------------------------------------------------------------------------------
/UUColorSwitch.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 2A9169CF1B5C0D350076A0AC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A9169CE1B5C0D350076A0AC /* main.m */; };
11 | 2A9169D21B5C0D350076A0AC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A9169D11B5C0D350076A0AC /* AppDelegate.m */; };
12 | 2A9169D51B5C0D350076A0AC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A9169D41B5C0D350076A0AC /* ViewController.m */; };
13 | 2A9169D81B5C0D350076A0AC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2A9169D61B5C0D350076A0AC /* Main.storyboard */; };
14 | 2A9169DA1B5C0D350076A0AC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2A9169D91B5C0D350076A0AC /* Images.xcassets */; };
15 | 2A9169DD1B5C0D350076A0AC /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2A9169DB1B5C0D350076A0AC /* LaunchScreen.xib */; };
16 | 2A9169E91B5C0D350076A0AC /* UUColorSwitchTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A9169E81B5C0D350076A0AC /* UUColorSwitchTests.m */; };
17 | 2A9169F51B5C0DFF0076A0AC /* UUColorSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A9169F41B5C0DFF0076A0AC /* UUColorSwitch.m */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | 2A9169E31B5C0D350076A0AC /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = 2A9169C11B5C0D350076A0AC /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = 2A9169C81B5C0D350076A0AC;
26 | remoteInfo = UUColorSwitch;
27 | };
28 | /* End PBXContainerItemProxy section */
29 |
30 | /* Begin PBXFileReference section */
31 | 2A9169C91B5C0D350076A0AC /* UUColorSwitch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UUColorSwitch.app; sourceTree = BUILT_PRODUCTS_DIR; };
32 | 2A9169CD1B5C0D350076A0AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
33 | 2A9169CE1B5C0D350076A0AC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
34 | 2A9169D01B5C0D350076A0AC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
35 | 2A9169D11B5C0D350076A0AC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
36 | 2A9169D31B5C0D350076A0AC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
37 | 2A9169D41B5C0D350076A0AC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
38 | 2A9169D71B5C0D350076A0AC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
39 | 2A9169D91B5C0D350076A0AC /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
40 | 2A9169DC1B5C0D350076A0AC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
41 | 2A9169E21B5C0D350076A0AC /* UUColorSwitchTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UUColorSwitchTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
42 | 2A9169E71B5C0D350076A0AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
43 | 2A9169E81B5C0D350076A0AC /* UUColorSwitchTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UUColorSwitchTests.m; sourceTree = ""; };
44 | 2A9169F31B5C0DFF0076A0AC /* UUColorSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UUColorSwitch.h; sourceTree = ""; };
45 | 2A9169F41B5C0DFF0076A0AC /* UUColorSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UUColorSwitch.m; sourceTree = ""; };
46 | /* End PBXFileReference section */
47 |
48 | /* Begin PBXFrameworksBuildPhase section */
49 | 2A9169C61B5C0D350076A0AC /* Frameworks */ = {
50 | isa = PBXFrameworksBuildPhase;
51 | buildActionMask = 2147483647;
52 | files = (
53 | );
54 | runOnlyForDeploymentPostprocessing = 0;
55 | };
56 | 2A9169DF1B5C0D350076A0AC /* Frameworks */ = {
57 | isa = PBXFrameworksBuildPhase;
58 | buildActionMask = 2147483647;
59 | files = (
60 | );
61 | runOnlyForDeploymentPostprocessing = 0;
62 | };
63 | /* End PBXFrameworksBuildPhase section */
64 |
65 | /* Begin PBXGroup section */
66 | 2A9169C01B5C0D350076A0AC = {
67 | isa = PBXGroup;
68 | children = (
69 | 2A9169CB1B5C0D350076A0AC /* UUColorSwitch */,
70 | 2A9169E51B5C0D350076A0AC /* UUColorSwitchTests */,
71 | 2A9169CA1B5C0D350076A0AC /* Products */,
72 | );
73 | sourceTree = "";
74 | };
75 | 2A9169CA1B5C0D350076A0AC /* Products */ = {
76 | isa = PBXGroup;
77 | children = (
78 | 2A9169C91B5C0D350076A0AC /* UUColorSwitch.app */,
79 | 2A9169E21B5C0D350076A0AC /* UUColorSwitchTests.xctest */,
80 | );
81 | name = Products;
82 | sourceTree = "";
83 | };
84 | 2A9169CB1B5C0D350076A0AC /* UUColorSwitch */ = {
85 | isa = PBXGroup;
86 | children = (
87 | 2A9169F21B5C0DE50076A0AC /* ColorSwitch */,
88 | 2A9169D01B5C0D350076A0AC /* AppDelegate.h */,
89 | 2A9169D11B5C0D350076A0AC /* AppDelegate.m */,
90 | 2A9169D31B5C0D350076A0AC /* ViewController.h */,
91 | 2A9169D41B5C0D350076A0AC /* ViewController.m */,
92 | 2A9169D61B5C0D350076A0AC /* Main.storyboard */,
93 | 2A9169D91B5C0D350076A0AC /* Images.xcassets */,
94 | 2A9169DB1B5C0D350076A0AC /* LaunchScreen.xib */,
95 | 2A9169CC1B5C0D350076A0AC /* Supporting Files */,
96 | );
97 | path = UUColorSwitch;
98 | sourceTree = "";
99 | };
100 | 2A9169CC1B5C0D350076A0AC /* Supporting Files */ = {
101 | isa = PBXGroup;
102 | children = (
103 | 2A9169CD1B5C0D350076A0AC /* Info.plist */,
104 | 2A9169CE1B5C0D350076A0AC /* main.m */,
105 | );
106 | name = "Supporting Files";
107 | sourceTree = "";
108 | };
109 | 2A9169E51B5C0D350076A0AC /* UUColorSwitchTests */ = {
110 | isa = PBXGroup;
111 | children = (
112 | 2A9169E81B5C0D350076A0AC /* UUColorSwitchTests.m */,
113 | 2A9169E61B5C0D350076A0AC /* Supporting Files */,
114 | );
115 | path = UUColorSwitchTests;
116 | sourceTree = "";
117 | };
118 | 2A9169E61B5C0D350076A0AC /* Supporting Files */ = {
119 | isa = PBXGroup;
120 | children = (
121 | 2A9169E71B5C0D350076A0AC /* Info.plist */,
122 | );
123 | name = "Supporting Files";
124 | sourceTree = "";
125 | };
126 | 2A9169F21B5C0DE50076A0AC /* ColorSwitch */ = {
127 | isa = PBXGroup;
128 | children = (
129 | 2A9169F31B5C0DFF0076A0AC /* UUColorSwitch.h */,
130 | 2A9169F41B5C0DFF0076A0AC /* UUColorSwitch.m */,
131 | );
132 | path = ColorSwitch;
133 | sourceTree = "";
134 | };
135 | /* End PBXGroup section */
136 |
137 | /* Begin PBXNativeTarget section */
138 | 2A9169C81B5C0D350076A0AC /* UUColorSwitch */ = {
139 | isa = PBXNativeTarget;
140 | buildConfigurationList = 2A9169EC1B5C0D350076A0AC /* Build configuration list for PBXNativeTarget "UUColorSwitch" */;
141 | buildPhases = (
142 | 2A9169C51B5C0D350076A0AC /* Sources */,
143 | 2A9169C61B5C0D350076A0AC /* Frameworks */,
144 | 2A9169C71B5C0D350076A0AC /* Resources */,
145 | );
146 | buildRules = (
147 | );
148 | dependencies = (
149 | );
150 | name = UUColorSwitch;
151 | productName = UUColorSwitch;
152 | productReference = 2A9169C91B5C0D350076A0AC /* UUColorSwitch.app */;
153 | productType = "com.apple.product-type.application";
154 | };
155 | 2A9169E11B5C0D350076A0AC /* UUColorSwitchTests */ = {
156 | isa = PBXNativeTarget;
157 | buildConfigurationList = 2A9169EF1B5C0D350076A0AC /* Build configuration list for PBXNativeTarget "UUColorSwitchTests" */;
158 | buildPhases = (
159 | 2A9169DE1B5C0D350076A0AC /* Sources */,
160 | 2A9169DF1B5C0D350076A0AC /* Frameworks */,
161 | 2A9169E01B5C0D350076A0AC /* Resources */,
162 | );
163 | buildRules = (
164 | );
165 | dependencies = (
166 | 2A9169E41B5C0D350076A0AC /* PBXTargetDependency */,
167 | );
168 | name = UUColorSwitchTests;
169 | productName = UUColorSwitchTests;
170 | productReference = 2A9169E21B5C0D350076A0AC /* UUColorSwitchTests.xctest */;
171 | productType = "com.apple.product-type.bundle.unit-test";
172 | };
173 | /* End PBXNativeTarget section */
174 |
175 | /* Begin PBXProject section */
176 | 2A9169C11B5C0D350076A0AC /* Project object */ = {
177 | isa = PBXProject;
178 | attributes = {
179 | LastUpgradeCheck = 0620;
180 | ORGANIZATIONNAME = zhangyu;
181 | TargetAttributes = {
182 | 2A9169C81B5C0D350076A0AC = {
183 | CreatedOnToolsVersion = 6.2;
184 | };
185 | 2A9169E11B5C0D350076A0AC = {
186 | CreatedOnToolsVersion = 6.2;
187 | TestTargetID = 2A9169C81B5C0D350076A0AC;
188 | };
189 | };
190 | };
191 | buildConfigurationList = 2A9169C41B5C0D350076A0AC /* Build configuration list for PBXProject "UUColorSwitch" */;
192 | compatibilityVersion = "Xcode 3.2";
193 | developmentRegion = English;
194 | hasScannedForEncodings = 0;
195 | knownRegions = (
196 | en,
197 | Base,
198 | );
199 | mainGroup = 2A9169C01B5C0D350076A0AC;
200 | productRefGroup = 2A9169CA1B5C0D350076A0AC /* Products */;
201 | projectDirPath = "";
202 | projectRoot = "";
203 | targets = (
204 | 2A9169C81B5C0D350076A0AC /* UUColorSwitch */,
205 | 2A9169E11B5C0D350076A0AC /* UUColorSwitchTests */,
206 | );
207 | };
208 | /* End PBXProject section */
209 |
210 | /* Begin PBXResourcesBuildPhase section */
211 | 2A9169C71B5C0D350076A0AC /* Resources */ = {
212 | isa = PBXResourcesBuildPhase;
213 | buildActionMask = 2147483647;
214 | files = (
215 | 2A9169D81B5C0D350076A0AC /* Main.storyboard in Resources */,
216 | 2A9169DD1B5C0D350076A0AC /* LaunchScreen.xib in Resources */,
217 | 2A9169DA1B5C0D350076A0AC /* Images.xcassets in Resources */,
218 | );
219 | runOnlyForDeploymentPostprocessing = 0;
220 | };
221 | 2A9169E01B5C0D350076A0AC /* Resources */ = {
222 | isa = PBXResourcesBuildPhase;
223 | buildActionMask = 2147483647;
224 | files = (
225 | );
226 | runOnlyForDeploymentPostprocessing = 0;
227 | };
228 | /* End PBXResourcesBuildPhase section */
229 |
230 | /* Begin PBXSourcesBuildPhase section */
231 | 2A9169C51B5C0D350076A0AC /* Sources */ = {
232 | isa = PBXSourcesBuildPhase;
233 | buildActionMask = 2147483647;
234 | files = (
235 | 2A9169D51B5C0D350076A0AC /* ViewController.m in Sources */,
236 | 2A9169F51B5C0DFF0076A0AC /* UUColorSwitch.m in Sources */,
237 | 2A9169D21B5C0D350076A0AC /* AppDelegate.m in Sources */,
238 | 2A9169CF1B5C0D350076A0AC /* main.m in Sources */,
239 | );
240 | runOnlyForDeploymentPostprocessing = 0;
241 | };
242 | 2A9169DE1B5C0D350076A0AC /* Sources */ = {
243 | isa = PBXSourcesBuildPhase;
244 | buildActionMask = 2147483647;
245 | files = (
246 | 2A9169E91B5C0D350076A0AC /* UUColorSwitchTests.m in Sources */,
247 | );
248 | runOnlyForDeploymentPostprocessing = 0;
249 | };
250 | /* End PBXSourcesBuildPhase section */
251 |
252 | /* Begin PBXTargetDependency section */
253 | 2A9169E41B5C0D350076A0AC /* PBXTargetDependency */ = {
254 | isa = PBXTargetDependency;
255 | target = 2A9169C81B5C0D350076A0AC /* UUColorSwitch */;
256 | targetProxy = 2A9169E31B5C0D350076A0AC /* PBXContainerItemProxy */;
257 | };
258 | /* End PBXTargetDependency section */
259 |
260 | /* Begin PBXVariantGroup section */
261 | 2A9169D61B5C0D350076A0AC /* Main.storyboard */ = {
262 | isa = PBXVariantGroup;
263 | children = (
264 | 2A9169D71B5C0D350076A0AC /* Base */,
265 | );
266 | name = Main.storyboard;
267 | sourceTree = "";
268 | };
269 | 2A9169DB1B5C0D350076A0AC /* LaunchScreen.xib */ = {
270 | isa = PBXVariantGroup;
271 | children = (
272 | 2A9169DC1B5C0D350076A0AC /* Base */,
273 | );
274 | name = LaunchScreen.xib;
275 | sourceTree = "";
276 | };
277 | /* End PBXVariantGroup section */
278 |
279 | /* Begin XCBuildConfiguration section */
280 | 2A9169EA1B5C0D350076A0AC /* Debug */ = {
281 | isa = XCBuildConfiguration;
282 | buildSettings = {
283 | ALWAYS_SEARCH_USER_PATHS = NO;
284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
285 | CLANG_CXX_LIBRARY = "libc++";
286 | CLANG_ENABLE_MODULES = YES;
287 | CLANG_ENABLE_OBJC_ARC = YES;
288 | CLANG_WARN_BOOL_CONVERSION = YES;
289 | CLANG_WARN_CONSTANT_CONVERSION = YES;
290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
291 | CLANG_WARN_EMPTY_BODY = YES;
292 | CLANG_WARN_ENUM_CONVERSION = YES;
293 | CLANG_WARN_INT_CONVERSION = YES;
294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
295 | CLANG_WARN_UNREACHABLE_CODE = YES;
296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
297 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
298 | COPY_PHASE_STRIP = NO;
299 | ENABLE_STRICT_OBJC_MSGSEND = YES;
300 | GCC_C_LANGUAGE_STANDARD = gnu99;
301 | GCC_DYNAMIC_NO_PIC = NO;
302 | GCC_OPTIMIZATION_LEVEL = 0;
303 | GCC_PREPROCESSOR_DEFINITIONS = (
304 | "DEBUG=1",
305 | "$(inherited)",
306 | );
307 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
308 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
309 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
310 | GCC_WARN_UNDECLARED_SELECTOR = YES;
311 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
312 | GCC_WARN_UNUSED_FUNCTION = YES;
313 | GCC_WARN_UNUSED_VARIABLE = YES;
314 | IPHONEOS_DEPLOYMENT_TARGET = 8.2;
315 | MTL_ENABLE_DEBUG_INFO = YES;
316 | ONLY_ACTIVE_ARCH = YES;
317 | SDKROOT = iphoneos;
318 | };
319 | name = Debug;
320 | };
321 | 2A9169EB1B5C0D350076A0AC /* Release */ = {
322 | isa = XCBuildConfiguration;
323 | buildSettings = {
324 | ALWAYS_SEARCH_USER_PATHS = NO;
325 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
326 | CLANG_CXX_LIBRARY = "libc++";
327 | CLANG_ENABLE_MODULES = YES;
328 | CLANG_ENABLE_OBJC_ARC = YES;
329 | CLANG_WARN_BOOL_CONVERSION = YES;
330 | CLANG_WARN_CONSTANT_CONVERSION = YES;
331 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
332 | CLANG_WARN_EMPTY_BODY = YES;
333 | CLANG_WARN_ENUM_CONVERSION = YES;
334 | CLANG_WARN_INT_CONVERSION = YES;
335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
336 | CLANG_WARN_UNREACHABLE_CODE = YES;
337 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
338 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
339 | COPY_PHASE_STRIP = NO;
340 | ENABLE_NS_ASSERTIONS = NO;
341 | ENABLE_STRICT_OBJC_MSGSEND = YES;
342 | GCC_C_LANGUAGE_STANDARD = gnu99;
343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
345 | GCC_WARN_UNDECLARED_SELECTOR = YES;
346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
347 | GCC_WARN_UNUSED_FUNCTION = YES;
348 | GCC_WARN_UNUSED_VARIABLE = YES;
349 | IPHONEOS_DEPLOYMENT_TARGET = 8.2;
350 | MTL_ENABLE_DEBUG_INFO = NO;
351 | SDKROOT = iphoneos;
352 | VALIDATE_PRODUCT = YES;
353 | };
354 | name = Release;
355 | };
356 | 2A9169ED1B5C0D350076A0AC /* Debug */ = {
357 | isa = XCBuildConfiguration;
358 | buildSettings = {
359 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
360 | INFOPLIST_FILE = UUColorSwitch/Info.plist;
361 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
362 | PRODUCT_NAME = "$(TARGET_NAME)";
363 | };
364 | name = Debug;
365 | };
366 | 2A9169EE1B5C0D350076A0AC /* Release */ = {
367 | isa = XCBuildConfiguration;
368 | buildSettings = {
369 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
370 | INFOPLIST_FILE = UUColorSwitch/Info.plist;
371 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
372 | PRODUCT_NAME = "$(TARGET_NAME)";
373 | };
374 | name = Release;
375 | };
376 | 2A9169F01B5C0D350076A0AC /* Debug */ = {
377 | isa = XCBuildConfiguration;
378 | buildSettings = {
379 | BUNDLE_LOADER = "$(TEST_HOST)";
380 | FRAMEWORK_SEARCH_PATHS = (
381 | "$(SDKROOT)/Developer/Library/Frameworks",
382 | "$(inherited)",
383 | );
384 | GCC_PREPROCESSOR_DEFINITIONS = (
385 | "DEBUG=1",
386 | "$(inherited)",
387 | );
388 | INFOPLIST_FILE = UUColorSwitchTests/Info.plist;
389 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
390 | PRODUCT_NAME = "$(TARGET_NAME)";
391 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UUColorSwitch.app/UUColorSwitch";
392 | };
393 | name = Debug;
394 | };
395 | 2A9169F11B5C0D350076A0AC /* Release */ = {
396 | isa = XCBuildConfiguration;
397 | buildSettings = {
398 | BUNDLE_LOADER = "$(TEST_HOST)";
399 | FRAMEWORK_SEARCH_PATHS = (
400 | "$(SDKROOT)/Developer/Library/Frameworks",
401 | "$(inherited)",
402 | );
403 | INFOPLIST_FILE = UUColorSwitchTests/Info.plist;
404 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
405 | PRODUCT_NAME = "$(TARGET_NAME)";
406 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UUColorSwitch.app/UUColorSwitch";
407 | };
408 | name = Release;
409 | };
410 | /* End XCBuildConfiguration section */
411 |
412 | /* Begin XCConfigurationList section */
413 | 2A9169C41B5C0D350076A0AC /* Build configuration list for PBXProject "UUColorSwitch" */ = {
414 | isa = XCConfigurationList;
415 | buildConfigurations = (
416 | 2A9169EA1B5C0D350076A0AC /* Debug */,
417 | 2A9169EB1B5C0D350076A0AC /* Release */,
418 | );
419 | defaultConfigurationIsVisible = 0;
420 | defaultConfigurationName = Release;
421 | };
422 | 2A9169EC1B5C0D350076A0AC /* Build configuration list for PBXNativeTarget "UUColorSwitch" */ = {
423 | isa = XCConfigurationList;
424 | buildConfigurations = (
425 | 2A9169ED1B5C0D350076A0AC /* Debug */,
426 | 2A9169EE1B5C0D350076A0AC /* Release */,
427 | );
428 | defaultConfigurationIsVisible = 0;
429 | defaultConfigurationName = Release;
430 | };
431 | 2A9169EF1B5C0D350076A0AC /* Build configuration list for PBXNativeTarget "UUColorSwitchTests" */ = {
432 | isa = XCConfigurationList;
433 | buildConfigurations = (
434 | 2A9169F01B5C0D350076A0AC /* Debug */,
435 | 2A9169F11B5C0D350076A0AC /* Release */,
436 | );
437 | defaultConfigurationIsVisible = 0;
438 | defaultConfigurationName = Release;
439 | };
440 | /* End XCConfigurationList section */
441 | };
442 | rootObject = 2A9169C11B5C0D350076A0AC /* Project object */;
443 | }
444 |
--------------------------------------------------------------------------------
/UUColorSwitch/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 |
33 |
34 |
35 |
36 |
46 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
108 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
--------------------------------------------------------------------------------