├── README.md
├── UIBezierPath与CAShapeLayer.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcuserdata
│ └── woshipm.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── UIBezierPath与CAShapeLayer.xcscheme
└── project.pbxproj
├── UIBezierPath与CAShapeLayer
├── ViewController.h
├── SecondViewController.h
├── AppDelegate.h
├── main.m
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── Base.lproj
│ ├── Main.storyboard
│ └── LaunchScreen.storyboard
├── AppDelegate.m
├── ViewController.m
└── SecondViewController.m
├── Podfile
├── UIBezierPath与CAShapeLayerTests
├── Info.plist
└── UIBezierPath_CAShapeLayerTests.m
└── UIBezierPath与CAShapeLayerUITests
├── Info.plist
└── UIBezierPath_CAShapeLayerUITests.m
/README.md:
--------------------------------------------------------------------------------
1 | # -UIBezierPath
2 | UIBezierPath与CAShapeLayer画图,画简单的哆啦A梦
3 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // UIBezierPath与CAShapeLayer
4 | //
5 | // Created by WOSHIPM on 17/1/5.
6 | // Copyright © 2017年 WOSHIPM. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/SecondViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SecondViewController.h
3 | // UIBezierPath与CAShapeLayer
4 | //
5 | // Created by WOSHIPM on 2017/3/17.
6 | // Copyright © 2017年 WOSHIPM. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SecondViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // UIBezierPath与CAShapeLayer
4 | //
5 | // Created by WOSHIPM on 17/1/5.
6 | // Copyright © 2017年 WOSHIPM. 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 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // UIBezierPath与CAShapeLayer
4 | //
5 | // Created by WOSHIPM on 17/1/5.
6 | // Copyright © 2017年 WOSHIPM. 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 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | target 'UIBezierPath与CAShapeLayer' do
5 | # Uncomment this line if you're using Swift or would like to use dynamic frameworks
6 | # use_frameworks!
7 |
8 | # Pods for UIBezierPath与CAShapeLayer
9 |
10 | target 'UIBezierPath与CAShapeLayerTests' do
11 | inherit! :search_paths
12 | # Pods for testing
13 | end
14 |
15 | target 'UIBezierPath与CAShapeLayerUITests' do
16 | inherit! :search_paths
17 | # Pods for testing
18 | end
19 |
20 | end
21 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer.xcodeproj/xcuserdata/woshipm.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayerTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
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 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayerUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
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 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer.xcodeproj/xcuserdata/woshipm.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | UIBezierPath与CAShapeLayer.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 8152C1D61E1DF02D0088F868
16 |
17 | primary
18 |
19 |
20 | 8152C1EF1E1DF02E0088F868
21 |
22 | primary
23 |
24 |
25 | 8152C1FA1E1DF02E0088F868
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayerTests/UIBezierPath_CAShapeLayerTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIBezierPath_CAShapeLayerTests.m
3 | // UIBezierPath与CAShapeLayerTests
4 | //
5 | // Created by WOSHIPM on 17/1/5.
6 | // Copyright © 2017年 WOSHIPM. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIBezierPath_CAShapeLayerTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation UIBezierPath_CAShapeLayerTests
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 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/Assets.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 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayerUITests/UIBezierPath_CAShapeLayerUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIBezierPath_CAShapeLayerUITests.m
3 | // UIBezierPath与CAShapeLayerUITests
4 | //
5 | // Created by WOSHIPM on 17/1/5.
6 | // Copyright © 2017年 WOSHIPM. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIBezierPath_CAShapeLayerUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation UIBezierPath_CAShapeLayerUITests
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 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
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 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/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 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/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 |
27 |
28 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // UIBezierPath与CAShapeLayer
4 | //
5 | // Created by WOSHIPM on 17/1/5.
6 | // Copyright © 2017年 WOSHIPM. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "ViewController.h"
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 | _window=[[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
21 | _window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[ViewController new]];
22 | [_window makeKeyWindow];
23 |
24 | return YES;
25 | }
26 |
27 |
28 | - (void)applicationWillResignActive:(UIApplication *)application {
29 | // 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.
30 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
31 | }
32 |
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application {
35 | // 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.
36 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
37 | }
38 |
39 |
40 | - (void)applicationWillEnterForeground:(UIApplication *)application {
41 | // 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.
42 | }
43 |
44 |
45 | - (void)applicationDidBecomeActive:(UIApplication *)application {
46 | // 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.
47 | }
48 |
49 |
50 | - (void)applicationWillTerminate:(UIApplication *)application {
51 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
52 | }
53 |
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer.xcodeproj/xcuserdata/woshipm.xcuserdatad/xcschemes/UIBezierPath与CAShapeLayer.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
61 |
62 |
63 |
64 |
74 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // UIBezierPath与CAShapeLayer
4 | //
5 | // Created by WOSHIPM on 17/1/5.
6 | // Copyright © 2017年 WOSHIPM. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "SecondViewController.h"
11 | @interface ViewController ()
12 |
13 | @end
14 |
15 | @implementation ViewController
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 | self.view.backgroundColor = [UIColor whiteColor];
20 | self.navigationController.navigationBar.hidden = YES;
21 | UIButton *button=[UIButton buttonWithType:UIButtonTypeSystem];
22 | button.frame = CGRectMake(self.view.frame.size.width-110, 64,100, 40);
23 | [self.view addSubview:button];
24 | [button setTitle:@"画个哆啦A梦" forState:UIControlStateNormal];
25 | [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
26 |
27 | // 一、 CAShapeLayer画图
28 | CAShapeLayer *layer=[[CAShapeLayer alloc] init];
29 | layer.frame = CGRectMake(40, 70, 100, 50);
30 | layer.backgroundColor = [UIColor redColor].CGColor;
31 | [self.view.layer addSublayer:layer];
32 |
33 | // 二、UIBezierPath和CAShapeLayer结合画图
34 |
35 | // 1、矩形。 Rect是所画图形的frame
36 | UIBezierPath *path=[UIBezierPath bezierPathWithRect:CGRectMake(160, 70, 100, 50)];
37 | CAShapeLayer *layer1=[[CAShapeLayer alloc] init];
38 | layer1.path=path.CGPath;
39 |
40 | layer1.fillColor=[UIColor greenColor].CGColor;//图形的填充颜色
41 | layer1.strokeColor=[UIColor redColor].CGColor;//图形的边框颜色 [self.view.layer addSublayer:layer1];
42 |
43 |
44 | // 2、椭圆。Rect是所画图形的frame,cornerRadius是椭圆的圆角,当图形的长宽一样,圆角为长宽的一半时即为圆形
45 |
46 | //椭圆
47 | UIBezierPath *path2=[UIBezierPath bezierPathWithRoundedRect:CGRectMake(40, 140, 100, 50) cornerRadius:30];
48 | //圆
49 | // UIBezierPath *path2=[UIBezierPath bezierPathWithRoundedRect:CGRectMake(40, 140, 100, 100) cornerRadius:50];
50 | CAShapeLayer *layer2=[[CAShapeLayer alloc] init];
51 | layer2.path=path2.CGPath;
52 | layer2.fillColor=[UIColor whiteColor].CGColor;
53 | layer2.strokeColor=[UIColor blueColor].CGColor;
54 | [self.view.layer addSublayer:layer2];
55 |
56 |
57 | // 3、画圆弧。画满一圈即为圆
58 |
59 | //ArcCenter:圆心
60 | //radius:半径
61 | //startAngle:开始角度
62 | //endAngle:结束角度
63 | //clockwise:是否顺时针方向
64 |
65 | //指定起点和终点画圆弧
66 | UIBezierPath *cornerPath=[UIBezierPath bezierPathWithArcCenter:CGPointMake(200, 200) radius:50 startAngle:M_PI endAngle:3*M_PI clockwise:YES];
67 | CAShapeLayer *layer3 = [[CAShapeLayer alloc] init];
68 | layer3.path = cornerPath.CGPath;
69 | layer3.fillColor = [UIColor clearColor].CGColor;
70 | layer3.strokeColor = [UIColor greenColor].CGColor;
71 | // 3.0f设置线的宽度
72 | [layer3 setLineWidth:5.0f];
73 |
74 | [self.view.layer addSublayer:layer3];
75 |
76 | //4、虚线。虚线的话, 是通过设置CAShapeLayer的宽度及线的间距,进而
77 | CAShapeLayer *shapeLayer = [CAShapeLayer layer];
78 |
79 | [shapeLayer setFillColor:[[UIColor clearColor] CGColor]];
80 |
81 | // 设置虚线颜色为blackColor
82 |
83 | [shapeLayer setStrokeColor:[[UIColor redColor] CGColor]];
84 |
85 | // 3.0f设置虚线的宽度
86 | [shapeLayer setLineWidth:0.5f];
87 | [shapeLayer setLineJoin:kCALineJoinRound];
88 |
89 | // 3=线的宽度 1=每条线的间距
90 | [shapeLayer setLineDashPattern:
91 | [NSArray arrayWithObjects:[NSNumber numberWithInt:3],
92 | [NSNumber numberWithInt:1],nil]];
93 |
94 |
95 | // Setup the path
96 | CGMutablePathRef path3 = CGPathCreateMutable();
97 | // 0,10代表初始坐标的x,y
98 | // 320,10代表初始坐标的x,y
99 | CGPathMoveToPoint(path3, NULL, 50 , 280);
100 | CGPathAddLineToPoint(path3, NULL, 250,280);
101 |
102 | CGPathMoveToPoint(path3, NULL, 250, 280);
103 | CGPathAddLineToPoint(path3, NULL, 250,320);
104 |
105 | CGPathMoveToPoint(path3, NULL, 250, 320);
106 | CGPathAddLineToPoint(path3, NULL, 50,320);
107 |
108 | CGPathMoveToPoint(path3, NULL, 50, 320);
109 | CGPathAddLineToPoint(path3, NULL, 50,280);
110 | [shapeLayer setPath:path3];
111 | CGPathRelease(path3);
112 | [self.view.layer addSublayer:shapeLayer];
113 |
114 |
115 | // 5、曲线
116 | // 单点曲线
117 | //贝塞尔曲线的画法是由起点、终点、控制点三个参数来画的
118 | [self curve];
119 | [self Curve2];
120 |
121 | }
122 | -(void)curve{
123 | CGPoint startPoint = CGPointMake(50, 350);
124 | CGPoint endPoint = CGPointMake(300, 350);
125 | CGPoint controlPoint = CGPointMake(175, 300);
126 |
127 | CALayer *layer1 = [CALayer layer];
128 | layer1.frame = CGRectMake(startPoint.x, startPoint.y, 5, 5);
129 | layer1.backgroundColor = [UIColor redColor].CGColor;
130 |
131 | CALayer *layer2 = [CALayer layer];
132 | layer2.frame = CGRectMake(endPoint.x, endPoint.y, 5, 5);
133 | layer2.backgroundColor = [UIColor redColor].CGColor;
134 |
135 | CALayer *layer3 = [CALayer layer];
136 | layer3.frame = CGRectMake(controlPoint.x, controlPoint.y, 5, 5);
137 | layer3.backgroundColor = [UIColor redColor].CGColor;
138 |
139 | UIBezierPath *path = [UIBezierPath bezierPath];
140 | CAShapeLayer *layer = [CAShapeLayer layer];
141 |
142 | [path moveToPoint:startPoint];
143 | [path addQuadCurveToPoint:endPoint controlPoint:controlPoint];
144 |
145 | layer.path = path.CGPath;
146 | layer.fillColor = [UIColor clearColor].CGColor;
147 | layer.strokeColor = [UIColor blackColor].CGColor;
148 |
149 | [self.view.layer addSublayer:layer];
150 | [self.view.layer addSublayer:layer1];
151 | [self.view.layer addSublayer:layer2];
152 | [self.view.layer addSublayer:layer3];
153 | }
154 | #pragma mark - 双控制点曲线
155 | - (void)Curve2{
156 |
157 |
158 | //贝塞尔曲线的画法是由起点、终点、控制点三个参数来画的,为了解释清楚这个点,我写了几行代码来解释它
159 | CGPoint startPoint = CGPointMake(50, 400);
160 | CGPoint endPoint = CGPointMake(300, 400);
161 | CGPoint controlPoint1 = CGPointMake(112.5, 350);
162 | CGPoint controlPoint2 = CGPointMake(237.5, 450);
163 |
164 | CALayer *layer1 = [CALayer layer];
165 | layer1.frame = CGRectMake(startPoint.x, startPoint.y, 5, 5);
166 | layer1.backgroundColor = [UIColor redColor].CGColor;
167 |
168 | CALayer *layer2 = [CALayer layer];
169 | layer2.frame = CGRectMake(endPoint.x, endPoint.y, 5, 5);
170 | layer2.backgroundColor = [UIColor redColor].CGColor;
171 |
172 | CALayer *layer3 = [CALayer layer];
173 | layer3.frame = CGRectMake(controlPoint1.x, controlPoint1.y, 5, 5);
174 | layer3.backgroundColor = [UIColor redColor].CGColor;
175 |
176 | CALayer *layer4 = [CALayer layer];
177 | layer4.frame = CGRectMake(controlPoint2.x, controlPoint2.y, 5, 5);
178 | layer4.backgroundColor = [UIColor redColor].CGColor;
179 |
180 | UIBezierPath *path = [UIBezierPath bezierPath];
181 | CAShapeLayer *layer = [CAShapeLayer layer];
182 |
183 | [path moveToPoint:startPoint];
184 | [path addCurveToPoint:endPoint controlPoint1:controlPoint1 controlPoint2:controlPoint2];
185 |
186 | layer.path = path.CGPath;
187 | layer.fillColor = [UIColor clearColor].CGColor;
188 | layer.strokeColor = [UIColor blackColor].CGColor;
189 |
190 | [self.view.layer addSublayer:layer];
191 | [self.view.layer addSublayer:layer1];
192 | [self.view.layer addSublayer:layer2];
193 | [self.view.layer addSublayer:layer3];
194 | [self.view.layer addSublayer:layer4];
195 |
196 |
197 | }
198 |
199 | -(void)buttonAction:(UIButton *)button{
200 | // [self clearDisplayView];
201 |
202 | SecondViewController *secondVC=[SecondViewController new];
203 | [self.navigationController pushViewController:secondVC animated:YES];
204 |
205 |
206 |
207 |
208 | }
209 |
210 |
211 | - (void)didReceiveMemoryWarning {
212 | [super didReceiveMemoryWarning];
213 | // Dispose of any resources that can be recreated.
214 | /*
215 | **/
216 | // 1. UIBezierPathCAShapeLayer: UIBezierPath是在 UIKit 中的一个类,继承于NSObject,可以创建基于矢量的路径.此类是Core Graphics框架关于path的一个OC封装。使用此类可以定义常见的圆形、多边形等形状 。我们使用直线、弧(arc)来创建复杂的曲线形状。每一个直线段或者曲线段的结束的地方是下一个的开始的地方。每一个连接的直线或者曲线段的集合成为subpath。一个UIBezierPath对象定义一个完整的路径包括一个或者多个subpaths。
217 | // 2. CAShapeLayer: 继承于CALayer。 每个CAShapeLayer对象都代表着将要被渲染到屏幕上的一个任意的形状(shape)。具体的形状由其path(类型为CGPathRef)属性指定。 普通的CALayer是矩形,所以需要frame属性。CAShapeLayer它本身没有形状,它的形状来源于其属性path 。CAShapeLayer有不同于CALayer的属性,它从CALayer继承而来的属性在绘制时是不起作用的。
218 | //
219 |
220 | }
221 |
222 |
223 | @end
224 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer/SecondViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SecondViewController.m
3 | // UIBezierPath与CAShapeLayer
4 | //
5 | // Created by WOSHIPM on 2017/3/17.
6 | // Copyright © 2017年 WOSHIPM. All rights reserved.
7 | //
8 |
9 | #import "SecondViewController.h"
10 |
11 | @interface SecondViewController ()
12 |
13 | @end
14 |
15 | @implementation SecondViewController
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 | self.view.backgroundColor = [UIColor whiteColor];
20 |
21 | // 确定头部所在的圆心
22 | CGFloat headerCornerRadius=80;
23 | CGFloat arcCenterX=self.view.frame.size.width/2;
24 | CGFloat arcCenterY= 120+headerCornerRadius;
25 |
26 |
27 | //画头部
28 | CAShapeLayer *headLayer=[[CAShapeLayer alloc] init];
29 | UIBezierPath *headerPath=[UIBezierPath bezierPathWithRoundedRect:CGRectMake(self.view.frame.size.width/2-headerCornerRadius, 120, headerCornerRadius*2, headerCornerRadius*2) cornerRadius:headerCornerRadius];
30 | [self setLayer:headLayer path:headerPath];
31 |
32 | //脸
33 | CAShapeLayer *faceLayer=[CAShapeLayer layer];
34 | UIBezierPath *facePath=[UIBezierPath bezierPathWithArcCenter:CGPointMake(self.view.frame.size.width/2, 120+headerCornerRadius+10) radius:70 startAngle:M_PI endAngle:3*M_PI clockwise:YES];
35 | [self setLayer:faceLayer path:facePath];
36 |
37 | // //画二元曲线,一般和moveToPoint配合使用
38 | // - (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint
39 | // 参数:
40 | // endPoint:曲线的终点
41 | // controlPoint:画曲线的基准点
42 | //
43 | // //以三个点画一段曲线,一般和moveToPoint配合使用
44 | // - (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2
45 | // 参数:
46 | // endPoint:曲线的终点
47 | // controlPoint1:画曲线的第一个基准点
48 | // controlPoint2:画曲线的第二个基准点
49 |
50 |
51 |
52 |
53 | //左眼
54 | CAShapeLayer *leftEyeLayer = [CAShapeLayer layer];
55 | UIBezierPath *leftEyePath = [UIBezierPath bezierPath];
56 | [leftEyePath moveToPoint:CGPointMake(arcCenterX-30, arcCenterY-25)];
57 | [leftEyePath addQuadCurveToPoint:CGPointMake(arcCenterX-15, arcCenterY-45) controlPoint:CGPointMake(arcCenterX-30, arcCenterY-45)];
58 | [leftEyePath addQuadCurveToPoint:CGPointMake(arcCenterX, arcCenterY-25) controlPoint:CGPointMake(arcCenterX, arcCenterY-45)];
59 | [leftEyePath addQuadCurveToPoint:CGPointMake(arcCenterX-15, arcCenterY-5) controlPoint:CGPointMake(arcCenterX, arcCenterY-5)];
60 | [leftEyePath addQuadCurveToPoint:CGPointMake(arcCenterX-30, arcCenterY-25) controlPoint:CGPointMake(arcCenterX-30, arcCenterY-5)];
61 | [self setLayer:leftEyeLayer path:leftEyePath];
62 |
63 | //左眼珠
64 | CAShapeLayer *leftEyeBallLayer = [CAShapeLayer layer];
65 | UIBezierPath *leftEyeBallPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(arcCenterX-5, arcCenterY-30) radius:2.5 startAngle:0 endAngle:2*M_PI clockwise:YES];
66 | [self setLayer:leftEyeBallLayer path:leftEyeBallPath ];
67 |
68 | //右眼
69 | CAShapeLayer *rightEyeLayer = [CAShapeLayer layer];
70 | UIBezierPath *rightEyePath = [UIBezierPath bezierPath];
71 | [rightEyePath moveToPoint:CGPointMake(arcCenterX, arcCenterY-25)];
72 | [rightEyePath addQuadCurveToPoint:CGPointMake(arcCenterX+15, arcCenterY-45) controlPoint:CGPointMake(arcCenterX, arcCenterY-45)];
73 | [rightEyePath addQuadCurveToPoint:CGPointMake(arcCenterX+30, arcCenterY-25) controlPoint:CGPointMake(arcCenterX+30, arcCenterY-45)];
74 | [rightEyePath addQuadCurveToPoint:CGPointMake(arcCenterX+15, arcCenterY-5) controlPoint:CGPointMake(arcCenterX+30, arcCenterY-5)];
75 | [rightEyePath addQuadCurveToPoint:CGPointMake(arcCenterX, arcCenterY-25) controlPoint:CGPointMake(arcCenterX, arcCenterY-5)];
76 | [self setLayer:rightEyeLayer path:rightEyePath ];
77 |
78 |
79 | //右眼珠
80 | CAShapeLayer *rightEyeBallLayer = [CAShapeLayer layer];
81 | UIBezierPath *rightEyeBallPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(arcCenterX+5, arcCenterY-30) radius:2.5 startAngle:0 endAngle:2*M_PI clockwise:YES];
82 | [self setLayer:rightEyeBallLayer path:rightEyeBallPath];
83 |
84 | //鼻子
85 | CAShapeLayer *noseLayer = [CAShapeLayer layer];
86 | UIBezierPath *nosePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(arcCenterX, arcCenterY) radius:10 startAngle:0 endAngle:2*M_PI clockwise:YES];
87 | [self setLayer:noseLayer path:nosePath ];
88 |
89 | //鼻子光晕
90 | CAShapeLayer *noseHaloLayer = [CAShapeLayer layer];
91 | UIBezierPath *noseHaloPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(arcCenterX-4, arcCenterY-5) radius:2.5 startAngle:0 endAngle:2*M_PI clockwise:YES];
92 | [self setLayer:noseHaloLayer path:noseHaloPath ];
93 |
94 | //嘴巴
95 | CAShapeLayer *mouthLayer = [CAShapeLayer layer];
96 | UIBezierPath *mouthPath = [UIBezierPath bezierPath];
97 | [mouthPath moveToPoint:CGPointMake(arcCenterX-60, arcCenterY+25)];
98 | [mouthPath addQuadCurveToPoint:CGPointMake(arcCenterX+60, arcCenterY+25) controlPoint:CGPointMake(arcCenterX, arcCenterY+90)];
99 | [self setLayer:mouthLayer path:mouthPath];
100 |
101 | CAShapeLayer *mouthLayer1 = [CAShapeLayer layer];
102 | UIBezierPath *mouthPath1 = [UIBezierPath bezierPath];
103 | [mouthPath1 moveToPoint:CGPointMake(arcCenterX, arcCenterY+10)];
104 | [mouthPath1 addLineToPoint:CGPointMake(arcCenterX, arcCenterY+55)];
105 | [self setLayer:mouthLayer1 path:mouthPath1];
106 |
107 | //胡子
108 | [self addBeardFromPoint:CGPointMake(arcCenterX-58, arcCenterY-5) toPoint:CGPointMake(arcCenterX-15, arcCenterY+10) ];
109 | [self addBeardFromPoint:CGPointMake(arcCenterX-68, arcCenterY+15) toPoint:CGPointMake(arcCenterX-15, arcCenterY+20) ];
110 | [self addBeardFromPoint:CGPointMake(arcCenterX-61, arcCenterY+45) toPoint:CGPointMake(arcCenterX-15, arcCenterY+30) ];
111 | [self addBeardFromPoint:CGPointMake(arcCenterX+58, arcCenterY-5) toPoint:CGPointMake(arcCenterX+15, arcCenterY+10) ];
112 | [self addBeardFromPoint:CGPointMake(arcCenterX+68, arcCenterY+15) toPoint:CGPointMake(arcCenterX+15, arcCenterY+20) ];
113 | [self addBeardFromPoint:CGPointMake(arcCenterX+61, arcCenterY+45) toPoint:CGPointMake(arcCenterX+15, arcCenterY+30) ];
114 |
115 |
116 | //左手
117 | CAShapeLayer *leftHandLayer = [CAShapeLayer layer];
118 | UIBezierPath *leftHandPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(arcCenterX-95, arcCenterY+110) radius:20 startAngle:0 endAngle:2*M_PI clockwise:YES];
119 | [self setLayer:leftHandLayer path:leftHandPath ];
120 |
121 | //左胳膊
122 | CGFloat distanceXToArcCenter = 80*cos(M_PI_2*4/9);
123 | CGFloat distanceYToArcCenter = 80*sin(M_PI_2*4/9);
124 | CAShapeLayer *leftArmLayer = [CAShapeLayer layer];
125 | UIBezierPath *leftArmPath = [UIBezierPath bezierPath];
126 | [leftArmPath moveToPoint:CGPointMake(arcCenterX-distanceXToArcCenter, arcCenterY+distanceYToArcCenter)];
127 | [leftArmPath addLineToPoint:CGPointMake(arcCenterX-95, arcCenterY+90)];
128 | [leftArmPath addQuadCurveToPoint:CGPointMake(arcCenterX-75, arcCenterY+110) controlPoint:CGPointMake(arcCenterX-92, arcCenterY+107)];
129 | [leftArmPath addLineToPoint:CGPointMake(arcCenterX-distanceXToArcCenter+1.5, arcCenterY+95)];
130 | [self setLayer:leftArmLayer path:leftArmPath ];
131 |
132 | //围巾
133 | CAShapeLayer *mufflerLayer = [CAShapeLayer layer];
134 | UIBezierPath *mufflerPath = [UIBezierPath bezierPath];
135 | [mufflerPath moveToPoint:CGPointMake(arcCenterX-distanceXToArcCenter, arcCenterY+distanceYToArcCenter)];
136 | [mufflerPath addQuadCurveToPoint:CGPointMake(arcCenterX+distanceXToArcCenter, arcCenterY+distanceYToArcCenter) controlPoint:CGPointMake(arcCenterX, arcCenterY+109)];
137 | [mufflerPath addLineToPoint:CGPointMake(arcCenterX+distanceXToArcCenter+2, arcCenterY+distanceYToArcCenter+7)];
138 | [mufflerPath addQuadCurveToPoint:CGPointMake(arcCenterX-distanceXToArcCenter-4, arcCenterY+distanceYToArcCenter+5) controlPoint:CGPointMake(arcCenterX, arcCenterY+115)];
139 | [mufflerPath addLineToPoint:CGPointMake(arcCenterX-distanceXToArcCenter, arcCenterY+distanceYToArcCenter)];
140 | [self setLayer:mufflerLayer path:mufflerPath ];
141 |
142 | //身体
143 | CAShapeLayer *bodyLayer = [CAShapeLayer layer];
144 | UIBezierPath *bodyPath = [UIBezierPath bezierPath];
145 | [bodyPath moveToPoint:CGPointMake(arcCenterX-distanceXToArcCenter, arcCenterY+distanceYToArcCenter+7)];
146 | [bodyPath addQuadCurveToPoint:CGPointMake(arcCenterX-distanceXToArcCenter+5, arcCenterY+150) controlPoint:CGPointMake(arcCenterX-distanceXToArcCenter+2, arcCenterY+140)];
147 | [bodyPath addQuadCurveToPoint:CGPointMake(arcCenterX-distanceXToArcCenter+3, arcCenterY+170) controlPoint:CGPointMake(arcCenterX-distanceXToArcCenter, arcCenterY+160)];
148 | [bodyPath addQuadCurveToPoint:CGPointMake(arcCenterX-8, arcCenterY+170) controlPoint:CGPointMake(arcCenterX-(distanceXToArcCenter+5)/2, arcCenterY+175)];
149 | [bodyPath addQuadCurveToPoint:CGPointMake(arcCenterX+8, arcCenterY+170) controlPoint:CGPointMake(arcCenterX, arcCenterY+155)];
150 | [bodyPath addQuadCurveToPoint:CGPointMake(arcCenterX+distanceXToArcCenter-3, arcCenterY+170) controlPoint:CGPointMake(arcCenterX+(distanceXToArcCenter+5)/2, arcCenterY+175)];
151 | [bodyPath addQuadCurveToPoint:CGPointMake(arcCenterX+distanceXToArcCenter-5, arcCenterY+150) controlPoint:CGPointMake(arcCenterX+distanceXToArcCenter-2, arcCenterY+160)];
152 | [bodyPath addQuadCurveToPoint:CGPointMake(arcCenterX+distanceXToArcCenter, arcCenterY+distanceYToArcCenter+8) controlPoint:CGPointMake(arcCenterX+distanceXToArcCenter-2, arcCenterY+140)];
153 | [bodyPath addQuadCurveToPoint:CGPointMake(arcCenterX-distanceXToArcCenter, arcCenterY+distanceYToArcCenter+7) controlPoint:CGPointMake(arcCenterX, arcCenterY+115)];
154 | [self setLayer:bodyLayer path:bodyPath ];
155 |
156 |
157 | //左脚
158 | CAShapeLayer *leftFootLayer = [CAShapeLayer layer];
159 | UIBezierPath *leftFootPath = [UIBezierPath bezierPath];
160 | [leftFootPath moveToPoint:CGPointMake(arcCenterX-distanceXToArcCenter+3, arcCenterY+170)];
161 | [leftFootPath addQuadCurveToPoint:CGPointMake(arcCenterX-distanceXToArcCenter+3, arcCenterY+195) controlPoint:CGPointMake(arcCenterX-distanceXToArcCenter-20, arcCenterY+185)];
162 | [leftFootPath addQuadCurveToPoint:CGPointMake(arcCenterX-13, arcCenterY+195) controlPoint:CGPointMake(arcCenterX-(distanceXToArcCenter+10)/2, arcCenterY+200)];
163 | [leftFootPath addQuadCurveToPoint:CGPointMake(arcCenterX-10, arcCenterY+170) controlPoint:CGPointMake(arcCenterX+8, arcCenterY+187)];
164 | [self setLayer:leftFootLayer path:leftFootPath ];
165 |
166 |
167 | //右脚
168 | CAShapeLayer *rightFootLayer = [CAShapeLayer layer];
169 | UIBezierPath *rightFootPath = [UIBezierPath bezierPath];
170 | [rightFootPath moveToPoint:CGPointMake(arcCenterX+10, arcCenterY+170)];
171 | [rightFootPath addQuadCurveToPoint:CGPointMake(arcCenterX+15, arcCenterY+195) controlPoint:CGPointMake(arcCenterX-12, arcCenterY+185)];
172 | [rightFootPath addQuadCurveToPoint:CGPointMake(arcCenterX+distanceXToArcCenter-5, arcCenterY+195) controlPoint:CGPointMake(arcCenterX+(distanceXToArcCenter+20)/2, arcCenterY+200)];
173 | [rightFootPath addQuadCurveToPoint:CGPointMake(arcCenterX+distanceXToArcCenter-3, arcCenterY+170) controlPoint:CGPointMake(arcCenterX+distanceXToArcCenter+18, arcCenterY+185)];
174 | [self setLayer:rightFootLayer path:rightFootPath];
175 |
176 | //肚子
177 | CAShapeLayer *bellyLayer = [CAShapeLayer layer];
178 | UIBezierPath *bellyPath = [UIBezierPath bezierPath];
179 | [bellyPath moveToPoint:CGPointMake(arcCenterX-30, arcCenterY+80)];
180 | [bellyPath addCurveToPoint:CGPointMake(arcCenterX-30, arcCenterY+150) controlPoint1:CGPointMake(arcCenterX-65, arcCenterY+95) controlPoint2:CGPointMake(arcCenterX-60, arcCenterY+140)];
181 | [bellyPath addQuadCurveToPoint:CGPointMake(arcCenterX+30, arcCenterY+150) controlPoint:CGPointMake(arcCenterX, arcCenterY+160)];
182 | [bellyPath addCurveToPoint:CGPointMake(arcCenterX+30, arcCenterY+80) controlPoint1:CGPointMake(arcCenterX+60, arcCenterY+140) controlPoint2:CGPointMake(arcCenterX+65, arcCenterY+95)];
183 | [bellyPath addQuadCurveToPoint:CGPointMake(arcCenterX-30, arcCenterY+80) controlPoint:CGPointMake(arcCenterX, arcCenterY+92)];
184 | [self setLayer:bellyLayer path:bellyPath ];
185 |
186 | //铃铛
187 | CAShapeLayer *bellLayer = [CAShapeLayer layer];
188 | UIBezierPath *bellPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(arcCenterX, arcCenterY+97) radius:15 startAngle:0 endAngle:2*M_PI clockwise:YES];
189 | [self setLayer:bellLayer path:bellPath ];
190 |
191 |
192 | //铃铛上的线
193 | CAShapeLayer *bellLineLayer = [CAShapeLayer layer];
194 | UIBezierPath *BellLinePath = [UIBezierPath bezierPath];
195 | [BellLinePath moveToPoint:CGPointMake(arcCenterX-(sqrt(pow(15.0, 2)-pow(5.0, 2))), arcCenterY+92)];
196 | [BellLinePath addLineToPoint:CGPointMake(arcCenterX+(sqrt(pow(15.0, 2)-pow(5.0, 2))), arcCenterY+92)];
197 | [BellLinePath moveToPoint:CGPointMake(arcCenterX+(sqrt(pow(15.0, 2)-pow(2.0, 2))), arcCenterY+95)];
198 | [BellLinePath addLineToPoint:CGPointMake(arcCenterX-(sqrt(pow(15.0, 2)-pow(2.0, 2))), arcCenterY+95)];
199 | [self setLayer:bellLineLayer path:BellLinePath ];
200 |
201 |
202 | //铃铛上的小圆点
203 | CAShapeLayer *bellCirLayer = [CAShapeLayer layer];
204 | UIBezierPath *bellCirPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(arcCenterX, arcCenterY+102) radius:2.5 startAngle:0 endAngle:2*M_PI clockwise:YES];
205 | [bellCirPath moveToPoint:CGPointMake(arcCenterX, arcCenterY+104.5)];
206 | [bellCirPath addLineToPoint:CGPointMake(arcCenterX, arcCenterY+112)];
207 | [self setLayer:bellCirLayer path:bellCirPath ];
208 |
209 | //口袋
210 | CAShapeLayer *bagLayer = [CAShapeLayer layer];
211 | UIBezierPath *bagPath = [UIBezierPath bezierPath];
212 | [bagPath moveToPoint:CGPointMake(arcCenterX-40, arcCenterY+112)];
213 | [bagPath addQuadCurveToPoint:CGPointMake(arcCenterX+40, arcCenterY+112) controlPoint:CGPointMake(arcCenterX, arcCenterY+120)];
214 | [bagPath addCurveToPoint:CGPointMake(arcCenterX-40, arcCenterY+112) controlPoint1:CGPointMake(arcCenterX+28, arcCenterY+160) controlPoint2:CGPointMake(arcCenterX-28, arcCenterY+160)];
215 | [self setLayer:bagLayer path:bagPath ];
216 |
217 |
218 | //右手
219 | CAShapeLayer *rightHandLayer = [CAShapeLayer layer];
220 | UIBezierPath *rightHandPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(arcCenterX+85*cos(27/180.0*M_PI), arcCenterY-85*sin(27/180.0*M_PI)) radius:20 startAngle:0 endAngle:2*M_PI clockwise:YES];
221 | [self setLayer:rightHandLayer path:rightHandPath ];
222 |
223 |
224 | //右胳膊
225 | CAShapeLayer *rightArmLayer = [CAShapeLayer layer];
226 | UIBezierPath *rightArmPath = [UIBezierPath bezierPath];
227 | [rightArmPath moveToPoint:CGPointMake(arcCenterX+80*cos(13/180.0*M_PI), arcCenterY-80*sin(13/180.0*M_PI))];
228 | [rightArmPath addQuadCurveToPoint:CGPointMake(arcCenterX+distanceXToArcCenter, arcCenterY+distanceYToArcCenter) controlPoint:CGPointMake(arcCenterX+80*cos(13/180.0*M_PI)+9, arcCenterY+20)];
229 | [rightArmPath addLineToPoint:CGPointMake(arcCenterX+distanceXToArcCenter, arcCenterY+distanceYToArcCenter+25)];
230 | [rightArmPath addQuadCurveToPoint:CGPointMake(arcCenterX+93*cos(15/180.0*M_PI), arcCenterY-93*sin(15/180.0*M_PI)) controlPoint:CGPointMake(arcCenterX+90*cos(13/180.0*M_PI)+15, arcCenterY+25)];
231 | [rightArmPath addQuadCurveToPoint:CGPointMake(arcCenterX+80*cos(13/180.0*M_PI), arcCenterY-80*sin(13/180.0*M_PI)) controlPoint:CGPointMake(arcCenterX+80*cos(13/180.0*M_PI)+5, arcCenterY-93*sin(15/180.0*M_PI)+5)];
232 | [self setLayer:rightArmLayer path:rightArmPath];
233 |
234 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width/2+90, 120, 70, 30)];
235 | label.textAlignment = NSTextAlignmentCenter;
236 | label.textColor = [UIColor colorWithRed:21/255.0 green:159/255.0 blue:237/255.0 alpha:1];
237 | label.text = @"Hello";
238 | label.font = [UIFont fontWithName:@"Chalkduster" size:20];
239 | [self.view addSubview:label];
240 |
241 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
242 | animation.fromValue = @(0);
243 | animation.toValue = @(1);
244 | animation.duration = 0.5f;
245 | [label.layer addAnimation:animation forKey:nil];
246 |
247 | //上色
248 | faceLayer.fillColor = [UIColor whiteColor].CGColor;
249 | leftEyeLayer.fillColor = [UIColor whiteColor].CGColor;
250 | rightEyeLayer.fillColor = [UIColor whiteColor].CGColor;
251 | leftEyeBallLayer.fillColor = [UIColor blackColor].CGColor;
252 | rightEyeBallLayer.fillColor = [UIColor blackColor].CGColor;
253 | noseLayer.fillColor = [UIColor redColor].CGColor;
254 | noseHaloLayer.fillColor = [UIColor whiteColor].CGColor;
255 | headLayer.fillColor = [UIColor colorWithRed:21/255.0 green:159/255.0 blue:237/255.0 alpha:1].CGColor;
256 | leftArmLayer.fillColor = [UIColor colorWithRed:21/255.0 green:159/255.0 blue:237/255.0 alpha:1].CGColor;
257 | leftHandLayer.fillColor = [UIColor whiteColor].CGColor;
258 | mufflerLayer.fillColor = [UIColor redColor].CGColor;
259 | bellyLayer.fillColor = [UIColor whiteColor].CGColor;
260 | bellLayer.fillColor = [UIColor yellowColor].CGColor;
261 | bodyLayer.fillColor = [UIColor colorWithRed:21/255.0 green:159/255.0 blue:237/255.0 alpha:1].CGColor;
262 | rightHandLayer .fillColor=[UIColor whiteColor].CGColor ;
263 | rightArmLayer .fillColor=[UIColor colorWithRed:21/255.0 green:159/255.0 blue:237/255.0 alpha:1] .CGColor;
264 |
265 |
266 | }
267 | - (void)addBeardFromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint
268 | {
269 | CAShapeLayer *beardLayer1 = [CAShapeLayer layer];
270 | UIBezierPath *beardPath1 = [UIBezierPath bezierPath];
271 | [beardPath1 moveToPoint:fromPoint];
272 | [beardPath1 addLineToPoint:toPoint];
273 | [self setLayer:beardLayer1 path:beardPath1 ];
274 | }
275 |
276 |
277 | -(void)setLayer:(CAShapeLayer *)layer path:(UIBezierPath *)path{
278 |
279 | layer.path = path.CGPath;
280 | layer.fillColor = [UIColor clearColor].CGColor;
281 | layer.strokeColor=[UIColor lightGrayColor].CGColor;
282 | [self.view.layer addSublayer:layer];
283 |
284 |
285 |
286 | }
287 |
288 |
289 | - (void)didReceiveMemoryWarning {
290 | [super didReceiveMemoryWarning];
291 | // Dispose of any resources that can be recreated.
292 | }
293 |
294 | /*
295 | #pragma mark - Navigation
296 |
297 | // In a storyboard-based application, you will often want to do a little preparation before navigation
298 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
299 | // Get the new view controller using [segue destinationViewController].
300 | // Pass the selected object to the new view controller.
301 | }
302 | */
303 |
304 | @end
305 |
--------------------------------------------------------------------------------
/UIBezierPath与CAShapeLayer.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 8152C1DC1E1DF02D0088F868 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8152C1DB1E1DF02D0088F868 /* main.m */; };
11 | 8152C1DF1E1DF02D0088F868 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8152C1DE1E1DF02D0088F868 /* AppDelegate.m */; };
12 | 8152C1E21E1DF02D0088F868 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8152C1E11E1DF02D0088F868 /* ViewController.m */; };
13 | 8152C1E51E1DF02E0088F868 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8152C1E31E1DF02E0088F868 /* Main.storyboard */; };
14 | 8152C1E71E1DF02E0088F868 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8152C1E61E1DF02E0088F868 /* Assets.xcassets */; };
15 | 8152C1EA1E1DF02E0088F868 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8152C1E81E1DF02E0088F868 /* LaunchScreen.storyboard */; };
16 | 8152C1F51E1DF02E0088F868 /* UIBezierPath_CAShapeLayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8152C1F41E1DF02E0088F868 /* UIBezierPath_CAShapeLayerTests.m */; };
17 | 8152C2001E1DF02E0088F868 /* UIBezierPath_CAShapeLayerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8152C1FF1E1DF02E0088F868 /* UIBezierPath_CAShapeLayerUITests.m */; };
18 | 81C3FA741E7B728300CE9ECE /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81C3FA731E7B728300CE9ECE /* SecondViewController.m */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXContainerItemProxy section */
22 | 8152C1F11E1DF02E0088F868 /* PBXContainerItemProxy */ = {
23 | isa = PBXContainerItemProxy;
24 | containerPortal = 8152C1CF1E1DF02D0088F868 /* Project object */;
25 | proxyType = 1;
26 | remoteGlobalIDString = 8152C1D61E1DF02D0088F868;
27 | remoteInfo = "UIBezierPath与CAShapeLayer";
28 | };
29 | 8152C1FC1E1DF02E0088F868 /* PBXContainerItemProxy */ = {
30 | isa = PBXContainerItemProxy;
31 | containerPortal = 8152C1CF1E1DF02D0088F868 /* Project object */;
32 | proxyType = 1;
33 | remoteGlobalIDString = 8152C1D61E1DF02D0088F868;
34 | remoteInfo = "UIBezierPath与CAShapeLayer";
35 | };
36 | /* End PBXContainerItemProxy section */
37 |
38 | /* Begin PBXFileReference section */
39 | 8152C1D71E1DF02D0088F868 /* UIBezierPath与CAShapeLayer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "UIBezierPath与CAShapeLayer.app"; sourceTree = BUILT_PRODUCTS_DIR; };
40 | 8152C1DB1E1DF02D0088F868 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
41 | 8152C1DD1E1DF02D0088F868 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
42 | 8152C1DE1E1DF02D0088F868 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
43 | 8152C1E01E1DF02D0088F868 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
44 | 8152C1E11E1DF02D0088F868 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
45 | 8152C1E41E1DF02E0088F868 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
46 | 8152C1E61E1DF02E0088F868 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
47 | 8152C1E91E1DF02E0088F868 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
48 | 8152C1EB1E1DF02E0088F868 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | 8152C1F01E1DF02E0088F868 /* UIBezierPath与CAShapeLayerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UIBezierPath与CAShapeLayerTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
50 | 8152C1F41E1DF02E0088F868 /* UIBezierPath_CAShapeLayerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIBezierPath_CAShapeLayerTests.m; sourceTree = ""; };
51 | 8152C1F61E1DF02E0088F868 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
52 | 8152C1FB1E1DF02E0088F868 /* UIBezierPath与CAShapeLayerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UIBezierPath与CAShapeLayerUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
53 | 8152C1FF1E1DF02E0088F868 /* UIBezierPath_CAShapeLayerUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIBezierPath_CAShapeLayerUITests.m; sourceTree = ""; };
54 | 8152C2011E1DF02E0088F868 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
55 | 81C3FA721E7B728300CE9ECE /* SecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; };
56 | 81C3FA731E7B728300CE9ECE /* SecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; };
57 | /* End PBXFileReference section */
58 |
59 | /* Begin PBXFrameworksBuildPhase section */
60 | 8152C1D41E1DF02D0088F868 /* Frameworks */ = {
61 | isa = PBXFrameworksBuildPhase;
62 | buildActionMask = 2147483647;
63 | files = (
64 | );
65 | runOnlyForDeploymentPostprocessing = 0;
66 | };
67 | 8152C1ED1E1DF02E0088F868 /* Frameworks */ = {
68 | isa = PBXFrameworksBuildPhase;
69 | buildActionMask = 2147483647;
70 | files = (
71 | );
72 | runOnlyForDeploymentPostprocessing = 0;
73 | };
74 | 8152C1F81E1DF02E0088F868 /* Frameworks */ = {
75 | isa = PBXFrameworksBuildPhase;
76 | buildActionMask = 2147483647;
77 | files = (
78 | );
79 | runOnlyForDeploymentPostprocessing = 0;
80 | };
81 | /* End PBXFrameworksBuildPhase section */
82 |
83 | /* Begin PBXGroup section */
84 | 8152C1CE1E1DF02D0088F868 = {
85 | isa = PBXGroup;
86 | children = (
87 | 8152C1D91E1DF02D0088F868 /* UIBezierPath与CAShapeLayer */,
88 | 8152C1F31E1DF02E0088F868 /* UIBezierPath与CAShapeLayerTests */,
89 | 8152C1FE1E1DF02E0088F868 /* UIBezierPath与CAShapeLayerUITests */,
90 | 8152C1D81E1DF02D0088F868 /* Products */,
91 | );
92 | sourceTree = "";
93 | };
94 | 8152C1D81E1DF02D0088F868 /* Products */ = {
95 | isa = PBXGroup;
96 | children = (
97 | 8152C1D71E1DF02D0088F868 /* UIBezierPath与CAShapeLayer.app */,
98 | 8152C1F01E1DF02E0088F868 /* UIBezierPath与CAShapeLayerTests.xctest */,
99 | 8152C1FB1E1DF02E0088F868 /* UIBezierPath与CAShapeLayerUITests.xctest */,
100 | );
101 | name = Products;
102 | sourceTree = "";
103 | };
104 | 8152C1D91E1DF02D0088F868 /* UIBezierPath与CAShapeLayer */ = {
105 | isa = PBXGroup;
106 | children = (
107 | 8152C1DD1E1DF02D0088F868 /* AppDelegate.h */,
108 | 8152C1DE1E1DF02D0088F868 /* AppDelegate.m */,
109 | 8152C1E01E1DF02D0088F868 /* ViewController.h */,
110 | 8152C1E11E1DF02D0088F868 /* ViewController.m */,
111 | 81C3FA721E7B728300CE9ECE /* SecondViewController.h */,
112 | 81C3FA731E7B728300CE9ECE /* SecondViewController.m */,
113 | 8152C1E31E1DF02E0088F868 /* Main.storyboard */,
114 | 8152C1E61E1DF02E0088F868 /* Assets.xcassets */,
115 | 8152C1E81E1DF02E0088F868 /* LaunchScreen.storyboard */,
116 | 8152C1EB1E1DF02E0088F868 /* Info.plist */,
117 | 8152C1DA1E1DF02D0088F868 /* Supporting Files */,
118 | );
119 | path = "UIBezierPath与CAShapeLayer";
120 | sourceTree = "";
121 | };
122 | 8152C1DA1E1DF02D0088F868 /* Supporting Files */ = {
123 | isa = PBXGroup;
124 | children = (
125 | 8152C1DB1E1DF02D0088F868 /* main.m */,
126 | );
127 | name = "Supporting Files";
128 | sourceTree = "";
129 | };
130 | 8152C1F31E1DF02E0088F868 /* UIBezierPath与CAShapeLayerTests */ = {
131 | isa = PBXGroup;
132 | children = (
133 | 8152C1F41E1DF02E0088F868 /* UIBezierPath_CAShapeLayerTests.m */,
134 | 8152C1F61E1DF02E0088F868 /* Info.plist */,
135 | );
136 | path = "UIBezierPath与CAShapeLayerTests";
137 | sourceTree = "";
138 | };
139 | 8152C1FE1E1DF02E0088F868 /* UIBezierPath与CAShapeLayerUITests */ = {
140 | isa = PBXGroup;
141 | children = (
142 | 8152C1FF1E1DF02E0088F868 /* UIBezierPath_CAShapeLayerUITests.m */,
143 | 8152C2011E1DF02E0088F868 /* Info.plist */,
144 | );
145 | path = "UIBezierPath与CAShapeLayerUITests";
146 | sourceTree = "";
147 | };
148 | /* End PBXGroup section */
149 |
150 | /* Begin PBXNativeTarget section */
151 | 8152C1D61E1DF02D0088F868 /* UIBezierPath与CAShapeLayer */ = {
152 | isa = PBXNativeTarget;
153 | buildConfigurationList = 8152C2041E1DF02E0088F868 /* Build configuration list for PBXNativeTarget "UIBezierPath与CAShapeLayer" */;
154 | buildPhases = (
155 | 8152C1D31E1DF02D0088F868 /* Sources */,
156 | 8152C1D41E1DF02D0088F868 /* Frameworks */,
157 | 8152C1D51E1DF02D0088F868 /* Resources */,
158 | );
159 | buildRules = (
160 | );
161 | dependencies = (
162 | );
163 | name = "UIBezierPath与CAShapeLayer";
164 | productName = "UIBezierPath与CAShapeLayer";
165 | productReference = 8152C1D71E1DF02D0088F868 /* UIBezierPath与CAShapeLayer.app */;
166 | productType = "com.apple.product-type.application";
167 | };
168 | 8152C1EF1E1DF02E0088F868 /* UIBezierPath与CAShapeLayerTests */ = {
169 | isa = PBXNativeTarget;
170 | buildConfigurationList = 8152C2071E1DF02E0088F868 /* Build configuration list for PBXNativeTarget "UIBezierPath与CAShapeLayerTests" */;
171 | buildPhases = (
172 | 8152C1EC1E1DF02E0088F868 /* Sources */,
173 | 8152C1ED1E1DF02E0088F868 /* Frameworks */,
174 | 8152C1EE1E1DF02E0088F868 /* Resources */,
175 | );
176 | buildRules = (
177 | );
178 | dependencies = (
179 | 8152C1F21E1DF02E0088F868 /* PBXTargetDependency */,
180 | );
181 | name = "UIBezierPath与CAShapeLayerTests";
182 | productName = "UIBezierPath与CAShapeLayerTests";
183 | productReference = 8152C1F01E1DF02E0088F868 /* UIBezierPath与CAShapeLayerTests.xctest */;
184 | productType = "com.apple.product-type.bundle.unit-test";
185 | };
186 | 8152C1FA1E1DF02E0088F868 /* UIBezierPath与CAShapeLayerUITests */ = {
187 | isa = PBXNativeTarget;
188 | buildConfigurationList = 8152C20A1E1DF02E0088F868 /* Build configuration list for PBXNativeTarget "UIBezierPath与CAShapeLayerUITests" */;
189 | buildPhases = (
190 | 8152C1F71E1DF02E0088F868 /* Sources */,
191 | 8152C1F81E1DF02E0088F868 /* Frameworks */,
192 | 8152C1F91E1DF02E0088F868 /* Resources */,
193 | );
194 | buildRules = (
195 | );
196 | dependencies = (
197 | 8152C1FD1E1DF02E0088F868 /* PBXTargetDependency */,
198 | );
199 | name = "UIBezierPath与CAShapeLayerUITests";
200 | productName = "UIBezierPath与CAShapeLayerUITests";
201 | productReference = 8152C1FB1E1DF02E0088F868 /* UIBezierPath与CAShapeLayerUITests.xctest */;
202 | productType = "com.apple.product-type.bundle.ui-testing";
203 | };
204 | /* End PBXNativeTarget section */
205 |
206 | /* Begin PBXProject section */
207 | 8152C1CF1E1DF02D0088F868 /* Project object */ = {
208 | isa = PBXProject;
209 | attributes = {
210 | LastUpgradeCheck = 0820;
211 | ORGANIZATIONNAME = WOSHIPM;
212 | TargetAttributes = {
213 | 8152C1D61E1DF02D0088F868 = {
214 | CreatedOnToolsVersion = 8.2.1;
215 | DevelopmentTeam = BVZZ9S8989;
216 | ProvisioningStyle = Automatic;
217 | };
218 | 8152C1EF1E1DF02E0088F868 = {
219 | CreatedOnToolsVersion = 8.2.1;
220 | ProvisioningStyle = Automatic;
221 | TestTargetID = 8152C1D61E1DF02D0088F868;
222 | };
223 | 8152C1FA1E1DF02E0088F868 = {
224 | CreatedOnToolsVersion = 8.2.1;
225 | ProvisioningStyle = Automatic;
226 | TestTargetID = 8152C1D61E1DF02D0088F868;
227 | };
228 | };
229 | };
230 | buildConfigurationList = 8152C1D21E1DF02D0088F868 /* Build configuration list for PBXProject "UIBezierPath与CAShapeLayer" */;
231 | compatibilityVersion = "Xcode 3.2";
232 | developmentRegion = English;
233 | hasScannedForEncodings = 0;
234 | knownRegions = (
235 | en,
236 | Base,
237 | );
238 | mainGroup = 8152C1CE1E1DF02D0088F868;
239 | productRefGroup = 8152C1D81E1DF02D0088F868 /* Products */;
240 | projectDirPath = "";
241 | projectRoot = "";
242 | targets = (
243 | 8152C1D61E1DF02D0088F868 /* UIBezierPath与CAShapeLayer */,
244 | 8152C1EF1E1DF02E0088F868 /* UIBezierPath与CAShapeLayerTests */,
245 | 8152C1FA1E1DF02E0088F868 /* UIBezierPath与CAShapeLayerUITests */,
246 | );
247 | };
248 | /* End PBXProject section */
249 |
250 | /* Begin PBXResourcesBuildPhase section */
251 | 8152C1D51E1DF02D0088F868 /* Resources */ = {
252 | isa = PBXResourcesBuildPhase;
253 | buildActionMask = 2147483647;
254 | files = (
255 | 8152C1EA1E1DF02E0088F868 /* LaunchScreen.storyboard in Resources */,
256 | 8152C1E71E1DF02E0088F868 /* Assets.xcassets in Resources */,
257 | 8152C1E51E1DF02E0088F868 /* Main.storyboard in Resources */,
258 | );
259 | runOnlyForDeploymentPostprocessing = 0;
260 | };
261 | 8152C1EE1E1DF02E0088F868 /* Resources */ = {
262 | isa = PBXResourcesBuildPhase;
263 | buildActionMask = 2147483647;
264 | files = (
265 | );
266 | runOnlyForDeploymentPostprocessing = 0;
267 | };
268 | 8152C1F91E1DF02E0088F868 /* Resources */ = {
269 | isa = PBXResourcesBuildPhase;
270 | buildActionMask = 2147483647;
271 | files = (
272 | );
273 | runOnlyForDeploymentPostprocessing = 0;
274 | };
275 | /* End PBXResourcesBuildPhase section */
276 |
277 | /* Begin PBXSourcesBuildPhase section */
278 | 8152C1D31E1DF02D0088F868 /* Sources */ = {
279 | isa = PBXSourcesBuildPhase;
280 | buildActionMask = 2147483647;
281 | files = (
282 | 81C3FA741E7B728300CE9ECE /* SecondViewController.m in Sources */,
283 | 8152C1E21E1DF02D0088F868 /* ViewController.m in Sources */,
284 | 8152C1DF1E1DF02D0088F868 /* AppDelegate.m in Sources */,
285 | 8152C1DC1E1DF02D0088F868 /* main.m in Sources */,
286 | );
287 | runOnlyForDeploymentPostprocessing = 0;
288 | };
289 | 8152C1EC1E1DF02E0088F868 /* Sources */ = {
290 | isa = PBXSourcesBuildPhase;
291 | buildActionMask = 2147483647;
292 | files = (
293 | 8152C1F51E1DF02E0088F868 /* UIBezierPath_CAShapeLayerTests.m in Sources */,
294 | );
295 | runOnlyForDeploymentPostprocessing = 0;
296 | };
297 | 8152C1F71E1DF02E0088F868 /* Sources */ = {
298 | isa = PBXSourcesBuildPhase;
299 | buildActionMask = 2147483647;
300 | files = (
301 | 8152C2001E1DF02E0088F868 /* UIBezierPath_CAShapeLayerUITests.m in Sources */,
302 | );
303 | runOnlyForDeploymentPostprocessing = 0;
304 | };
305 | /* End PBXSourcesBuildPhase section */
306 |
307 | /* Begin PBXTargetDependency section */
308 | 8152C1F21E1DF02E0088F868 /* PBXTargetDependency */ = {
309 | isa = PBXTargetDependency;
310 | target = 8152C1D61E1DF02D0088F868 /* UIBezierPath与CAShapeLayer */;
311 | targetProxy = 8152C1F11E1DF02E0088F868 /* PBXContainerItemProxy */;
312 | };
313 | 8152C1FD1E1DF02E0088F868 /* PBXTargetDependency */ = {
314 | isa = PBXTargetDependency;
315 | target = 8152C1D61E1DF02D0088F868 /* UIBezierPath与CAShapeLayer */;
316 | targetProxy = 8152C1FC1E1DF02E0088F868 /* PBXContainerItemProxy */;
317 | };
318 | /* End PBXTargetDependency section */
319 |
320 | /* Begin PBXVariantGroup section */
321 | 8152C1E31E1DF02E0088F868 /* Main.storyboard */ = {
322 | isa = PBXVariantGroup;
323 | children = (
324 | 8152C1E41E1DF02E0088F868 /* Base */,
325 | );
326 | name = Main.storyboard;
327 | sourceTree = "";
328 | };
329 | 8152C1E81E1DF02E0088F868 /* LaunchScreen.storyboard */ = {
330 | isa = PBXVariantGroup;
331 | children = (
332 | 8152C1E91E1DF02E0088F868 /* Base */,
333 | );
334 | name = LaunchScreen.storyboard;
335 | sourceTree = "";
336 | };
337 | /* End PBXVariantGroup section */
338 |
339 | /* Begin XCBuildConfiguration section */
340 | 8152C2021E1DF02E0088F868 /* Debug */ = {
341 | isa = XCBuildConfiguration;
342 | buildSettings = {
343 | ALWAYS_SEARCH_USER_PATHS = NO;
344 | CLANG_ANALYZER_NONNULL = YES;
345 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
346 | CLANG_CXX_LIBRARY = "libc++";
347 | CLANG_ENABLE_MODULES = YES;
348 | CLANG_ENABLE_OBJC_ARC = YES;
349 | CLANG_WARN_BOOL_CONVERSION = YES;
350 | CLANG_WARN_CONSTANT_CONVERSION = YES;
351 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
352 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
353 | CLANG_WARN_EMPTY_BODY = YES;
354 | CLANG_WARN_ENUM_CONVERSION = YES;
355 | CLANG_WARN_INFINITE_RECURSION = YES;
356 | CLANG_WARN_INT_CONVERSION = YES;
357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
358 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
359 | CLANG_WARN_UNREACHABLE_CODE = YES;
360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
362 | COPY_PHASE_STRIP = NO;
363 | DEBUG_INFORMATION_FORMAT = dwarf;
364 | ENABLE_STRICT_OBJC_MSGSEND = YES;
365 | ENABLE_TESTABILITY = YES;
366 | GCC_C_LANGUAGE_STANDARD = gnu99;
367 | GCC_DYNAMIC_NO_PIC = NO;
368 | GCC_NO_COMMON_BLOCKS = YES;
369 | GCC_OPTIMIZATION_LEVEL = 0;
370 | GCC_PREPROCESSOR_DEFINITIONS = (
371 | "DEBUG=1",
372 | "$(inherited)",
373 | );
374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
376 | GCC_WARN_UNDECLARED_SELECTOR = YES;
377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
378 | GCC_WARN_UNUSED_FUNCTION = YES;
379 | GCC_WARN_UNUSED_VARIABLE = YES;
380 | IPHONEOS_DEPLOYMENT_TARGET = 10.2;
381 | MTL_ENABLE_DEBUG_INFO = YES;
382 | ONLY_ACTIVE_ARCH = YES;
383 | SDKROOT = iphoneos;
384 | TARGETED_DEVICE_FAMILY = "1,2";
385 | };
386 | name = Debug;
387 | };
388 | 8152C2031E1DF02E0088F868 /* Release */ = {
389 | isa = XCBuildConfiguration;
390 | buildSettings = {
391 | ALWAYS_SEARCH_USER_PATHS = NO;
392 | CLANG_ANALYZER_NONNULL = YES;
393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
394 | CLANG_CXX_LIBRARY = "libc++";
395 | CLANG_ENABLE_MODULES = YES;
396 | CLANG_ENABLE_OBJC_ARC = YES;
397 | CLANG_WARN_BOOL_CONVERSION = YES;
398 | CLANG_WARN_CONSTANT_CONVERSION = YES;
399 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
400 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
401 | CLANG_WARN_EMPTY_BODY = YES;
402 | CLANG_WARN_ENUM_CONVERSION = YES;
403 | CLANG_WARN_INFINITE_RECURSION = YES;
404 | CLANG_WARN_INT_CONVERSION = YES;
405 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
406 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
407 | CLANG_WARN_UNREACHABLE_CODE = YES;
408 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
409 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
410 | COPY_PHASE_STRIP = NO;
411 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
412 | ENABLE_NS_ASSERTIONS = NO;
413 | ENABLE_STRICT_OBJC_MSGSEND = YES;
414 | GCC_C_LANGUAGE_STANDARD = gnu99;
415 | GCC_NO_COMMON_BLOCKS = YES;
416 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
417 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
418 | GCC_WARN_UNDECLARED_SELECTOR = YES;
419 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
420 | GCC_WARN_UNUSED_FUNCTION = YES;
421 | GCC_WARN_UNUSED_VARIABLE = YES;
422 | IPHONEOS_DEPLOYMENT_TARGET = 10.2;
423 | MTL_ENABLE_DEBUG_INFO = NO;
424 | SDKROOT = iphoneos;
425 | TARGETED_DEVICE_FAMILY = "1,2";
426 | VALIDATE_PRODUCT = YES;
427 | };
428 | name = Release;
429 | };
430 | 8152C2051E1DF02E0088F868 /* Debug */ = {
431 | isa = XCBuildConfiguration;
432 | buildSettings = {
433 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
434 | DEVELOPMENT_TEAM = BVZZ9S8989;
435 | INFOPLIST_FILE = "UIBezierPath与CAShapeLayer/Info.plist";
436 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
437 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
438 | PRODUCT_BUNDLE_IDENTIFIER = "WOSHIPM.UIBezierPath-CAShapeLayer";
439 | PRODUCT_NAME = "$(TARGET_NAME)";
440 | };
441 | name = Debug;
442 | };
443 | 8152C2061E1DF02E0088F868 /* Release */ = {
444 | isa = XCBuildConfiguration;
445 | buildSettings = {
446 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
447 | DEVELOPMENT_TEAM = BVZZ9S8989;
448 | INFOPLIST_FILE = "UIBezierPath与CAShapeLayer/Info.plist";
449 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
451 | PRODUCT_BUNDLE_IDENTIFIER = "WOSHIPM.UIBezierPath-CAShapeLayer";
452 | PRODUCT_NAME = "$(TARGET_NAME)";
453 | };
454 | name = Release;
455 | };
456 | 8152C2081E1DF02E0088F868 /* Debug */ = {
457 | isa = XCBuildConfiguration;
458 | buildSettings = {
459 | BUNDLE_LOADER = "$(TEST_HOST)";
460 | INFOPLIST_FILE = "UIBezierPath与CAShapeLayerTests/Info.plist";
461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
462 | PRODUCT_BUNDLE_IDENTIFIER = "WOSHIPM.UIBezierPath-CAShapeLayerTests";
463 | PRODUCT_NAME = "$(TARGET_NAME)";
464 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIBezierPath与CAShapeLayer.app/UIBezierPath与CAShapeLayer";
465 | };
466 | name = Debug;
467 | };
468 | 8152C2091E1DF02E0088F868 /* Release */ = {
469 | isa = XCBuildConfiguration;
470 | buildSettings = {
471 | BUNDLE_LOADER = "$(TEST_HOST)";
472 | INFOPLIST_FILE = "UIBezierPath与CAShapeLayerTests/Info.plist";
473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
474 | PRODUCT_BUNDLE_IDENTIFIER = "WOSHIPM.UIBezierPath-CAShapeLayerTests";
475 | PRODUCT_NAME = "$(TARGET_NAME)";
476 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIBezierPath与CAShapeLayer.app/UIBezierPath与CAShapeLayer";
477 | };
478 | name = Release;
479 | };
480 | 8152C20B1E1DF02E0088F868 /* Debug */ = {
481 | isa = XCBuildConfiguration;
482 | buildSettings = {
483 | INFOPLIST_FILE = "UIBezierPath与CAShapeLayerUITests/Info.plist";
484 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
485 | PRODUCT_BUNDLE_IDENTIFIER = "WOSHIPM.UIBezierPath-CAShapeLayerUITests";
486 | PRODUCT_NAME = "$(TARGET_NAME)";
487 | TEST_TARGET_NAME = "UIBezierPath与CAShapeLayer";
488 | };
489 | name = Debug;
490 | };
491 | 8152C20C1E1DF02E0088F868 /* Release */ = {
492 | isa = XCBuildConfiguration;
493 | buildSettings = {
494 | INFOPLIST_FILE = "UIBezierPath与CAShapeLayerUITests/Info.plist";
495 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
496 | PRODUCT_BUNDLE_IDENTIFIER = "WOSHIPM.UIBezierPath-CAShapeLayerUITests";
497 | PRODUCT_NAME = "$(TARGET_NAME)";
498 | TEST_TARGET_NAME = "UIBezierPath与CAShapeLayer";
499 | };
500 | name = Release;
501 | };
502 | /* End XCBuildConfiguration section */
503 |
504 | /* Begin XCConfigurationList section */
505 | 8152C1D21E1DF02D0088F868 /* Build configuration list for PBXProject "UIBezierPath与CAShapeLayer" */ = {
506 | isa = XCConfigurationList;
507 | buildConfigurations = (
508 | 8152C2021E1DF02E0088F868 /* Debug */,
509 | 8152C2031E1DF02E0088F868 /* Release */,
510 | );
511 | defaultConfigurationIsVisible = 0;
512 | defaultConfigurationName = Release;
513 | };
514 | 8152C2041E1DF02E0088F868 /* Build configuration list for PBXNativeTarget "UIBezierPath与CAShapeLayer" */ = {
515 | isa = XCConfigurationList;
516 | buildConfigurations = (
517 | 8152C2051E1DF02E0088F868 /* Debug */,
518 | 8152C2061E1DF02E0088F868 /* Release */,
519 | );
520 | defaultConfigurationIsVisible = 0;
521 | defaultConfigurationName = Release;
522 | };
523 | 8152C2071E1DF02E0088F868 /* Build configuration list for PBXNativeTarget "UIBezierPath与CAShapeLayerTests" */ = {
524 | isa = XCConfigurationList;
525 | buildConfigurations = (
526 | 8152C2081E1DF02E0088F868 /* Debug */,
527 | 8152C2091E1DF02E0088F868 /* Release */,
528 | );
529 | defaultConfigurationIsVisible = 0;
530 | defaultConfigurationName = Release;
531 | };
532 | 8152C20A1E1DF02E0088F868 /* Build configuration list for PBXNativeTarget "UIBezierPath与CAShapeLayerUITests" */ = {
533 | isa = XCConfigurationList;
534 | buildConfigurations = (
535 | 8152C20B1E1DF02E0088F868 /* Debug */,
536 | 8152C20C1E1DF02E0088F868 /* Release */,
537 | );
538 | defaultConfigurationIsVisible = 0;
539 | defaultConfigurationName = Release;
540 | };
541 | /* End XCConfigurationList section */
542 | };
543 | rootObject = 8152C1CF1E1DF02D0088F868 /* Project object */;
544 | }
545 |
--------------------------------------------------------------------------------