├── PDEAGLLayerStudy
├── PDEAGLLayerStudy.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ └── xcschemes
│ │ ├── PDEAGLLayerStudy.xcscheme
│ │ └── xcschememanagement.plist
├── PDEAGLLayerStudy
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDEAGLLayerStudyTests
│ ├── Info.plist
│ └── PDEAGLLayerStudyTests.m
└── PDEAGLLayerStudyUITests
│ ├── Info.plist
│ └── PDEAGLLayerStudyUITests.m
├── PDGradientLayerStudy
├── PDGradientLayerStudy.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ └── xcschemes
│ │ ├── PDGradientLayerStudy.xcscheme
│ │ └── xcschememanagement.plist
├── PDGradientLayerStudy
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDGradientLayerStudyTests
│ ├── Info.plist
│ └── PDGradientLayerStudyTests.m
└── PDGradientLayerStudyUITests
│ ├── Info.plist
│ └── PDGradientLayerStudyUITests.m
├── PDReplicatorLayerStudy
├── PDReplicatorLayerStudy.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── PDReplicatorLayerStudy.xcscheme
│ │ └── xcschememanagement.plist
├── PDReplicatorLayerStudy
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ReflectionView.h
│ ├── ReflectionView.m
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDReplicatorLayerStudyTests
│ ├── Info.plist
│ └── PDReplicatorLayerStudyTests.m
└── PDReplicatorLayerStudyUITests
│ ├── Info.plist
│ └── PDReplicatorLayerStudyUITests.m
├── PDScrollLayerStudy
├── PDScrollLayerStudy.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── PDScrollLayerStudy.xcscheme
│ │ └── xcschememanagement.plist
├── PDScrollLayerStudy
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── PDScrollView.h
│ ├── PDScrollView.m
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDScrollLayerStudyTests
│ ├── Info.plist
│ └── PDScrollLayerStudyTests.m
└── PDScrollLayerStudyUITests
│ ├── Info.plist
│ └── PDScrollLayerStudyUITests.m
├── PDShapeLayerStudy
├── PDShapeLayerStudy.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ └── xcschemes
│ │ ├── PDShapeLayerStudy.xcscheme
│ │ └── xcschememanagement.plist
├── PDShapeLayerStudy
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── PDView.h
│ ├── PDView.m
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDShapeLayerStudyTests
│ ├── Info.plist
│ └── PDShapeLayerStudyTests.m
└── PDShapeLayerStudyUITests
│ ├── Info.plist
│ └── PDShapeLayerStudyUITests.m
├── PDTextLayerStudy
├── PDTextLayerStudy.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ └── xcschemes
│ │ ├── PDTextLayerStudy.xcscheme
│ │ └── xcschememanagement.plist
├── PDTextLayerStudy
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── PDLayerLabel.h
│ ├── PDLayerLabel.m
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDTextLayerStudyTests
│ ├── Info.plist
│ └── PDTextLayerStudyTests.m
└── PDTextLayerStudyUITests
│ ├── Info.plist
│ └── PDTextLayerStudyUITests.m
├── PDTiledLayerStudy
├── PDTiledLayerStudy.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ └── xcschemes
│ │ ├── PDTiledLayerStudy.xcscheme
│ │ └── xcschememanagement.plist
├── PDTiledLayerStudy
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDTiledLayerStudyTests
│ ├── Info.plist
│ └── PDTiledLayerStudyTests.m
└── PDTiledLayerStudyUITests
│ ├── Info.plist
│ └── PDTiledLayerStudyUITests.m
├── PDTransformLStudy
├── PDTransformLStudy.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ └── xcschemes
│ │ ├── PDTransformLStudy.xcscheme
│ │ └── xcschememanagement.plist
├── PDTransformLStudy
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDTransformLStudyTests
│ ├── Info.plist
│ └── PDTransformLStudyTests.m
└── PDTransformLStudyUITests
│ ├── Info.plist
│ └── PDTransformLStudyUITests.m
├── PDTransformLayerStudy
├── PDTransformLayerStudy.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ └── xcschemes
│ │ ├── PDTransformLayerStudy.xcscheme
│ │ └── xcschememanagement.plist
├── PDTransformLayerStudy
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDTransformLayerStudyTests
│ ├── Info.plist
│ └── PDTransformLayerStudyTests.m
└── PDTransformLayerStudyUITests
│ ├── Info.plist
│ └── PDTransformLayerStudyUITests.m
├── PDXianDuanAnimmation
├── PDXianDuanAnimmation.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── pengdong.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── pengdong.xcuserdatad
│ │ └── xcschemes
│ │ ├── PDXianDuanAnimmation.xcscheme
│ │ └── xcschememanagement.plist
├── PDXianDuanAnimmation
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ └── zx_up.imageset
│ │ │ ├── Contents.json
│ │ │ └── zx_up@2x.png
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── PDShapeLayer.h
│ ├── PDShapeLayer.m
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── PDXianDuanAnimmationTests
│ ├── Info.plist
│ └── PDXianDuanAnimmationTests.m
└── PDXianDuanAnimmationUITests
│ ├── Info.plist
│ └── PDXianDuanAnimmationUITests.m
└── README.md
/PDEAGLLayerStudy/PDEAGLLayerStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDEAGLLayerStudy/PDEAGLLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/PDEAGLLayerStudy.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 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDEAGLLayerStudy.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E747433A1D6565CF005EE024
16 |
17 | primary
18 |
19 |
20 | E74743531D6565CF005EE024
21 |
22 | primary
23 |
24 |
25 | E747435E1D6565CF005EE024
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDEAGLLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDEAGLLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy/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 | }
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy/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 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy/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 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDEAGLLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudy/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDEAGLLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudyTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudyTests/PDEAGLLayerStudyTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDEAGLLayerStudyTests.m
3 | // PDEAGLLayerStudyTests
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDEAGLLayerStudyTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDEAGLLayerStudyTests
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 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudyUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDEAGLLayerStudy/PDEAGLLayerStudyUITests/PDEAGLLayerStudyUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDEAGLLayerStudyUITests.m
3 | // PDEAGLLayerStudyUITests
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDEAGLLayerStudyUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDEAGLLayerStudyUITests
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 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDGradientLayerStudy/PDGradientLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDGradientLayerStudy.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E7B52C691D61E5CD00EE9F8F
16 |
17 | primary
18 |
19 |
20 | E7B52C821D61E5CD00EE9F8F
21 |
22 | primary
23 |
24 |
25 | E7B52C8D1D61E5CD00EE9F8F
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDGradientLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDGradientLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy/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 | }
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy/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 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy/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 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDGradientLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PDGradientLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | @interface ViewController ()
12 |
13 | @end
14 |
15 | @implementation ViewController
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 |
20 | UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
21 | containerView.backgroundColor = [UIColor redColor];
22 | [self.view addSubview:containerView];
23 |
24 | // 渐变色
25 | CAGradientLayer *gradientLayer = [CAGradientLayer layer];
26 | gradientLayer.frame = containerView.bounds;
27 | [containerView.layer addSublayer:gradientLayer];
28 |
29 | gradientLayer.colors = @[(__bridge id)[UIColor redColor].CGColor, (__bridge id)[UIColor greenColor].CGColor];
30 | gradientLayer.startPoint = CGPointMake(0, 0);
31 | gradientLayer.endPoint = CGPointMake(1, 1);
32 |
33 | // 多颜色渐变
34 | UIView *containView = [[UIView alloc] initWithFrame:CGRectMake(100, 400, 200, 200)];
35 | [self.view addSubview:containView];
36 |
37 | CAGradientLayer *conGradient = [CAGradientLayer layer];
38 | conGradient.frame = containView.bounds;
39 | [containView.layer addSublayer:conGradient];
40 |
41 | conGradient.colors = @[(__bridge id)[UIColor redColor].CGColor, (__bridge id)[UIColor greenColor].CGColor, (__bridge id)[UIColor yellowColor].CGColor, (__bridge id)[UIColor purpleColor].CGColor];
42 | conGradient.locations = @[@(0.0), @(0.25), @(0.4), @(0.7)];
43 | conGradient.startPoint = CGPointMake(0, 0);
44 | conGradient.endPoint = CGPointMake(1, 1);
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudy/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDGradientLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudyTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudyTests/PDGradientLayerStudyTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDGradientLayerStudyTests.m
3 | // PDGradientLayerStudyTests
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDGradientLayerStudyTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDGradientLayerStudyTests
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 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudyUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDGradientLayerStudy/PDGradientLayerStudyUITests/PDGradientLayerStudyUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDGradientLayerStudyUITests.m
3 | // PDGradientLayerStudyUITests
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDGradientLayerStudyUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDGradientLayerStudyUITests
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 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDReplicatorLayerStudy/PDReplicatorLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDReplicatorLayerStudy.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E7B52CA81D61E8BF00EE9F8F
16 |
17 | primary
18 |
19 |
20 | E7B52CC11D61E8BF00EE9F8F
21 |
22 | primary
23 |
24 |
25 | E7B52CCC1D61E8BF00EE9F8F
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDReplicatorLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDReplicatorLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/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 | }
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/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 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/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 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/ReflectionView.h:
--------------------------------------------------------------------------------
1 | //
2 | // ReflectionView.h
3 | // PDReplicatorLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ReflectionView : UIView
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/ReflectionView.m:
--------------------------------------------------------------------------------
1 | //
2 | // ReflectionView.m
3 | // PDReplicatorLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ReflectionView.h"
10 |
11 | @implementation ReflectionView
12 |
13 | + (Class)layerClass
14 | {
15 | return [CAReplicatorLayer class];
16 | }
17 |
18 | - (void)setUp
19 | {
20 | CAReplicatorLayer *layer = (CAReplicatorLayer *)self.layer;
21 | layer.instanceCount = 2;
22 |
23 | CATransform3D transform = CATransform3DIdentity;
24 | CGFloat verOffSet = self.bounds.size.height + 2;
25 | transform = CATransform3DTranslate(transform, 0, verOffSet, 0);
26 | transform = CATransform3DScale(transform, 1, -1, 0);
27 | layer.instanceTransform = transform;
28 |
29 | layer.instanceAlphaOffset = -0.6;
30 | }
31 |
32 | - (instancetype)initWithFrame:(CGRect)frame
33 | {
34 | self = [super initWithFrame:frame];
35 | if (self) {
36 | [self setUp];
37 | }
38 | return self;
39 | }
40 |
41 | - (void)awakeFromNib
42 | {
43 | [self setUp];
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDReplicatorLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PDReplicatorLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "ReflectionView.h"
11 |
12 | @interface ViewController ()
13 |
14 | @property (nonatomic, strong) UIView *containtView;
15 |
16 | @end
17 |
18 | @implementation ViewController
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 |
23 | /**
24 | * CAReplicatorLayer的目的是为了高效生成许多相似的图层。它会绘制一个或多个图层的子图层,并在每个复制体上应用不同的变换。
25 | */
26 | self.view.backgroundColor = [UIColor grayColor];
27 | UIView *containtView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
28 | [self.view addSubview:containtView];
29 | containtView.backgroundColor = [UIColor greenColor];
30 | self.containtView = containtView;
31 | [self createARCReplicator];
32 |
33 | ReflectionView *reflec = [[ReflectionView alloc] initWithFrame:CGRectMake(100, 300, 100, 100)];
34 | reflec.layer.backgroundColor = [UIColor redColor].CGColor;
35 | [self.view addSubview:reflec];
36 | }
37 |
38 | - (void)createARCReplicator
39 | {
40 | CAReplicatorLayer *replicator = [CAReplicatorLayer layer];
41 | replicator.backgroundColor = [UIColor purpleColor].CGColor;
42 | replicator.frame = self.containtView.bounds;
43 | [self.containtView.layer addSublayer:replicator];
44 |
45 | // 设置重复次数
46 | replicator.instanceCount = 10;
47 |
48 | // 设置梯度变化
49 | CATransform3D transform = CATransform3DIdentity;
50 | transform = CATransform3DTranslate(transform, 0, 200, 0);
51 | transform = CATransform3DRotate(transform, M_PI / 5.0, 0, 0, 1);
52 | transform = CATransform3DTranslate(transform, 0, -200, 0);
53 | replicator.instanceTransform = transform;
54 |
55 | replicator.instanceBlueOffset = -0.1;
56 | replicator.instanceGreenOffset = -0.1;
57 | replicator.instanceDelay = 0.5;
58 |
59 | CALayer *layer = [CALayer layer];
60 | layer.frame = CGRectMake(50, 50, 100, 100);
61 | layer.backgroundColor = [UIColor whiteColor].CGColor;
62 | [replicator addSublayer:layer];
63 | }
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudy/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDReplicatorLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudyTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudyTests/PDReplicatorLayerStudyTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDReplicatorLayerStudyTests.m
3 | // PDReplicatorLayerStudyTests
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDReplicatorLayerStudyTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDReplicatorLayerStudyTests
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 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudyUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDReplicatorLayerStudy/PDReplicatorLayerStudyUITests/PDReplicatorLayerStudyUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDReplicatorLayerStudyUITests.m
3 | // PDReplicatorLayerStudyUITests
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDReplicatorLayerStudyUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDReplicatorLayerStudyUITests
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 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDScrollLayerStudy/PDScrollLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDScrollLayerStudy.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E7B52D861D64540F00EE9F8F
16 |
17 | primary
18 |
19 |
20 | E7B52D9F1D64540F00EE9F8F
21 |
22 | primary
23 |
24 |
25 | E7B52DAA1D64540F00EE9F8F
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDScrollLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDScrollLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/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 | }
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/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 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/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 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/PDScrollView.h:
--------------------------------------------------------------------------------
1 | //
2 | // PDScrollView.h
3 | // PDScrollLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDScrollView : UIView
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/PDScrollView.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDScrollView.m
3 | // PDScrollLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "PDScrollView.h"
10 |
11 | @implementation PDScrollView
12 |
13 | + (Class)layerClass
14 | {
15 | return [CAScrollLayer class];
16 | }
17 |
18 | - (void)setUp {
19 | self.layer.masksToBounds = YES;
20 |
21 | UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(recognizerClicked:)];
22 | [self addGestureRecognizer:recognizer];
23 | }
24 |
25 | - (instancetype)initWithFrame:(CGRect)frame
26 | {
27 | self = [super initWithFrame:frame];
28 | if (self) {
29 | [self setUp];
30 | }
31 | return self;
32 | }
33 |
34 | - (void)awakeFromNib
35 | {
36 | [self setUp];
37 | }
38 |
39 | - (void)recognizerClicked:(UIPanGestureRecognizer *)recognizer
40 | {
41 | CGPoint offset = self.bounds.origin;
42 | offset.x -= [recognizer translationInView:self].x;
43 | offset.y -= [recognizer translationInView:self].y;
44 |
45 | [(CAScrollLayer *)self.layer scrollToPoint:offset];
46 | [recognizer setTranslation:CGPointZero inView:self];
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDScrollLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PDScrollLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "PDScrollView.h"
11 |
12 | @interface ViewController ()
13 |
14 | @end
15 |
16 | @implementation ViewController
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 |
21 | PDScrollView *scrollView = [[PDScrollView alloc] initWithFrame:CGRectMake(50, 100, 200, 200)];
22 | scrollView.backgroundColor = [UIColor grayColor];
23 | [self.view addSubview:scrollView];
24 |
25 | UIView *subView = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 100, 100)];
26 | subView.backgroundColor = [UIColor redColor];
27 | [scrollView addSubview:subView];
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudy/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDScrollLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudyTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudyTests/PDScrollLayerStudyTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDScrollLayerStudyTests.m
3 | // PDScrollLayerStudyTests
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDScrollLayerStudyTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDScrollLayerStudyTests
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 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudyUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDScrollLayerStudy/PDScrollLayerStudyUITests/PDScrollLayerStudyUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDScrollLayerStudyUITests.m
3 | // PDScrollLayerStudyUITests
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDScrollLayerStudyUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDScrollLayerStudyUITests
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 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDShapeLayerStudy/PDShapeLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/PDShapeLayerStudy.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 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDShapeLayerStudy.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E7FDFC291D5C2AED002B8A05
16 |
17 | primary
18 |
19 |
20 | E7FDFC421D5C2AED002B8A05
21 |
22 | primary
23 |
24 |
25 | E7FDFC4D1D5C2AED002B8A05
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDShapeLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDShapeLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/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 | }
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/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 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/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 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/PDView.h:
--------------------------------------------------------------------------------
1 | //
2 | // PDView.h
3 | // PDShapeLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDView : UIView
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/PDView.m:
--------------------------------------------------------------------------------
1 |
2 | //
3 | // PDView.m
4 | // PDShapeLayerStudy
5 | //
6 | // Created by 彭懂 on 16/8/11.
7 | // Copyright © 2016年 彭懂. All rights reserved.
8 | //
9 |
10 | #import "PDView.h"
11 |
12 | @implementation PDView
13 |
14 | /*
15 | // Only override drawRect: if you perform custom drawing.
16 | // An empty implementation adversely affects performance during animation.
17 | */
18 | - (void)drawRect:(CGRect)rect {
19 | // Drawing code
20 |
21 |
22 | CGContextRef context = UIGraphicsGetCurrentContext();
23 |
24 | CGRect currentBounds = self.bounds;
25 |
26 | CGGradientRef backgroundGradient;
27 |
28 | size_t num_locations = 2;
29 |
30 | CGFloat locations[2] = { 0.0, 1.0 };
31 |
32 | CGFloat components[8] = { 0.5, 0.5, 0.5, 0.0, // Start color
33 |
34 | 0.0, 0.0, 0.0, 0.6
35 |
36 | }; // End color
37 |
38 | CGColorSpaceRef rgbColorspace = CGColorSpaceCreateDeviceRGB();
39 |
40 | backgroundGradient = CGGradientCreateWithColorComponents (rgbColorspace, components, locations, num_locations);
41 |
42 | CGPoint centerPoint = CGPointMake(CGRectGetMidX(currentBounds), CGRectGetMidY(currentBounds));
43 |
44 | CGContextDrawRadialGradient (context, backgroundGradient, centerPoint, 0.0, centerPoint, currentBounds.size.width, kCGGradientDrawsAfterEndLocation);
45 |
46 | CGGradientRelease(backgroundGradient);
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDShapeLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PDShapeLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | #import "PDView.h"
12 |
13 | @interface ViewController ()
14 |
15 | @end
16 |
17 | @implementation ViewController
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 | /**
22 | * CAShapeLayer: 使用CGPath去构造任意形状的阴影 是通过矢量图形而不是bitmap来绘制的图层子类
23 |
24 | 优点:
25 | 1.渲染速度快,CAShapeLayer使用了硬件加速,绘制同一个图形会比用Core Graphics快很多
26 | 2.高效使用内存,不需要创建一个寄宿图形
27 | 3.不会被图层边界剪裁掉,可以在边界外绘制
28 | 4.不会出现像素化,当你给CAShapeLayer做3d变化时,它不像一个有寄宿图的普通图层一样变得像素化
29 | */
30 | // 创建一个火柴人
31 | // [self createFearPeple];
32 |
33 | // [self createARCStudy];
34 |
35 | // PDView * v = [[PDView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
36 | // [self.view addSubview:v];
37 |
38 | [self createTeShuText];
39 | }
40 |
41 | - (void)createTeShuText
42 | {
43 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 200, 100)];
44 | [self.view addSubview:label];
45 |
46 | NSShadow *shadow = [[NSShadow alloc] init];
47 | shadow.shadowBlurRadius = 1;
48 | shadow.shadowColor = [UIColor blueColor];
49 | shadow.shadowOffset = CGSizeMake(2, 4);
50 | label.textColor = [UIColor redColor];
51 | NSDictionary *dic = @{
52 | NSFontAttributeName: [UIFont boldSystemFontOfSize:50],
53 | NSStrokeWidthAttributeName: @(-5),
54 | NSStrokeColorAttributeName: [UIColor purpleColor],
55 | NSShadowAttributeName: shadow,
56 | NSVerticalGlyphFormAttributeName: @(0)
57 | };
58 | NSAttributedString *str = [[NSAttributedString alloc] initWithString:@"2434" attributes:dic];
59 | label.attributedText = str;
60 | // setAnimationRepeatCount
61 | }
62 |
63 | /**
64 | * 创建一个火柴人
65 | */
66 | - (void)createFearPeple
67 | {
68 | UIBezierPath *path = [[UIBezierPath alloc] init];
69 | [path moveToPoint:CGPointMake(175, 100)];
70 | [path addArcWithCenter:CGPointMake(150, 100) radius:25 startAngle:0 endAngle:2 * M_PI clockwise:YES];
71 | [path moveToPoint:CGPointMake(150, 125)];
72 | [path addLineToPoint:CGPointMake(150, 175)];
73 | [path addLineToPoint:CGPointMake(125, 225)];
74 | [path moveToPoint:CGPointMake(150, 175)];
75 | [path addLineToPoint:CGPointMake(175, 225)];
76 | [path moveToPoint:CGPointMake(100, 150)];
77 | [path addLineToPoint:CGPointMake(200, 150)];
78 |
79 | // 创建 shape layer
80 | CAShapeLayer *shapeLayer = [CAShapeLayer layer];
81 | shapeLayer.strokeColor = [UIColor redColor].CGColor;
82 | shapeLayer.fillColor = [UIColor clearColor].CGColor;
83 | shapeLayer.lineWidth = 5;
84 | shapeLayer.lineJoin = kCALineJoinRound;
85 | shapeLayer.lineCap = kCALineCapRound;
86 | shapeLayer.path = path.CGPath;
87 |
88 | [self.view.layer addSublayer:shapeLayer];
89 | }
90 |
91 | /**
92 | * 圆角,可以单独指定一个角
93 | */
94 | - (void)createARCStudy
95 | {
96 | UIView *baseView = [[UIView alloc] initWithFrame:CGRectMake(50, 200, 100, 100)];
97 | // baseView.backgroundColor = [UIColor redColor];
98 | [self.view addSubview:baseView];
99 |
100 | UIView *subView = [[UIView alloc] initWithFrame:CGRectMake(-50, -50, 100, 100)];
101 | subView.backgroundColor = [UIColor purpleColor];
102 | [baseView addSubview:subView];
103 |
104 | CGRect rect = baseView.bounds;
105 | CGSize radii = CGSizeMake(20, 20);
106 | UIRectCorner corners = UIRectCornerTopLeft | UIRectCornerTopRight;
107 | UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corners cornerRadii:radii];
108 |
109 | CAShapeLayer *shapeLayer = [CAShapeLayer layer];
110 | shapeLayer.strokeColor = [UIColor redColor].CGColor;
111 | shapeLayer.fillColor = [UIColor cyanColor].CGColor;
112 | shapeLayer.lineWidth = 5;
113 | shapeLayer.lineJoin = kCALineJoinRound;
114 | shapeLayer.lineCap = kCALineCapRound;
115 | shapeLayer.path = path.CGPath;
116 |
117 | baseView.layer.mask = shapeLayer;
118 | }
119 |
120 | @end
121 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudy/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDShapeLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudyTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudyTests/PDShapeLayerStudyTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDShapeLayerStudyTests.m
3 | // PDShapeLayerStudyTests
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDShapeLayerStudyTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDShapeLayerStudyTests
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 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudyUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDShapeLayerStudy/PDShapeLayerStudyUITests/PDShapeLayerStudyUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDShapeLayerStudyUITests.m
3 | // PDShapeLayerStudyUITests
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDShapeLayerStudyUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDShapeLayerStudyUITests
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 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDTextLayerStudy/PDTextLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/PDTextLayerStudy.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 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDTextLayerStudy.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E7FDFC681D5C3C1A002B8A05
16 |
17 | primary
18 |
19 |
20 | E7FDFC811D5C3C1A002B8A05
21 |
22 | primary
23 |
24 |
25 | E7FDFC8C1D5C3C1A002B8A05
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDTextLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDTextLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/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 | }
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/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 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/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 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/PDLayerLabel.h:
--------------------------------------------------------------------------------
1 | //
2 | // PDLayerLabel.h
3 | // PDTextLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDLayerLabel : UILabel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/PDLayerLabel.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDLayerLabel.m
3 | // PDTextLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "PDLayerLabel.h"
10 |
11 | @implementation PDLayerLabel
12 |
13 | /**
14 | * 把CATextLayer作为宿主图层的另一个好处是视图自动设置了contentsScale属性
15 | */
16 |
17 | /**
18 | * 将CATextLayer作为宿主图层
19 | */
20 | + (Class)layerClass
21 | {
22 | return [CATextLayer class];
23 | }
24 |
25 | - (CATextLayer *)textLayer
26 | {
27 | return (CATextLayer *)self.layer;
28 | }
29 |
30 | - (void)setUp
31 | {
32 | self.text = self.text;
33 | self.textColor = self.textColor;
34 | self.font = self.font;
35 |
36 | [self textLayer].alignmentMode = kCAAlignmentJustified;
37 | [self textLayer].wrapped = YES;
38 | [self.layer display];
39 | }
40 |
41 | - (instancetype)initWithFrame:(CGRect)frame
42 | {
43 | self = [super initWithFrame:frame];
44 | if (self) {
45 | [self setUp];
46 | }
47 | return self;
48 | }
49 |
50 | - (void)setText:(NSString *)text
51 | {
52 | super.text = text;
53 | [self textLayer].string = text;
54 | }
55 |
56 | - (void)setTextColor:(UIColor *)textColor
57 | {
58 | super.textColor = textColor;
59 |
60 | [self textLayer].foregroundColor = textColor.CGColor;
61 | }
62 |
63 | - (void)setFont:(UIFont *)font
64 | {
65 | super.font = font;
66 | CFStringRef fontName = (__bridge CFStringRef)font.fontName;
67 | CGFontRef fontRef = CGFontCreateWithFontName(fontName);
68 | [self textLayer].font = fontRef;
69 | [self textLayer].fontSize = font.pointSize;
70 | CGFontRelease(fontRef);
71 | }
72 |
73 | /*
74 | // Only override drawRect: if you perform custom drawing.
75 | // An empty implementation adversely affects performance during animation.
76 | - (void)drawRect:(CGRect)rect {
77 | // Drawing code
78 | }
79 | */
80 |
81 | @end
82 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDTextLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PDTextLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import
11 | #import
12 |
13 | #import "PDLayerLabel.h"
14 |
15 | @interface ViewController ()
16 |
17 | @end
18 |
19 | @implementation ViewController
20 |
21 | - (void)viewDidLoad {
22 | [super viewDidLoad];
23 |
24 | /**
25 | * CATextLayer Core Animation 提供一个CALayer的子类CATextLayer,它以图层的形式包含了UILabel几乎所用的绘制特性,并且额外提供一些新的特性 渲染快
26 | 在iOS 6之前的版本,UIlabel其实是通过WebKit实现,性能很差
27 | */
28 | // [self createLabelWithTextLayer];
29 |
30 | [self fuwenben];
31 |
32 | [self createPDLayerText];
33 | }
34 |
35 | /**
36 | * 创建一个label 用TextLayer的方式
37 | */
38 | - (void)createLabelWithTextLayer
39 | {
40 | UIView *labelView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
41 | labelView.backgroundColor = [UIColor whiteColor];
42 | [self.view addSubview:labelView];
43 |
44 | CATextLayer *textLayer = [CATextLayer layer];
45 | textLayer.frame = labelView.bounds;
46 | [labelView.layer addSublayer:textLayer];
47 |
48 | // 设置text 属性文字
49 | textLayer.foregroundColor = [UIColor blackColor].CGColor;
50 | textLayer.alignmentMode = kCAAlignmentJustified;
51 | textLayer.wrapped = YES;
52 |
53 | UIFont *font = [UIFont systemFontOfSize:15];
54 |
55 | CFStringRef fontName = (__bridge CFStringRef)font.fontName;
56 | CGFontRef fontRef = CGFontCreateWithFontName(fontName);
57 | textLayer.font = fontRef;
58 | textLayer.fontSize = font.pointSize;
59 | CGFontRelease(fontRef);
60 |
61 | NSString *text = @"jdkj LLJK kjfbvjL Longa Ijkfgjld";
62 | textLayer.string = text;
63 | textLayer.contentsScale = [UIScreen mainScreen].scale;
64 | }
65 |
66 | /**
67 | * 富文本
68 | */
69 | - (void)fuwenben
70 | {
71 | UIView *labelView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
72 | labelView.backgroundColor = [UIColor whiteColor];
73 | [self.view addSubview:labelView];
74 |
75 | CATextLayer *textLayer = [CATextLayer layer];
76 | textLayer.frame = labelView.bounds;
77 | textLayer.contentsScale = [UIScreen mainScreen].scale;
78 | [labelView.layer addSublayer:textLayer];
79 |
80 | textLayer.alignmentMode = kCAAlignmentJustified;
81 | textLayer.wrapped = YES;
82 |
83 | UIFont *font = [UIFont systemFontOfSize:15];
84 | NSString *text = @"FDDXCVCC FCBV HBVVC GFFGDNCXJK NKLDJAFSLJSCK NASJKDF V;SD K;FSADJKF FJS ADFX";
85 | NSMutableAttributedString *string = nil;
86 | string = [[NSMutableAttributedString alloc] initWithString:text];
87 |
88 | CFStringRef fontName = (__bridge CFStringRef)font.fontName;
89 | CGFloat fontSize = font.pointSize;
90 | CTFontRef fontRef = CTFontCreateWithName(fontName, fontSize, NULL);
91 |
92 | NSDictionary *attribs = @{
93 | (__bridge id)kCTForegroundColorAttributeName:(__bridge id)[UIColor blackColor].CGColor,
94 | (__bridge id)kCTFontAttributeName:(__bridge id)fontRef
95 | };
96 | [string setAttributes:attribs range:NSMakeRange(0, [text length])];
97 | attribs = @{
98 | (__bridge id)kCTForegroundColorAttributeName: (__bridge id)[UIColor redColor].CGColor,
99 | (__bridge id)kCTUnderlineStyleAttributeName: @(kCTUnderlineStyleSingle),
100 | (__bridge id)kCTFontAttributeName: (__bridge id)fontRef
101 | };
102 | [string setAttributes:attribs range:NSMakeRange(3, 9)];
103 | CFRelease(fontRef);
104 |
105 | textLayer.string = string;
106 | }
107 |
108 | /**
109 | * 创建一个自定义文字
110 | */
111 | - (void)createPDLayerText
112 | {
113 | PDLayerLabel *label = [[PDLayerLabel alloc] initWithFrame:CGRectMake(50, 400, 200, 200)];
114 | label.text = @"放大看了觉得不浪费V型处理可能";
115 | [self.view addSubview:label];
116 | }
117 |
118 | @end
119 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudy/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDTextLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudyTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudyTests/PDTextLayerStudyTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDTextLayerStudyTests.m
3 | // PDTextLayerStudyTests
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDTextLayerStudyTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDTextLayerStudyTests
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 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudyUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDTextLayerStudy/PDTextLayerStudyUITests/PDTextLayerStudyUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDTextLayerStudyUITests.m
3 | // PDTextLayerStudyUITests
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDTextLayerStudyUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDTextLayerStudyUITests
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 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDTiledLayerStudy/PDTiledLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/PDTiledLayerStudy.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 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDTiledLayerStudy.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E74742FB1D655A4C005EE024
16 |
17 | primary
18 |
19 |
20 | E74743141D655A4C005EE024
21 |
22 | primary
23 |
24 |
25 | E747431F1D655A4C005EE024
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDTiledLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDTiledLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy/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 | }
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy/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 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy/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 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDTiledLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PDTiledLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | @interface ViewController ()
12 |
13 | @end
14 |
15 | @implementation ViewController
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 | // Do any additional setup after loading the view, typically from a nib.
20 | }
21 |
22 | - (void)didReceiveMemoryWarning {
23 | [super didReceiveMemoryWarning];
24 | // Dispose of any resources that can be recreated.
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudy/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDTiledLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudyTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudyTests/PDTiledLayerStudyTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDTiledLayerStudyTests.m
3 | // PDTiledLayerStudyTests
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDTiledLayerStudyTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDTiledLayerStudyTests
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 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudyUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDTiledLayerStudy/PDTiledLayerStudyUITests/PDTiledLayerStudyUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDTiledLayerStudyUITests.m
3 | // PDTiledLayerStudyUITests
4 | //
5 | // Created by 彭懂 on 16/8/18.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDTiledLayerStudyUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDTiledLayerStudyUITests
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 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDTransformLStudy/PDTransformLStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDTransformLStudy.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E7B52C2A1D61DD3500EE9F8F
16 |
17 | primary
18 |
19 |
20 | E7B52C431D61DD3500EE9F8F
21 |
22 | primary
23 |
24 |
25 | E7B52C4E1D61DD3500EE9F8F
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDTransformLStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDTransformLStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy/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 | }
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy/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 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy/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 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDTransformLStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PDTransformLStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | @interface ViewController ()
12 |
13 | @property (nonatomic, strong) UIView *containtView;
14 |
15 | @end
16 |
17 | @implementation ViewController
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 | CATransform3D pt = CATransform3DIdentity;
22 | pt.m34 = -1 / 500.0;
23 |
24 | UIView *contantView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
25 | contantView.backgroundColor = [UIColor redColor];
26 | [self.view addSubview:contantView];
27 | self.containtView = contantView;
28 |
29 | contantView.layer.sublayerTransform = pt;
30 |
31 | CATransform3D c1t = CATransform3DIdentity;
32 | c1t = CATransform3DTranslate(c1t, -100, 0, 0);
33 | CALayer *cube1 = [self cubeWithTransform:c1t];
34 | [self.containtView.layer addSublayer:cube1];
35 |
36 | //set up the transform for cube 2 and add it
37 | CATransform3D c2t = CATransform3DIdentity;
38 | c2t = CATransform3DTranslate(c2t, 100, 0, 0);
39 | c2t = CATransform3DRotate(c2t, -M_PI_4, 1, 0, 0);
40 | c2t = CATransform3DRotate(c2t, -M_PI_4, 0, 1, 0);
41 | CALayer *cube2 = [self cubeWithTransform:c2t];
42 | [self.containtView.layer addSublayer:cube2];
43 | }
44 |
45 | - (CALayer *)cubeWithTransform:(CATransform3D)transform
46 | {
47 | CATransformLayer *cube = [CATransformLayer layer];
48 | CATransform3D ct = CATransform3DMakeTranslation(0, 0, 50);
49 | [cube addSublayer:[self faceWithTransform:ct]];
50 |
51 | ct = CATransform3DMakeTranslation(50, 0, 0);
52 | ct = CATransform3DRotate(ct, M_PI_2, 0, 1, 0);
53 | [cube addSublayer:[self faceWithTransform:ct]];
54 |
55 | ct = CATransform3DMakeTranslation(0, -50, 0);
56 | ct = CATransform3DRotate(ct, M_PI_2, 1, 0, 0);
57 | [cube addSublayer:[self faceWithTransform:ct]];
58 |
59 | //add cube face 4
60 | ct = CATransform3DMakeTranslation(0, 50, 0);
61 | ct = CATransform3DRotate(ct, -M_PI_2, 1, 0, 0);
62 | [cube addSublayer:[self faceWithTransform:ct]];
63 |
64 | //add cube face 5
65 | ct = CATransform3DMakeTranslation(-50, 0, 0);
66 | ct = CATransform3DRotate(ct, -M_PI_2, 0, 1, 0);
67 | [cube addSublayer:[self faceWithTransform:ct]];
68 |
69 | //add cube face 6
70 | ct = CATransform3DMakeTranslation(0, 0, -50);
71 | ct = CATransform3DRotate(ct, M_PI, 0, 1, 0);
72 | [cube addSublayer:[self faceWithTransform:ct]];
73 |
74 | //center the cube layer within the container
75 | CGSize containerSize = self.containtView.bounds.size;
76 | cube.position = CGPointMake(containerSize.width / 2.0, containerSize.height / 2.0);
77 |
78 | //apply the transform and return
79 | cube.transform = transform;
80 | return cube;
81 | }
82 |
83 | - (CALayer *)faceWithTransform:(CATransform3D)transform
84 | {
85 | CALayer *face = [CALayer layer];
86 | face.frame = CGRectMake(-50, -50, 100, 100);
87 | CGFloat red = (rand() / (double)INT_MAX);
88 | CGFloat green = (rand() / (double)INT_MAX);
89 | CGFloat blue = (rand() / (double)INT_MAX);
90 | face.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:1.0].CGColor;
91 | face.transform = transform;
92 | return face;
93 | }
94 |
95 | @end
96 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudy/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDTransformLStudy
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudyTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudyTests/PDTransformLStudyTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDTransformLStudyTests.m
3 | // PDTransformLStudyTests
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDTransformLStudyTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDTransformLStudyTests
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 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudyUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDTransformLStudy/PDTransformLStudyUITests/PDTransformLStudyUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDTransformLStudyUITests.m
3 | // PDTransformLStudyUITests
4 | //
5 | // Created by 彭懂 on 16/8/15.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDTransformLStudyUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDTransformLStudyUITests
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 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDTransformLayerStudy/PDTransformLayerStudy.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDTransformLayerStudy.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E7FDFCAA1D5C64DF002B8A05
16 |
17 | primary
18 |
19 |
20 | E7FDFCC31D5C64DF002B8A05
21 |
22 | primary
23 |
24 |
25 | E7FDFCCE1D5C64DF002B8A05
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDTransformLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDTransformLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy/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 | }
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy/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 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy/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 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDTransformLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PDTransformLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | @interface ViewController ()
12 |
13 | @end
14 |
15 | @implementation ViewController
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 |
20 | /**
21 | * 当我们在构造复杂的3D事物的时候,如果能够组织独立元素就太方便了
22 | */
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudy/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDTransformLayerStudy
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudyTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudyTests/PDTransformLayerStudyTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDTransformLayerStudyTests.m
3 | // PDTransformLayerStudyTests
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDTransformLayerStudyTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDTransformLayerStudyTests
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 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudyUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDTransformLayerStudy/PDTransformLayerStudyUITests/PDTransformLayerStudyUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDTransformLayerStudyUITests.m
3 | // PDTransformLayerStudyUITests
4 | //
5 | // Created by 彭懂 on 16/8/11.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDTransformLayerStudyUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDTransformLayerStudyUITests
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 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDXianDuanAnimmation/PDXianDuanAnimmation.xcodeproj/project.xcworkspace/xcuserdata/pengdong.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PDXianDuanAnimmation.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | E7B52D001D641D8800EE9F8F
16 |
17 | primary
18 |
19 |
20 | E7B52D191D641D8800EE9F8F
21 |
22 | primary
23 |
24 |
25 | E7B52D241D641D8800EE9F8F
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PDXianDuanAnimmation
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PDXianDuanAnimmation
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/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 | "idiom" : "ipad",
65 | "size" : "83.5x83.5",
66 | "scale" : "2x"
67 | }
68 | ],
69 | "info" : {
70 | "version" : 1,
71 | "author" : "xcode"
72 | }
73 | }
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/Assets.xcassets/zx_up.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "zx_up@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/Assets.xcassets/zx_up.imageset/zx_up@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pdcodeunder/LayerStudy/b53871970e47d7599299d660cf76c2aff2e163fa/PDXianDuanAnimmation/PDXianDuanAnimmation/Assets.xcassets/zx_up.imageset/zx_up@2x.png
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/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 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/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 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/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 | 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 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/PDShapeLayer.h:
--------------------------------------------------------------------------------
1 | //
2 | // PDShapeLayer.h
3 | // PDXianDuanAnimmation
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface PDShapeLayer : CAShapeLayer
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/PDShapeLayer.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDShapeLayer.m
3 | // PDXianDuanAnimmation
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "PDShapeLayer.h"
10 |
11 | @interface PDShapeLayer ()
12 |
13 | @property (nonatomic, strong) UIBezierPath *rectangleFullPath;
14 |
15 | @end
16 |
17 | static const CGFloat KLineWidth = 5.0;
18 |
19 | @implementation PDShapeLayer
20 |
21 | - (instancetype)init
22 | {
23 | self = [super init];
24 | if (self) {
25 | self.fillColor = [UIColor clearColor].CGColor;
26 | self.strokeColor = [UIColor whiteColor].CGColor;
27 | self.lineWidth = KLineWidth;
28 | self.path = self.rectangleFullPath.CGPath;
29 | self.lineCap = kCALineCapRound;
30 | self.lineDashPattern = @[@13, @6, @(-2), @165];
31 |
32 | CABasicAnimation *strokeAnimation = [CABasicAnimation animationWithKeyPath:@"lineDashPhase"];
33 | strokeAnimation.fromValue = @800.0;
34 | strokeAnimation.toValue = @0.0;
35 | strokeAnimation.duration = 8;
36 | strokeAnimation.removedOnCompletion = NO;
37 | strokeAnimation.repeatCount = INT_MAX;
38 | [self addAnimation:strokeAnimation forKey:nil];
39 | }
40 | return self;
41 | }
42 |
43 | - (UIBezierPath *)rectangleFullPath
44 | {
45 | if (!_rectangleFullPath) {
46 | UIRectCorner rectCorner = UIRectCornerAllCorners;
47 | _rectangleFullPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 105, 79) byRoundingCorners:rectCorner cornerRadii:CGSizeMake(10, 10)];
48 | }
49 | return _rectangleFullPath;
50 | }
51 |
52 |
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PDXianDuanAnimmation
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PDXianDuanAnimmation
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | #import "PDShapeLayer.h"
12 |
13 | @interface ViewController ()
14 |
15 | @end
16 |
17 | @implementation ViewController
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 | // Do any additional setup after loading the view, typically from a nib.
22 |
23 | PDShapeLayer *shLayer= [[PDShapeLayer alloc] init];
24 | shLayer.frame = CGRectMake(100, 100, 200, 200);
25 | [self.view.layer addSublayer:shLayer];
26 | }
27 |
28 | - (void)didReceiveMemoryWarning {
29 | [super didReceiveMemoryWarning];
30 | // Dispose of any resources that can be recreated.
31 | }
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmation/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PDXianDuanAnimmation
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. 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 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmationTests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmationTests/PDXianDuanAnimmationTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDXianDuanAnimmationTests.m
3 | // PDXianDuanAnimmationTests
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDXianDuanAnimmationTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDXianDuanAnimmationTests
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 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmationUITests/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 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/PDXianDuanAnimmation/PDXianDuanAnimmationUITests/PDXianDuanAnimmationUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // PDXianDuanAnimmationUITests.m
3 | // PDXianDuanAnimmationUITests
4 | //
5 | // Created by 彭懂 on 16/8/17.
6 | // Copyright © 2016年 彭懂. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface PDXianDuanAnimmationUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation PDXianDuanAnimmationUITests
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LayerStudy
2 | # 专用图层(各种layer子类的学习)
3 | ## CAShapeLayer
4 |
5 | `CAShapeLayer`是一个通过矢量图形而不是bitmap来绘制的图层子类。你指定诸如颜色和线宽等属性,用CGPath来定义想要绘制的图形,最后'CAShapeLayer'就自动渲染出来了
6 |
7 |
8 | ## CATextLayer
9 |
10 | 它以图层的形式包含了`UILabel`几乎所有的绘制特性,并且额外提供了一些新的特性。同样,`CATextLayer`也要比UILabel渲染得快得多。很少有人知道在iOS 6及之前的版本,`UILabel`其实是通过WebKit来实现绘制的,这样就造成了当有很多文字的时候就会有极大的性能压力。而`CATextLayer`使用了Core text,并且渲染得非常快。
11 |
12 |
13 | ## CATransformLayer
14 |
15 | `CATransformLayer`不同于普通的`CALayer`,因为它不能显示它自己的内容。只有当存在了一个能作用域子图层的变换它才真正存在。`CATransformLayer`并不平面化它的子图层,所以它能够用于构造一个层级的3D结构,比如我的手臂示例
16 |
17 |
18 | ## CAGradientLayer
19 |
20 | `CAGradientLayer`是用来生成两种或更多颜色平滑渐变的。用Core Graphics复制一个`CAGradientLayer`并将内容绘制到一个普通图层的寄宿图也是有可能的,但是'CAGradientLayer'的真正好处在于绘制使用了硬件加速。
21 |
22 |
23 | ## CAReplicatorLayer
24 |
25 | `CAReplicatorLayer`的目的是为了高效生成许多相似的图层。它会绘制一个或多个图层的子图层,并在每个复制体上应用不同的变换。
26 |
27 |
28 | ## CAScrollLayer
29 |
30 | `CAScrollLayer`有一个`-scrollToPoint:`方法,它自动适应bounds的原点以便图层内容出现在滑动的地方。注意,这就是它做的所有事情。前面提到过,Core Animation并不处理用户输入,所以`CAScrollLayer`并不负责将触摸事件转换为滑动事件,既不渲染滚动条,也不实现任何iOS指定行为例如滑动反弹(当视图滑动超多了它的边界的将会反弹回正确的地方
31 |
32 |
33 | ## CATiledLayer
34 |
35 | `CATiledLayer`为载入大图造成的性能问题提供了一个解决方案:将大图分解成小片然后将他们单独按需载入。
36 |
37 |
38 | ## CAEmitterLayer
39 |
40 | `CAEmitterLayer`是一个高性能的粒子引擎,被用来创建实时例子动画如:烟雾,火,雨等等这些效果。
41 |
42 |
43 | ## CAEAGLLayer
44 |
45 | 苹果引入了一个新的框架叫做`GLKit`,它去掉了一些设置OpenGL的复杂性,提供了一个叫做`CLKView`的`UIView`的子类,帮你处理大部分的设置和绘制工作。前提是各种各样的OpenGL绘图缓冲的底层可配置项仍然需要你用`CAEAGLLayer`完成,它是`CALayer`的一个子类,用来显示任意的OpenGL图形。
46 |
--------------------------------------------------------------------------------