├── ColorM
├── ColorM.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── gongwenkai.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── gongwenkai.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── ColorM.xcscheme
│ │ └── xcschememanagement.plist
├── ColorM
│ ├── AdSupportTableViewController.h
│ ├── AdSupportTableViewController.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── AppIcon60x60@2x.png
│ │ │ ├── AppIcon60x60@3x.png
│ │ │ ├── Contents.json
│ │ │ ├── icon-20@2x.png
│ │ │ ├── icon-20@3x.png
│ │ │ ├── icon-29@2x.png
│ │ │ ├── icon-29@3x.png
│ │ │ ├── icon-40@2x.png
│ │ │ └── icon-40@3x.png
│ │ ├── Contents.json
│ │ ├── icon_custom_.imageset
│ │ │ ├── Contents.json
│ │ │ ├── icon_custom_@2x.png
│ │ │ └── icon_custom_@3x.png
│ │ ├── icon_fav_.imageset
│ │ │ ├── Contents.json
│ │ │ ├── icon_fav_@2x.png
│ │ │ └── icon_fav_@3x.png
│ │ ├── icon_picker_.imageset
│ │ │ ├── Contents.json
│ │ │ ├── icon_picker_@2x.png
│ │ │ └── icon_picker_@3x.png
│ │ └── tabbarBkg_5x49_.imageset
│ │ │ ├── Contents.json
│ │ │ └── tabbarBkg_5x49_@2x.png
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── ColorFavCellModel.h
│ ├── ColorFavCellModel.m
│ ├── ColorFavTableViewCell.h
│ ├── ColorFavTableViewCell.m
│ ├── ColorFavTableViewCell.xib
│ ├── ColorFavTableViewController.h
│ ├── ColorFavTableViewController.m
│ ├── ColorM.xcdatamodeld
│ │ ├── .xccurrentversion
│ │ └── ColorM.xcdatamodel
│ │ │ └── contents
│ ├── ColorPickCellModel.h
│ ├── ColorPickCellModel.m
│ ├── ColorPickDetailTableViewController.h
│ ├── ColorPickDetailTableViewController.m
│ ├── ColorPickMaseterModel.h
│ ├── ColorPickMaseterModel.m
│ ├── ColorPickMasterTableViewController.h
│ ├── ColorPickMasterTableViewController.m
│ ├── ColorPickTableViewCell.h
│ ├── ColorPickTableViewCell.m
│ ├── ColorPickTableViewCell.xib
│ ├── ColorPrefixHeader.pch
│ ├── ColorTypeModel.h
│ ├── ColorTypeModel.m
│ ├── CoreDataOperations.h
│ ├── CoreDataOperations.m
│ ├── CustomColorViewController.h
│ ├── CustomColorViewController.m
│ ├── Info.plist
│ ├── UI03.jpg
│ ├── UIButton+Color.h
│ ├── UIButton+Color.m
│ ├── WSColorImageView.h
│ ├── WSColorImageView.m
│ ├── blue.plist
│ ├── colorList.plist
│ ├── green.plist
│ ├── main.m
│ ├── neutral.plist
│ ├── orange.plist
│ ├── palette.png
│ ├── purple.plist
│ ├── red.plist
│ └── yellow.plist
├── GDTMobBannerView.h
├── GDTMobInterstitial.h
├── GDTNativeAd.h
├── GDTSplashAd.h
├── GDTTrack.h
└── libGDTMobSDK.a
└── README.md
/ColorM/ColorM.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ColorM/ColorM.xcodeproj/project.xcworkspace/xcuserdata/gongwenkai.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM.xcodeproj/project.xcworkspace/xcuserdata/gongwenkai.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/ColorM/ColorM.xcodeproj/xcuserdata/gongwenkai.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
24 |
36 |
37 |
38 |
40 |
52 |
53 |
54 |
56 |
68 |
69 |
70 |
72 |
84 |
85 |
86 |
88 |
100 |
101 |
102 |
104 |
116 |
117 |
118 |
120 |
132 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/ColorM/ColorM.xcodeproj/xcuserdata/gongwenkai.xcuserdatad/xcschemes/ColorM.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ColorM/ColorM.xcodeproj/xcuserdata/gongwenkai.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | ColorM.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 8B5096771E38E70900E8FE70
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ColorM/ColorM/AdSupportTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // AdSupportTableViewController.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/2/4.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AdSupportTableViewController : UITableViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ColorM/ColorM/AdSupportTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // AdSupportTableViewController.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/2/4.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "AdSupportTableViewController.h"
10 | #import "GDTMobBannerView.h"
11 | @interface AdSupportTableViewController ()
12 | @property(nonatomic,copy)NSArray *adsArray;
13 | @property(nonatomic,copy)NSArray *adsViewArray;
14 | @end
15 | static NSString *cellID = @"suppotAdsCell";
16 |
17 | @implementation AdSupportTableViewController
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 |
22 | }
23 |
24 | - (void)didReceiveMemoryWarning {
25 | [super didReceiveMemoryWarning];
26 | // Dispose of any resources that can be recreated.
27 | }
28 |
29 | - (NSArray *)adsArray{
30 | if (!_adsArray) {
31 | _adsArray = [[NSArray alloc] initWithObjects:GDT_ADSUPPOT1,GDT_ADSUPPOT2,GDT_ADSUPPOT3,GDT_ADSUPPOT4,GDT_ADSUPPOT5, nil];
32 | }
33 | return _adsArray;
34 | }
35 |
36 | - (NSArray *)adsViewArray{
37 | if (!_adsViewArray) {
38 | NSMutableArray *array = [NSMutableArray array];
39 | for (NSString *placeId in self.adsArray) {
40 | GDTMobBannerView *bannerView = [[GDTMobBannerView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)appkey:GDT_APPID placementId:placeId];
41 |
42 | bannerView.currentViewController = self;
43 | bannerView.isAnimationOn = NO;
44 | bannerView.showCloseBtn = NO;
45 | bannerView.isGpsOn = YES;
46 | [bannerView loadAdAndShow];
47 |
48 | [array addObject:bannerView];
49 | }
50 | _adsViewArray = [NSArray arrayWithArray:array];
51 | }
52 | return _adsViewArray;
53 | }
54 |
55 |
56 |
57 | #pragma mark - Table view data source
58 |
59 |
60 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
61 | return 5;
62 | }
63 |
64 |
65 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
66 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
67 |
68 | [cell.contentView addSubview:self.adsViewArray[indexPath.row]];
69 |
70 | return cell;
71 | }
72 |
73 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
74 | return 50;
75 | }
76 |
77 |
78 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
79 |
80 | UILabel *lab = [[UILabel alloc] init];
81 | lab.text = @"支持本应用就帮忙点点广告吧~";
82 | lab.textColor = [UIColor darkGrayColor];
83 | lab.backgroundColor = [UIColor whiteColor];
84 | lab.font = [UIFont systemFontOfSize:14];
85 | lab.numberOfLines = 0;
86 |
87 | lab.frame = CGRectMake(10, 10, CGRectGetWidth(self.view.frame)-20, 44);
88 |
89 | UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 44+20)];
90 | view.backgroundColor = [UIColor whiteColor];
91 | [view addSubview:lab];
92 | return view;
93 | }
94 |
95 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
96 | return 44+20;
97 | }
98 |
99 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
100 |
101 | UILabel *lab = [[UILabel alloc] init];
102 | lab.text = @"Bug提交请联系我: 139391025@qq.com";
103 | lab.textColor = [UIColor darkGrayColor];
104 | lab.backgroundColor = [UIColor whiteColor];
105 | lab.font = [UIFont systemFontOfSize:14];
106 | lab.numberOfLines = 0;
107 |
108 | lab.frame = CGRectMake(10, 10, CGRectGetWidth(self.view.frame)-20, 44);
109 |
110 | UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 44+20)];
111 | view.backgroundColor = [UIColor whiteColor];
112 | [view addSubview:lab];
113 | return view;
114 | }
115 |
116 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
117 | return 44+20;
118 | }
119 | @end
120 |
--------------------------------------------------------------------------------
/ColorM/ColorM/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/25.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @property (readonly, strong) NSPersistentContainer *persistentContainer;
16 |
17 | - (void)saveContext;
18 |
19 |
20 | @end
21 |
22 |
--------------------------------------------------------------------------------
/ColorM/ColorM/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/25.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "GDTSplashAd.h"
11 | #import "GDTTrack.h"
12 | @interface AppDelegate ()
13 | @property (strong, nonatomic) GDTSplashAd *splash;
14 |
15 | @end
16 |
17 | @implementation AppDelegate
18 |
19 |
20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
21 |
22 |
23 | //开屏广告初始化并展示代码
24 | if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
25 | GDTSplashAd *splashAd = [[GDTSplashAd alloc] initWithAppkey:GDT_APPID placementId:GDT_OPENAD];
26 | splashAd.delegate = self;//设置代理1ez
27 |
28 | splashAd.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"UI03.jpg"]];
29 |
30 | //设置开屏拉取时长限制,若超时则不再展示广告
31 | splashAd.fetchDelay = 3;
32 | //[可选]拉取并展示全屏开屏广告
33 | [splashAd loadAdAndShowInWindow:self.window];
34 | self.splash = splashAd;
35 |
36 | }
37 |
38 |
39 |
40 | return YES;
41 | }
42 |
43 |
44 | - (void)applicationWillResignActive:(UIApplication *)application {
45 | // 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.
46 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
47 | }
48 |
49 |
50 | - (void)applicationDidEnterBackground:(UIApplication *)application {
51 | // 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.
52 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
53 | }
54 |
55 |
56 | - (void)applicationWillEnterForeground:(UIApplication *)application {
57 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
58 | }
59 |
60 |
61 | - (void)applicationDidBecomeActive:(UIApplication *)application {
62 | // 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.
63 | [GDTTrack activateApp];
64 |
65 | }
66 |
67 |
68 | - (void)applicationWillTerminate:(UIApplication *)application {
69 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
70 | // Saves changes in the application's managed object context before the application terminates.
71 | [self saveContext];
72 | }
73 |
74 | #pragma mark - 广告
75 | -(void)splashAdSuccessPresentScreen:(GDTSplashAd *)splashAd
76 | {
77 | NSLog(@"%s",__FUNCTION__);
78 | }
79 |
80 | -(void)splashAdFailToPresent:(GDTSplashAd *)splashAd withError:(NSError *)error
81 | {
82 | NSLog(@"%s%@",__FUNCTION__,error);
83 | }
84 | -(void)splashAdApplicationWillEnterBackground:(GDTSplashAd *)splashAd
85 | {
86 | NSLog(@"%s",__FUNCTION__);
87 | }
88 | -(void)splashAdClicked:(GDTSplashAd *)splashAd
89 | {
90 | NSLog(@"%s",__FUNCTION__);
91 | }
92 |
93 | - (void)splashAdWillClosed:(GDTSplashAd *)splashAd
94 | {
95 | NSLog(@"%s",__FUNCTION__);
96 | }
97 | -(void)splashAdClosed:(GDTSplashAd *)splashAd
98 | {
99 | NSLog(@"%s",__FUNCTION__);
100 | _splash = nil;
101 | }
102 | -(void)splashAdWillPresentFullScreenModal:(GDTSplashAd *)splashAd
103 | {
104 | NSLog(@"%s",__FUNCTION__);
105 | }
106 | -(void)splashAdDidDismissFullScreenModal:(GDTSplashAd *)splashAd
107 | {
108 | NSLog(@"%s",__FUNCTION__);
109 | }
110 |
111 |
112 | #pragma mark - Core Data stack
113 |
114 | @synthesize persistentContainer = _persistentContainer;
115 |
116 | - (NSPersistentContainer *)persistentContainer {
117 | // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it.
118 | @synchronized (self) {
119 | if (_persistentContainer == nil) {
120 | _persistentContainer = [[NSPersistentContainer alloc] initWithName:@"ColorM"];
121 | [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) {
122 | if (error != nil) {
123 | // Replace this implementation with code to handle the error appropriately.
124 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
125 |
126 | /*
127 | Typical reasons for an error here include:
128 | * The parent directory does not exist, cannot be created, or disallows writing.
129 | * The persistent store is not accessible, due to permissions or data protection when the device is locked.
130 | * The device is out of space.
131 | * The store could not be migrated to the current model version.
132 | Check the error message to determine what the actual problem was.
133 | */
134 | NSLog(@"Unresolved error %@, %@", error, error.userInfo);
135 | abort();
136 | }
137 | }];
138 | }
139 | }
140 |
141 | return _persistentContainer;
142 | }
143 |
144 | #pragma mark - Core Data Saving support
145 |
146 | - (void)saveContext {
147 | NSManagedObjectContext *context = self.persistentContainer.viewContext;
148 | NSError *error = nil;
149 | if ([context hasChanges] && ![context save:&error]) {
150 | // Replace this implementation with code to handle the error appropriately.
151 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
152 | NSLog(@"Unresolved error %@, %@", error, error.userInfo);
153 | abort();
154 | }
155 | }
156 |
157 | @end
158 |
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/AppIcon60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/AppIcon60x60@2x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/AppIcon60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/AppIcon60x60@3x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "icon-20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "icon-20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "icon-29@2x.png",
19 | "scale" : "2x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "icon-29@3x.png",
25 | "scale" : "3x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "icon-40@2x.png",
31 | "scale" : "2x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "icon-40@3x.png",
37 | "scale" : "3x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "AppIcon60x60@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "AppIcon60x60@3x.png",
49 | "scale" : "3x"
50 | }
51 | ],
52 | "info" : {
53 | "version" : 1,
54 | "author" : "xcode"
55 | }
56 | }
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/icon_custom_.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_custom_@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_custom_@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/icon_custom_.imageset/icon_custom_@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/icon_custom_.imageset/icon_custom_@2x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/icon_custom_.imageset/icon_custom_@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/icon_custom_.imageset/icon_custom_@3x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/icon_fav_.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_fav_@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_fav_@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/icon_fav_.imageset/icon_fav_@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/icon_fav_.imageset/icon_fav_@2x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/icon_fav_.imageset/icon_fav_@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/icon_fav_.imageset/icon_fav_@3x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/icon_picker_.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "icon_picker_@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "icon_picker_@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/icon_picker_.imageset/icon_picker_@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/icon_picker_.imageset/icon_picker_@2x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/icon_picker_.imageset/icon_picker_@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/icon_picker_.imageset/icon_picker_@3x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/tabbarBkg_5x49_.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "tabbarBkg_5x49_@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 | }
--------------------------------------------------------------------------------
/ColorM/ColorM/Assets.xcassets/tabbarBkg_5x49_.imageset/tabbarBkg_5x49_@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/Assets.xcassets/tabbarBkg_5x49_.imageset/tabbarBkg_5x49_@2x.png
--------------------------------------------------------------------------------
/ColorM/ColorM/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 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/ColorM/ColorM/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
158 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorFavCellModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // ColorFavCellModel.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ColorFavCellModel : NSObject
12 | @property(nonatomic,copy)NSString *oxStr;
13 | @property(nonatomic,copy)NSString *rgbStr;
14 | @property(nonatomic,copy)NSString *favTimeStr;
15 | @property(nonatomic,copy)NSString *colorID;
16 | @end
17 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorFavCellModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // ColorFavCellModel.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "ColorFavCellModel.h"
10 |
11 | @implementation ColorFavCellModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorFavTableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ColorFavTableViewCell.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ColorFavCellModel.h"
11 | @interface ColorFavTableViewCell : UITableViewCell
12 | @property(nonatomic,strong)ColorFavCellModel *model;
13 | @end
14 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorFavTableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ColorFavTableViewCell.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "ColorFavTableViewCell.h"
10 |
11 | @interface ColorFavTableViewCell()
12 |
13 | @property (weak, nonatomic) IBOutlet UILabel *oxLab;
14 | @property (weak, nonatomic) IBOutlet UILabel *rgbLab;
15 | @property (weak, nonatomic) IBOutlet UILabel *favTimeLab;
16 |
17 | @end
18 |
19 | @implementation ColorFavTableViewCell
20 |
21 | - (void)awakeFromNib {
22 | [super awakeFromNib];
23 | // Initialization code
24 | }
25 |
26 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
27 | [super setSelected:selected animated:animated];
28 |
29 | // Configure the view for the selected state
30 | }
31 |
32 | - (NSInteger)numberWithHexString:(NSString *)hexString{
33 |
34 | const char *hexChar = [hexString cStringUsingEncoding:NSUTF8StringEncoding];
35 |
36 | int hexNumber;
37 |
38 | sscanf(hexChar, "%x", &hexNumber);
39 |
40 | return (NSInteger)hexNumber;
41 | }
42 |
43 | - (void)setModel:(ColorFavCellModel *)model {
44 | _model = model;
45 | self.oxLab.text = _model.oxStr;
46 | self.rgbLab.text = _model.rgbStr;
47 | self.favTimeLab.text = [NSString stringWithFormat:@"收藏于:%@",_model.favTimeStr];
48 | NSArray *array = [_model.rgbStr componentsSeparatedByString:@","];
49 | CGFloat r = [array[0] floatValue];
50 | CGFloat g = [array[1] floatValue];
51 | CGFloat b = [array[2] floatValue];
52 |
53 | UIColor *textColor = [UIColor colorWithRed: fabs(r-255)/255.0f green:fabs(g-255)/255.0f blue:fabs(b-255)/255.0f alpha:1];
54 | self.oxLab.textColor = textColor;
55 | self.rgbLab.textColor = textColor;
56 | self.favTimeLab.textColor = textColor;
57 | UIColor *color = [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1];
58 |
59 | self.contentView.backgroundColor = color;
60 | }
61 | @end
62 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorFavTableViewCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
30 |
39 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorFavTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ColorFavTableViewController.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ColorFavTableViewController : UITableViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorFavTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ColorFavTableViewController.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "ColorFavTableViewController.h"
10 | #import "CoreDataOperations.h"
11 | #import "ColorFavTableViewCell.h"
12 | #import
13 | #import "GDTMobBannerView.h"
14 | @interface ColorFavTableViewController ()
15 | @property (nonatomic,strong) NSArray *profuctIdArr;
16 | @property (nonatomic,copy) NSString *currentProId;
17 | @property (nonatomic,strong)NSArray *favArray;
18 | @end
19 | static NSString *cellID = @"cellIdendity";
20 |
21 | @implementation ColorFavTableViewController
22 |
23 | - (void)viewDidLoad {
24 | [super viewDidLoad];
25 | [self.tableView registerNib:[UINib nibWithNibName:@"ColorFavTableViewCell" bundle:nil] forCellReuseIdentifier:@"ColorFavCell"];
26 |
27 | }
28 |
29 | - (void)didReceiveMemoryWarning {
30 | [super didReceiveMemoryWarning];
31 |
32 |
33 | }
34 |
35 | - (void)viewWillAppear:(BOOL)animated{
36 | NSLog(@"will");
37 | [super viewWillAppear:animated];
38 |
39 | NSArray *array = [[CoreDataOperations sharedInstance] showFavList];
40 | self.favArray = [NSArray arrayWithArray:array];
41 | [self.tableView reloadData];
42 | }
43 |
44 | #pragma mark - Table view data source
45 |
46 |
47 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
48 | NSLog(@"t");
49 |
50 | return self.favArray.count;
51 | }
52 |
53 |
54 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
55 | ColorFavTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ColorFavCell" forIndexPath:indexPath];
56 | if (cell == NULL) {
57 | [tableView registerNib:[UINib nibWithNibName:@"ColorFavTableViewCell" bundle:nil] forCellReuseIdentifier:@"ColorFavCell"];
58 |
59 | }
60 | Fav *obj = self.favArray[indexPath.row];
61 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
62 | //设置日期格式
63 | [dateFormatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
64 | //将日期转换成字符串输出
65 | NSString *currentDateStr = [dateFormatter stringFromDate:obj.timestamp];
66 | ColorFavCellModel *model = [[ColorFavCellModel alloc] init];
67 | model.oxStr = obj.colorOX;
68 | model.rgbStr = obj.colorRGB;
69 | model.favTimeStr = currentDateStr;
70 | model.colorID = obj.colorID;
71 | cell.model = model;
72 |
73 |
74 | return cell;
75 | }
76 |
77 | //行高
78 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
79 | return CGRectGetWidth(self.view.frame)* 0.2;
80 |
81 | }
82 |
83 | //滑动删除
84 | - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
85 | if (editingStyle == UITableViewCellEditingStyleDelete) {
86 | // Delete the row from the data source
87 | ColorFavTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
88 | [[CoreDataOperations sharedInstance] deleteWithModel:cell.model];
89 | NSArray *array = [[CoreDataOperations sharedInstance] showFavList];
90 | self.favArray = [NSArray arrayWithArray:array];
91 |
92 | [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
93 | }
94 | }
95 |
96 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
97 | GDTMobBannerView *bannerView = [[GDTMobBannerView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)
98 | appkey:GDT_APPID placementId:GDT_BANNER_FAV];
99 |
100 | bannerView.currentViewController = [[UIApplication sharedApplication] keyWindow].rootViewController;
101 | bannerView.isAnimationOn = NO;
102 | bannerView.showCloseBtn = NO;
103 | bannerView.isGpsOn = YES;
104 | [bannerView loadAdAndShow];
105 | return bannerView;
106 | }
107 |
108 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
109 | int isBuy = [[CoreDataOperations sharedInstance] isBuyNoAds];
110 | if (isBuy == 0) {
111 | return 50;
112 | }else{
113 | return 0;
114 | }
115 | }
116 |
117 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
118 | ColorFavTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
119 |
120 | NSString *oxStr = [NSString stringWithFormat:@"ox%@",cell.model.oxStr];
121 | NSString *rgbStr = [NSString stringWithFormat:@"RGB(%@)",cell.model.rgbStr];
122 |
123 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"复制到剪切板" preferredStyle:UIAlertControllerStyleActionSheet];
124 | [alertController addAction:[UIAlertAction actionWithTitle:oxStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
125 | UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
126 | [pasteboard setString:oxStr];
127 | }]];
128 |
129 | [alertController addAction:[UIAlertAction actionWithTitle:rgbStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
130 | UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
131 | [pasteboard setString:rgbStr];
132 | }]];
133 | [alertController addAction:[UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:nil]];
134 | [self presentViewController:alertController animated:YES completion:nil];
135 |
136 | }
137 |
138 |
139 | #pragma mark - 内购
140 | - (IBAction)clickPhures:(id)sender {
141 |
142 | [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
143 |
144 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"购买去广告服务" preferredStyle:UIAlertControllerStyleActionSheet];
145 | [alertController addAction:[UIAlertAction actionWithTitle:@"确定购买" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
146 |
147 |
148 | NSString *product = @"123";
149 | _currentProId = product;
150 | if([SKPaymentQueue canMakePayments]){
151 | [self requestProductData:product];
152 | }else{
153 | NSLog(@"不允许程序内付费");
154 | }
155 | }]];
156 |
157 | [alertController addAction:[UIAlertAction actionWithTitle:@"已购买直接去广告" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
158 |
159 | [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
160 |
161 | [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
162 | }]];
163 |
164 | [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
165 | [self presentViewController:alertController animated:YES completion:nil];
166 |
167 | }
168 |
169 |
170 | //请求商品
171 | - (void)requestProductData:(NSString *)type{
172 | NSLog(@"-------------请求对应的产品信息----------------");
173 |
174 |
175 | NSArray *product = [[NSArray alloc] initWithObjects:type,nil];
176 |
177 | NSSet *nsset = [NSSet setWithArray:product];
178 | SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:nsset];
179 | request.delegate = self;
180 | [request start];
181 |
182 | }
183 |
184 | //收到产品返回信息
185 | - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
186 |
187 | NSLog(@"--------------收到产品反馈消息---------------------");
188 | NSArray *product = response.products;
189 | if([product count] == 0){
190 | NSLog(@"--------------没有商品------------------");
191 | return;
192 | }
193 |
194 | NSLog(@"productID:%@", response.invalidProductIdentifiers);
195 | NSLog(@"产品付费数量:%lu",(unsigned long)[product count]);
196 |
197 | SKProduct *p = nil;
198 | for (SKProduct *pro in product) {
199 | NSLog(@"%@", [pro description]);
200 | NSLog(@"%@", [pro localizedTitle]);
201 | NSLog(@"%@", [pro localizedDescription]);
202 | NSLog(@"%@", [pro price]);
203 | NSLog(@"%@", [pro productIdentifier]);
204 |
205 | if([pro.productIdentifier isEqualToString:_currentProId]){
206 | p = pro;
207 | }
208 | }
209 |
210 | SKPayment *payment = [SKPayment paymentWithProduct:p];
211 |
212 | NSLog(@"发送购买请求");
213 | [[SKPaymentQueue defaultQueue] addPayment:payment];
214 | }
215 |
216 | //请求失败
217 | - (void)request:(SKRequest *)request didFailWithError:(NSError *)error{
218 | NSLog(@"------------------错误-----------------:%@", error);
219 | }
220 |
221 | - (void)requestDidFinish:(SKRequest *)request{
222 | NSLog(@"------------反馈信息结束-----------------");
223 | }
224 | //沙盒测试环境验证
225 | #define SANDBOX @"https://sandbox.itunes.apple.com/verifyReceipt"
226 | //正式环境验证
227 | #define AppStore @"https://buy.itunes.apple.com/verifyReceipt"
228 | /**
229 | * 验证购买,避免越狱软件模拟苹果请求达到非法购买问题
230 | *
231 | */
232 | -(void)verifyPurchaseWithPaymentTransaction{
233 | //从沙盒中获取交易凭证并且拼接成请求体数据
234 | NSURL *receiptUrl=[[NSBundle mainBundle] appStoreReceiptURL];
235 | NSData *receiptData=[NSData dataWithContentsOfURL:receiptUrl];
236 |
237 | NSString *receiptString=[receiptData base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];//转化为base64字符串
238 |
239 | NSString *bodyString = [NSString stringWithFormat:@"{\"receipt-data\" : \"%@\"}", receiptString];//拼接请求数据
240 | NSData *bodyData = [bodyString dataUsingEncoding:NSUTF8StringEncoding];
241 |
242 |
243 | //创建请求到苹果官方进行购买验证
244 | NSURL *url=[NSURL URLWithString:AppStore];
245 | NSMutableURLRequest *requestM=[NSMutableURLRequest requestWithURL:url];
246 | requestM.HTTPBody=bodyData;
247 | requestM.HTTPMethod=@"POST";
248 | //创建连接并发送同步请求
249 | NSError *error=nil;
250 | NSData *responseData=[NSURLConnection sendSynchronousRequest:requestM returningResponse:nil error:&error];
251 |
252 | if (error) {
253 | NSLog(@"验证购买过程中发生错误,错误信息:%@",error.localizedDescription);
254 | return;
255 | }
256 | NSDictionary *dic=[NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:nil];
257 | NSLog(@"%@",dic);
258 | if([dic[@"status"] intValue]==0){
259 | NSLog(@"购买成功!");
260 | [[CoreDataOperations sharedInstance] buyNoAds];
261 | [self.tableView reloadData];
262 |
263 | NSDictionary *dicReceipt= dic[@"receipt"];
264 | NSDictionary *dicInApp=[dicReceipt[@"in_app"] firstObject];
265 | NSString *productIdentifier= dicInApp[@"product_id"];//读取产品标识
266 | //如果是消耗品则记录购买数量,非消耗品则记录是否购买过
267 | NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
268 | if ([productIdentifier isEqualToString:@"123"]) {
269 | NSInteger purchasedCount=[defaults integerForKey:productIdentifier];//已购买数量
270 | [[NSUserDefaults standardUserDefaults] setInteger:(purchasedCount+1) forKey:productIdentifier];
271 | }else{
272 | [defaults setBool:YES forKey:productIdentifier];
273 | }
274 | //在此处对购买记录进行存储,可以存储到开发商的服务器端
275 | }else{
276 | NSLog(@"购买失败,未通过验证!");
277 | }
278 | }
279 | //监听购买结果
280 | - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transaction{
281 |
282 |
283 | for(SKPaymentTransaction *tran in transaction){
284 |
285 |
286 | switch (tran.transactionState) {
287 | case SKPaymentTransactionStatePurchased:{
288 | NSLog(@"交易完成");
289 | [self verifyPurchaseWithPaymentTransaction];
290 | [[SKPaymentQueue defaultQueue] finishTransaction:tran];
291 | [[CoreDataOperations sharedInstance] buyNoAds];
292 | [self.tableView reloadData];
293 |
294 | }
295 | break;
296 | case SKPaymentTransactionStatePurchasing:
297 | NSLog(@"商品添加进列表");
298 |
299 | break;
300 | case SKPaymentTransactionStateRestored:{
301 | NSLog(@"已经购买过商品");
302 | [[SKPaymentQueue defaultQueue] finishTransaction:tran];
303 | [[CoreDataOperations sharedInstance] buyNoAds];
304 | [self.tableView reloadData];
305 | }
306 | break;
307 | case SKPaymentTransactionStateFailed:{
308 | NSLog(@"交易失败");
309 | [[SKPaymentQueue defaultQueue] finishTransaction:tran];
310 | }
311 | break;
312 | default:
313 | break;
314 | }
315 | }
316 | }
317 |
318 | //交易结束
319 | - (void)completeTransaction:(SKPaymentTransaction *)transaction{
320 | NSLog(@"交易结束");
321 |
322 | [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
323 | }
324 |
325 |
326 | - (void)dealloc{
327 | [[SKPaymentQueue defaultQueue] removeTransactionObserver:self];
328 | }
329 | @end
330 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorM.xcdatamodeld/.xccurrentversion:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | _XCCurrentVersionName
6 | ColorM.xcdatamodel
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorM.xcdatamodeld/ColorM.xcdatamodel/contents:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickCellModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickCellModel.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/26.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ColorPickCellModel : NSObject
12 | @property (nonatomic,strong)NSArray *typeArray;
13 |
14 | @property (nonatomic,copy)NSString *colorName; //颜色名字
15 | @property (nonatomic,copy)NSString *color; //颜色
16 | @property (nonatomic,copy)NSString *colorDescription;//颜色描述
17 | @end
18 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickCellModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickCellModel.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/26.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "ColorPickCellModel.h"
10 |
11 | @implementation ColorPickCellModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickDetailTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickDetailTableViewController.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/26.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ColorTypeModel.h"
11 | @interface ColorPickDetailTableViewController : UITableViewController
12 | - (instancetype)initWithColor:(NSString*)colorStr andTypeModel:(ColorTypeModel*)model;
13 | @end
14 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickDetailTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickDetailTableViewController.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/26.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "ColorPickDetailTableViewController.h"
10 | #import "ColorPickMaseterModel.h"
11 | #import "ColorPickTableViewCell.h"
12 | #import "CoreDataOperations.h"
13 | #import "GDTMobBannerView.h"
14 | @interface ColorPickDetailTableViewController ()
15 | @property (nonatomic,strong)NSArray *colorArray;//plist
16 | @property (nonatomic,copy)NSString *colorStr; //rgb
17 | @property (nonatomic,strong)ColorTypeModel *typeModel;
18 | @property (nonatomic,assign)CGFloat headerHeight;
19 | @end
20 |
21 | @implementation ColorPickDetailTableViewController
22 | - (NSArray*)colorArray {
23 | if (!_colorArray) {
24 | NSMutableArray *array = [NSMutableArray array];
25 | NSString *path = [[NSBundle mainBundle] pathForResource:self.colorStr ofType:@"plist"];
26 | NSArray *plist = [NSArray arrayWithContentsOfFile:path];
27 | for (NSDictionary *dict in plist) {
28 | ColorPickMaseterModel *model = [ColorPickMaseterModel colorPickMaseterModelWithDict:dict];
29 | [array addObject:model];
30 | }
31 | _colorArray = array;
32 | }
33 | return _colorArray;
34 | }
35 |
36 | - (instancetype)initWithColor:(NSString*)colorStr andTypeModel:(ColorTypeModel*)model{
37 | self = [super init];
38 | if (self) {
39 | self.colorStr = colorStr;
40 | self.typeModel = model;
41 | self.title = model.name;
42 | }
43 | return self;
44 | }
45 |
46 | - (void)viewDidLoad {
47 | [super viewDidLoad];
48 | [self.tableView registerNib:[UINib nibWithNibName:@"ColorPickTableViewCell" bundle:nil] forCellReuseIdentifier:@"ColorCell"];
49 |
50 | }
51 |
52 | - (void)didReceiveMemoryWarning {
53 | [super didReceiveMemoryWarning];
54 | // Dispose of any resources that can be recreated.
55 | }
56 |
57 | #pragma mark - Table view data source
58 |
59 | //获取label高
60 | - (CGFloat)heightForHeaderWithStr:(NSString*)str{
61 | CGFloat labelWidth = [UIScreen mainScreen].bounds.size.width;
62 | NSDictionary *attrs = @{NSFontAttributeName : [UIFont systemFontOfSize:14]};
63 |
64 | CGSize maxSize = CGSizeMake(labelWidth, MAXFLOAT);
65 | CGSize size = [str boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
66 | return size.height;
67 | }
68 |
69 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
70 |
71 | UILabel *lab = [[UILabel alloc] init];
72 | lab.text = self.typeModel.detail;
73 | lab.textColor = [UIColor darkGrayColor];
74 | lab.backgroundColor = [UIColor whiteColor];
75 | lab.font = [UIFont systemFontOfSize:14];
76 | lab.numberOfLines = 0;
77 | CGFloat height = [self heightForHeaderWithStr:self.typeModel.detail];
78 | lab.frame = CGRectMake(10, 10, CGRectGetWidth(self.view.frame)-20, height);
79 |
80 | UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), height+20)];
81 | view.backgroundColor = [UIColor whiteColor];
82 | [view addSubview:lab];
83 | return view;
84 | }
85 |
86 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
87 | return [self heightForHeaderWithStr:self.typeModel.detail] + 20;
88 | }
89 |
90 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
91 | return self.colorArray.count;
92 | }
93 |
94 |
95 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
96 | ColorPickTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ColorCell" forIndexPath:indexPath];
97 | cell.delegate = self;
98 | if (cell == NULL) {
99 | [tableView registerNib:[UINib nibWithNibName:@"ColorPickTableViewCell" bundle:nil] forCellReuseIdentifier:@"ColorCell"];
100 |
101 | }
102 | ColorPickMaseterModel *masterModel = self.colorArray[indexPath.row];
103 | ColorPickCellModel *model = [[ColorPickCellModel alloc] init];
104 | model.typeArray = masterModel.colors;
105 | model.color = masterModel.color;
106 | model.colorName = masterModel.colorName;
107 | model.colorDescription = masterModel.colorDescription;
108 |
109 | cell.cellModel = model;
110 | return cell;
111 | }
112 |
113 | //转16进制字符串
114 | - (NSString *)stringWithHexNumber:(NSUInteger)hexNumber{
115 | char hexChar[6];
116 | sprintf(hexChar, "%X", (int)hexNumber);
117 | NSString *hexString = [NSString stringWithCString:hexChar encoding:NSUTF8StringEncoding];
118 | return hexString;
119 | }
120 |
121 | //点击cell中的btn回调
122 | - (void)didSelectedColor:(NSString*)color{
123 | NSLog(@"color = %@",color);
124 |
125 | NSArray *arr = [color componentsSeparatedByString:@","];
126 | CGFloat r = [arr[0] intValue];
127 | CGFloat g = [arr[1] intValue];
128 | CGFloat b = [arr[2] intValue];
129 |
130 | NSString *rOX = [self stringWithHexNumber:r];
131 | NSString *gOX = [self stringWithHexNumber:g];
132 | NSString *bOX = [self stringWithHexNumber:b];
133 | NSString *oxStr = [NSString stringWithFormat:@"ox%@%@%@",rOX,gOX,bOX];
134 | NSString *rgbStr = [NSString stringWithFormat:@"RGB(%@)",color];
135 |
136 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"复制到剪切板" preferredStyle:UIAlertControllerStyleActionSheet];
137 | [alertController addAction:[UIAlertAction actionWithTitle:oxStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
138 | UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
139 | [pasteboard setString:oxStr];
140 | }]];
141 |
142 | [alertController addAction:[UIAlertAction actionWithTitle:rgbStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
143 | UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
144 | [pasteboard setString:rgbStr];
145 | }]];
146 | [alertController addAction:[UIAlertAction actionWithTitle:@"收藏" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
147 |
148 | //save
149 | NSLog(@"click fav");
150 | [[CoreDataOperations sharedInstance] saveColorOX:[NSString stringWithFormat:@"%@%@%@",rOX,gOX,bOX] andRGB:[NSString stringWithFormat:@"%@",color]];
151 |
152 | }]];
153 | [alertController addAction:[UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:nil]];
154 | [self presentViewController:alertController animated:YES completion:nil];
155 | }
156 |
157 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
158 | return CGRectGetWidth(self.view.frame)* 0.3;
159 | }
160 |
161 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
162 | GDTMobBannerView *bannerView = [[GDTMobBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-self.tabBarController.tabBar.frame.size.height-50, self.view.frame.size.width, 50)
163 | appkey:GDT_APPID placementId:GDT_BANNER_DETAIL];
164 |
165 | bannerView.currentViewController = [[UIApplication sharedApplication] keyWindow].rootViewController;
166 | bannerView.isAnimationOn = NO;
167 | bannerView.showCloseBtn = NO;
168 | bannerView.isGpsOn = YES;
169 | [bannerView loadAdAndShow];
170 | return bannerView;
171 | }
172 |
173 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
174 | int isBuy = [[CoreDataOperations sharedInstance] isBuyNoAds];
175 | if (isBuy == 0) {
176 | return 50;
177 | }else{
178 | return 0;
179 | }
180 | }
181 |
182 | - (void)viewWillAppear:(BOOL)animated{
183 | [super viewWillAppear:animated];
184 | int isBuy = [[CoreDataOperations sharedInstance] isBuyNoAds];
185 | if (isBuy == 1) {
186 | [self.tableView reloadData];
187 | }
188 | }
189 |
190 |
191 |
192 | @end
193 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickMaseterModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickMaseterModel.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/26.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ColorPickMaseterModel : NSObject
12 | @property (nonatomic,copy)NSString *colorName;
13 | @property (nonatomic,copy)NSString *colorDescription;
14 | @property (nonatomic,copy)NSString *color;
15 | @property (nonatomic,strong)NSArray *colors;
16 |
17 |
18 | - (instancetype)initWithDict:(NSDictionary*)dict;
19 | + (instancetype)colorPickMaseterModelWithDict:(NSDictionary*)dict;
20 | @end
21 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickMaseterModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickMaseterModel.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/26.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "ColorPickMaseterModel.h"
10 |
11 | @implementation ColorPickMaseterModel
12 |
13 | - (instancetype)initWithDict:(NSDictionary*)dict{
14 | self = [super init];
15 | if (self) {
16 | [self setValuesForKeysWithDictionary:dict];
17 | }
18 | return self;
19 | }
20 |
21 |
22 | + (instancetype)colorPickMaseterModelWithDict:(NSDictionary*)dict{
23 | return [[ColorPickMaseterModel alloc] initWithDict:dict];
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickMasterTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickMasterTableViewController.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/25.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ColorPickMasterTableViewController : UITableViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickMasterTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickMasterTableViewController.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/25.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "ColorPickMasterTableViewController.h"
10 | #import "ColorPickDetailTableViewController.h"
11 | #import "ColorTypeModel.h"
12 | #import "CoreDataOperations.h"
13 | #import "GDTMobBannerView.h"
14 |
15 | @interface ColorPickMasterTableViewController ()
16 | @property (nonatomic,strong)NSArray *plistArray;
17 | @property (nonatomic,strong)NSArray *colorArray;
18 | @end
19 | static NSString *cellID = @"reuseIdentifier";
20 |
21 | @implementation ColorPickMasterTableViewController
22 |
23 | - (NSArray *)plistArray{
24 | if (!_plistArray) {
25 | NSMutableArray *array = [NSMutableArray array];
26 | NSString *path = [[NSBundle mainBundle] pathForResource:@"colorList" ofType:@"plist"];
27 | NSArray *plist = [NSArray arrayWithContentsOfFile:path];
28 | for (NSDictionary *dict in plist) {
29 | ColorTypeModel *model = [ColorTypeModel colorTypeModelModelWithDict:dict];
30 | [array addObject:model];
31 | }
32 | _plistArray = array;
33 |
34 | }
35 | return _plistArray;
36 | }
37 |
38 | - (NSArray *)colorArray {
39 | if (!_colorArray) {
40 | _colorArray = [NSArray arrayWithObjects:[UIColor redColor],[UIColor orangeColor],
41 | [UIColor yellowColor],[UIColor greenColor],
42 | [UIColor cyanColor],[UIColor purpleColor],
43 | [UIColor lightGrayColor],nil];
44 | }
45 | return _colorArray;
46 | }
47 |
48 | - (void)viewDidLoad {
49 | [super viewDidLoad];
50 | NSLog(@"%@",NSHomeDirectory());
51 | self.title = @"色系";
52 | }
53 |
54 | - (void)didReceiveMemoryWarning {
55 | [super didReceiveMemoryWarning];
56 | // Dispose of any resources that can be recreated.
57 | }
58 |
59 | #pragma mark - Table view data source
60 |
61 |
62 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
63 | return self.plistArray.count;
64 | }
65 |
66 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
67 | return CGRectGetWidth(self.view.frame)* 0.15;
68 | }
69 |
70 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
71 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
72 | if (!cell) {
73 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];
74 | }
75 | ColorTypeModel *model = self.plistArray[indexPath.row];
76 | cell.textLabel.text = model.name;
77 | cell.detailTextLabel.text = model.descriptionName;
78 |
79 | cell.textLabel.textColor = [UIColor blackColor];
80 | cell.detailTextLabel.textColor = [UIColor darkGrayColor];
81 | cell.textLabel.backgroundColor = [UIColor clearColor];
82 | cell.detailTextLabel.backgroundColor = [UIColor clearColor];
83 | cell.contentView.backgroundColor = self.colorArray[indexPath.row];
84 |
85 |
86 | return cell;
87 | }
88 |
89 |
90 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
91 | NSMutableArray *typeArray = [NSMutableArray array];
92 | for (ColorTypeModel *model in self.plistArray) {
93 | [typeArray addObject:model.plistName];
94 | }
95 |
96 | ColorPickDetailTableViewController *vc = [[ColorPickDetailTableViewController alloc] initWithColor:typeArray[indexPath.row] andTypeModel:self.plistArray[indexPath.row]];
97 | [self.navigationController pushViewController:vc animated:YES];
98 | }
99 |
100 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
101 |
102 | // Custom initialization
103 | GDTMobBannerView *bannerView = [[GDTMobBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-self.tabBarController.tabBar.frame.size.height-50, self.view.frame.size.width, 50)
104 | appkey:GDT_APPID placementId:GDT_BANNER_MASTER];
105 |
106 | bannerView.currentViewController = [[UIApplication sharedApplication] keyWindow].rootViewController;
107 | bannerView.isAnimationOn = NO;
108 | bannerView.showCloseBtn = NO;
109 | bannerView.isGpsOn = YES;
110 | [bannerView loadAdAndShow];
111 | return bannerView;
112 | }
113 |
114 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
115 | int isBuy = [[CoreDataOperations sharedInstance] isBuyNoAds];
116 | if (isBuy == 0) {
117 | return 50;
118 | }else{
119 | return 0;
120 | }
121 | }
122 |
123 | - (void)viewWillAppear:(BOOL)animated{
124 | [super viewWillAppear:animated];
125 |
126 | int isBuy = [[CoreDataOperations sharedInstance] isBuyNoAds];
127 | if (isBuy == 1) {
128 | [self.tableView reloadData];
129 | }
130 | }
131 | @end
132 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickTableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickTableViewCell.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/26.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ColorPickCellModel.h"
11 | #import "UIButton+Color.h"
12 |
13 | @protocol ColorPickTableViewCellDelegate
14 |
15 | //选择的颜色
16 | - (void)didSelectedColor:(NSString*)color;
17 |
18 | @end
19 |
20 | @interface ColorPickTableViewCell : UITableViewCell
21 |
22 | @property (nonatomic,strong)ColorPickCellModel *cellModel;
23 | @property (nonatomic,strong)id delegate;
24 | @end
25 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickTableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPickTableViewCell.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/26.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "ColorPickTableViewCell.h"
10 |
11 |
12 | @interface ColorPickTableViewCell()
13 | @property (weak, nonatomic) IBOutlet UIImageView *colorDescription;
14 | @property (weak, nonatomic) IBOutlet UILabel *descriptionLab;
15 |
16 | @property (weak, nonatomic) IBOutlet UIView *colorType1;
17 | @property (weak, nonatomic) IBOutlet UIView *colorType2;
18 | @property (weak, nonatomic) IBOutlet UIView *colorType3;
19 | @property (weak, nonatomic) IBOutlet UIImageView *line;
20 |
21 | @property (weak, nonatomic) IBOutlet UIView *colorType4;
22 | @property (weak, nonatomic) IBOutlet UIImageView *colorName;
23 | @property (weak, nonatomic) IBOutlet UILabel *colorNameLab;
24 | @end
25 |
26 | @implementation ColorPickTableViewCell
27 |
28 | - (void)awakeFromNib {
29 | [super awakeFromNib];
30 | // Initialization code
31 | }
32 |
33 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
34 | [super setSelected:selected animated:animated];
35 |
36 | // Configure the view for the selected state
37 | }
38 |
39 | - (void)setCellModel:(ColorPickCellModel *)cellModel {
40 | _cellModel = cellModel;
41 |
42 | //刷新约束
43 | [self layoutIfNeeded];
44 |
45 |
46 |
47 | NSArray *arr = [_cellModel.color componentsSeparatedByString:@","];
48 | CGFloat r = [arr[0] floatValue];
49 | CGFloat g = [arr[1] floatValue];
50 | CGFloat b = [arr[2] floatValue];
51 | UIColor *color = [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1];
52 | self.colorDescription.layer.cornerRadius = 10;
53 | self.colorName.backgroundColor = color;
54 | self.colorDescription.backgroundColor = color;
55 | self.line.backgroundColor = color;
56 | [self.descriptionLab setTextColor:color];
57 | self.descriptionLab.text = _cellModel.colorDescription;
58 | self.colorNameLab.text = _cellModel.colorName;
59 |
60 | //type1 btn
61 | NSArray *type1BtnBg = _cellModel.typeArray[0];
62 | for (int i = 0; i < 3; i++) {
63 | CGFloat x = i * self.colorType1.frame.size.width/3;
64 | CGFloat y = 0;
65 | CGFloat width = self.colorType1.frame.size.width/3;
66 | CGFloat height = self.colorType1.frame.size.height;
67 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(x,y,width,height)];
68 | btn.tag = 200+i;
69 | btn.colorStr = type1BtnBg[i];
70 | NSArray *array = [type1BtnBg[i] componentsSeparatedByString:@","];
71 | CGFloat r = [array[0] floatValue];
72 | CGFloat g = [array[1] floatValue];
73 | CGFloat b = [array[2] floatValue];
74 | UIColor *color = [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1];
75 | [btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
76 |
77 | btn.backgroundColor = color;
78 | [self.colorType1 addSubview:btn];
79 |
80 | }
81 |
82 | //type2 btn
83 | NSArray *type2BtnBg = _cellModel.typeArray[1];
84 | for (int i = 0; i < 3; i++) {
85 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(i*self.colorType1.frame.size.width/3, 0,self.colorType1.frame.size.width/3, self.colorType1.frame.size.height)];
86 | btn.tag = 300+i;
87 | btn.colorStr = type2BtnBg[i];
88 |
89 | NSArray *array = [type2BtnBg[i] componentsSeparatedByString:@","];
90 | CGFloat r = [array[0] floatValue];
91 | CGFloat g = [array[1] floatValue];
92 | CGFloat b = [array[2] floatValue];
93 | UIColor *color = [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1];
94 | [btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
95 |
96 | btn.backgroundColor = color;
97 | [self.colorType2 addSubview:btn];
98 |
99 | }
100 |
101 |
102 |
103 | //type3 btn
104 | NSArray *type3BtnBg = _cellModel.typeArray[2];
105 | for (int i = 0; i < 3; i++) {
106 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(i*self.colorType1.frame.size.width/3, 0,self.colorType1.frame.size.width/3, self.colorType1.frame.size.height)];
107 | btn.tag = 400+i;
108 | btn.colorStr = type3BtnBg[i];
109 |
110 | NSArray *array = [type3BtnBg[i] componentsSeparatedByString:@","];
111 | CGFloat r = [array[0] floatValue];
112 | CGFloat g = [array[1] floatValue];
113 | CGFloat b = [array[2] floatValue];
114 | UIColor *color = [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1];
115 | [btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
116 |
117 | btn.backgroundColor = color;
118 | [self.colorType3 addSubview:btn];
119 |
120 | }
121 | //type4 btn
122 | NSArray *type4BtnBg = _cellModel.typeArray[3];
123 | for (int i = 0; i < 3; i++) {
124 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(i*self.colorType1.frame.size.width/3, 0,self.colorType1.frame.size.width/3, self.colorType1.frame.size.height)];
125 | btn.tag = 500+i;
126 | btn.colorStr = type4BtnBg[i];
127 |
128 | NSArray *array = [type4BtnBg[i] componentsSeparatedByString:@","];
129 | CGFloat r = [array[0] floatValue];
130 | CGFloat g = [array[1] floatValue];
131 | CGFloat b = [array[2] floatValue];
132 | UIColor *color = [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1];
133 | [btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
134 | btn.backgroundColor = color;
135 | [self.colorType4 addSubview:btn];
136 |
137 | }
138 |
139 | }
140 |
141 | //点击事件
142 | - (void)click:(UIButton*)btn{
143 |
144 | if ([self.delegate respondsToSelector:@selector(didSelectedColor:)]) {
145 | [self.delegate didSelectedColor:btn.colorStr];
146 | }
147 | }
148 |
149 | @end
150 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPickTableViewCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorPrefixHeader.pch:
--------------------------------------------------------------------------------
1 | //
2 | // ColorPrefixHeader.pch
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/2/3.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #ifndef ColorPrefixHeader_pch
10 | #define ColorPrefixHeader_pch
11 |
12 | // Include any system framework and library headers here that should be included in all compilation units.
13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
14 |
15 | //自行替换 ID 和 key
16 | #define GDT_APPID @""
17 | #define GDT_BANNER_CUSTOM @""
18 | #define GDT_INTERSTITIAL_CUSTOMFAV @""
19 | #define GDT_BANNER_MASTER @""
20 | #define GDT_BANNER_DETAIL @""
21 | #define GDT_BANNER_FAV @""
22 | #define GDT_OPENAD @""
23 | #define GDT_ADSUPPOT1 @""
24 | #define GDT_ADSUPPOT2 @""
25 | #define GDT_ADSUPPOT3 @""
26 | #define GDT_ADSUPPOT4 @""
27 | #define GDT_ADSUPPOT5 @""
28 |
29 | #endif /* ColorPrefixHeader_pch */
30 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorTypeModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // ColorTypeModel.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ColorTypeModel : NSObject
12 | @property (nonatomic,copy)NSString *plistName;
13 | @property (nonatomic,copy)NSString *name;
14 | @property (nonatomic,copy)NSString *descriptionName;
15 | @property (nonatomic,copy)NSString *detail;
16 | - (instancetype)initWithDict:(NSDictionary*)dict;
17 | + (instancetype)colorTypeModelModelWithDict:(NSDictionary*)dict;
18 | @end
19 |
--------------------------------------------------------------------------------
/ColorM/ColorM/ColorTypeModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // ColorTypeModel.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "ColorTypeModel.h"
10 |
11 | @implementation ColorTypeModel
12 | - (instancetype)initWithDict:(NSDictionary*)dict{
13 | self = [super init];
14 | if (self) {
15 | [self setValuesForKeysWithDictionary:dict];
16 | }
17 | return self;
18 | }
19 | + (instancetype)colorTypeModelModelWithDict:(NSDictionary*)dict{
20 | return [[ColorTypeModel alloc] initWithDict:dict];
21 | }
22 | @end
23 |
--------------------------------------------------------------------------------
/ColorM/ColorM/CoreDataOperations.h:
--------------------------------------------------------------------------------
1 | //
2 | // CoreDataOperations.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 | #import "ColorM+CoreDataModel.h"
12 | #import "ColorFavCellModel.h"
13 |
14 |
15 |
16 | @interface CoreDataOperations : NSObject
17 | @property (strong, nonatomic) NSManagedObjectContext *managedObjectContext;
18 |
19 | //单例
20 | + (instancetype)sharedInstance;
21 |
22 | //保存颜色 添加到收藏列表
23 | - (void)saveColorOX:(NSString*)oxStr andRGB:(NSString*)rgbStr;
24 |
25 | //删除
26 | - (void)deleteWithModel:(ColorFavCellModel*)model;
27 |
28 | //列出收藏颜色
29 | - (NSArray*)showFavList;
30 |
31 | - (int)isBuyNoAds;
32 | //购买去广告
33 | - (void)buyNoAds;
34 | //广告重置 出现
35 | - (void)adsReset;
36 | @end
37 |
--------------------------------------------------------------------------------
/ColorM/ColorM/CoreDataOperations.m:
--------------------------------------------------------------------------------
1 | //
2 | // CoreDataOperations.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "CoreDataOperations.h"
10 |
11 | @implementation CoreDataOperations
12 | static CoreDataOperations *instance = nil;
13 |
14 | + (instancetype)sharedInstance
15 | {
16 | return [[CoreDataOperations alloc] init];
17 | }
18 |
19 | + (instancetype)allocWithZone:(struct _NSZone *)zone
20 | {
21 | static dispatch_once_t onceToken;
22 | dispatch_once(&onceToken, ^{
23 | instance = [super allocWithZone:zone];
24 | });
25 | return instance;
26 | }
27 |
28 | - (instancetype)init
29 | {
30 | static dispatch_once_t onceToken;
31 | dispatch_once(&onceToken, ^{
32 | instance = [super init];
33 | if (instance) {
34 | instance.managedObjectContext = ((AppDelegate*)[UIApplication sharedApplication].delegate).persistentContainer.viewContext;
35 | }
36 | });
37 | return instance;
38 | }
39 |
40 | //保存颜色 添加到收藏列表
41 | - (void)saveColorOX:(NSString*)oxStr andRGB:(NSString*)rgbStr{
42 | Fav *fav = [[Fav alloc] initWithContext:self.managedObjectContext];
43 | fav.colorOX = oxStr;
44 | fav.colorRGB = rgbStr;
45 | fav.timestamp = [NSDate date];
46 | fav.colorID = [NSString stringWithFormat:@"%@", [fav objectID]];
47 | [self.managedObjectContext save:nil];
48 | }
49 |
50 | //列出收藏颜色
51 | - (NSArray*)showFavList{
52 | NSFetchRequest *fetchRequest = [Fav fetchRequest];
53 | NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"timestamp"
54 | ascending:NO];
55 | [fetchRequest setSortDescriptors:[NSArray arrayWithObjects:sortDescriptor, nil]];
56 |
57 | NSError *error = nil;
58 | NSArray *fetchedObjects = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
59 | return fetchedObjects;
60 | }
61 |
62 |
63 | //删除
64 | - (void)deleteWithModel:(ColorFavCellModel*)model{
65 |
66 | NSFetchRequest *fetchRequest = [Fav fetchRequest];
67 | NSPredicate *predicate = [NSPredicate predicateWithFormat:@"colorID = %@",model.colorID ];
68 | [fetchRequest setPredicate:predicate];
69 |
70 | NSError *error = nil;
71 | NSArray *fetchedObjects = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
72 | [self.managedObjectContext deleteObject:[fetchedObjects firstObject]];
73 | [self.managedObjectContext save:nil];
74 |
75 | }
76 |
77 | - (int)isBuyNoAds {
78 | NSFetchRequest *fetchRequest = [User fetchRequest];
79 | NSError *error = nil;
80 | NSArray *fetchedObjects = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
81 | User *user = [fetchedObjects firstObject];
82 |
83 | return user.isBuy;
84 |
85 |
86 | }
87 |
88 |
89 | - (void)buyNoAds {
90 | NSFetchRequest *fetchRequest = [User fetchRequest];
91 | NSArray *fetchedObjects = [self.managedObjectContext executeFetchRequest:fetchRequest error:nil];
92 | User *user;
93 | if (fetchedObjects.count > 0) {
94 | user = fetchedObjects.firstObject;
95 | }else{
96 | user = [[User alloc] initWithContext:self.managedObjectContext];
97 | }
98 | user.isBuy = 1;
99 | [self.managedObjectContext updatedObjects];
100 |
101 | }
102 |
103 | - (void)adsReset {
104 | NSFetchRequest *fetchRequest = [User fetchRequest];
105 | NSArray *fetchedObjects = [self.managedObjectContext executeFetchRequest:fetchRequest error:nil];
106 | User *user;
107 | if (fetchedObjects.count > 0) {
108 | user = fetchedObjects.firstObject;
109 | }else{
110 | user = [[User alloc] initWithContext:self.managedObjectContext];
111 | }
112 | user.isBuy = 0;
113 | [self.managedObjectContext updatedObjects];
114 |
115 | }
116 | @end
117 |
--------------------------------------------------------------------------------
/ColorM/ColorM/CustomColorViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // CustomColorViewController.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface CustomColorViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ColorM/ColorM/CustomColorViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // CustomColorViewController.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/30.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "CustomColorViewController.h"
10 | #import "WSColorImageView.h"
11 | #import "CoreDataOperations.h"
12 | #import "GDTMobBannerView.h"
13 | #import "GDTMobInterstitial.h"
14 | @interface CustomColorViewController ()
15 | @property(nonatomic,copy)NSString *colorRgbStr;
16 | @property(nonatomic,strong)GDTMobInterstitial *interstitial;
17 | @property(nonatomic,strong)GDTMobBannerView *bannerView;
18 |
19 | @end
20 |
21 | @implementation CustomColorViewController
22 |
23 | - (void)viewDidLoad {
24 | [super viewDidLoad];
25 | CGFloat colorWidth = CGRectGetWidth(self.view.frame) * 0.8;
26 | CGFloat colorX = CGRectGetMidX(self.view.frame) - colorWidth/2;
27 | CGFloat colorY = 100;
28 |
29 | //btn
30 | CGFloat btnWidth = CGRectGetWidth(self.view.frame) * 0.4;
31 | CGFloat btnX = CGRectGetMidX(self.view.frame) - btnWidth/2;
32 | CGFloat btnY = colorY + colorWidth + colorY * 0.2;
33 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(btnX, btnY, btnWidth, btnWidth/2)];
34 | [btn addTarget:self action:@selector(clickBtn:) forControlEvents:UIControlEventTouchUpInside];
35 | [self.view addSubview:btn];
36 |
37 | //lab ox
38 | CGFloat laboxWidth = btnWidth;
39 | CGFloat laboxX = CGRectGetMidX(self.view.frame) - laboxWidth/2;
40 | CGFloat laboxY = CGRectGetMaxY(btn.frame) + colorY * 0.2;
41 | UILabel *labelox = [[UILabel alloc]initWithFrame:CGRectMake(laboxX,laboxY,laboxWidth,laboxWidth/4)];
42 | labelox.textAlignment = NSTextAlignmentCenter;
43 | labelox.font = [UIFont systemFontOfSize:18];
44 | [self.view addSubview:labelox];
45 |
46 | //lab rgb
47 | CGFloat labrgbWidth = btnWidth;
48 | CGFloat labrgbX = CGRectGetMidX(self.view.frame) - laboxWidth/2;
49 | CGFloat labrgbY = CGRectGetMaxY(labelox.frame);
50 | UILabel *labelrgb = [[UILabel alloc]initWithFrame:CGRectMake(labrgbX,labrgbY,labrgbWidth,labrgbWidth/4)];
51 | labelrgb.textAlignment = NSTextAlignmentCenter;
52 | labelrgb.font = [UIFont systemFontOfSize:18];
53 | [self.view addSubview:labelrgb];
54 | self.colorRgbStr = @"255,255,255";
55 |
56 | WSColorImageView *ws = [[WSColorImageView alloc]initWithFrame:CGRectMake(colorX,colorY,colorWidth,colorWidth)];
57 | [self.view addSubview:ws];
58 | ws.currentColorBlock = ^(UIColor *color,NSString *rgbStr){
59 | btn.backgroundColor = color;
60 | self.colorRgbStr = rgbStr;
61 |
62 | NSArray *arr = [rgbStr componentsSeparatedByString:@","];
63 | int r = [arr[0] intValue];
64 | int g = [arr[1] intValue];
65 | int b = [arr[2] intValue];
66 |
67 | NSString *rOX = [self stringWithHexNumber:r];
68 | NSString *gOX = [self stringWithHexNumber:g];
69 | NSString *bOX = [self stringWithHexNumber:b];
70 | NSString *ox = [NSString stringWithFormat:@"ox%@%@%@",rOX,gOX,bOX];
71 | NSString *rgb = [NSString stringWithFormat:@"RGB(%@)",rgbStr];
72 | labelox.text = ox;
73 | labelrgb.text = rgb;
74 | };
75 |
76 |
77 |
78 |
79 | }
80 |
81 | - (void)viewWillAppear:(BOOL)animated{
82 | [super viewWillAppear:animated];
83 | int isBuy = [[CoreDataOperations sharedInstance] isBuyNoAds];
84 | if (isBuy == 0) {
85 |
86 | self.bannerView = [[GDTMobBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-self.tabBarController.tabBar.frame.size.height-50, self.view.frame.size.width, 50)
87 | appkey:GDT_APPID placementId:GDT_BANNER_FAV];
88 |
89 | self.bannerView.currentViewController = [[UIApplication sharedApplication] keyWindow].rootViewController;
90 | self.bannerView.isAnimationOn = NO;
91 | self.bannerView.showCloseBtn = NO;
92 | self.bannerView.isGpsOn = YES;
93 | [self.bannerView loadAdAndShow];
94 | [self.view addSubview:self.bannerView];
95 |
96 | }else{
97 | [self.bannerView removeFromSuperview];
98 | self.bannerView = nil;
99 | }
100 |
101 | self.interstitial = [[GDTMobInterstitial alloc] initWithAppkey:GDT_APPID placementId:GDT_INTERSTITIAL_CUSTOMFAV];
102 | self.interstitial.delegate = self;
103 | [self.interstitial loadAd];
104 |
105 |
106 | }
107 |
108 | - (void)clickBtn:(UIButton*)btn{
109 |
110 |
111 | NSArray *arr = [self.colorRgbStr componentsSeparatedByString:@","];
112 | CGFloat r = [arr[0] intValue];
113 | CGFloat g = [arr[1] intValue];
114 | CGFloat b = [arr[2] intValue];
115 |
116 | NSString *rOX = [self stringWithHexNumber:r];
117 | NSString *gOX = [self stringWithHexNumber:g];
118 | NSString *bOX = [self stringWithHexNumber:b];
119 | NSString *oxStr = [NSString stringWithFormat:@"ox%@%@%@",rOX,gOX,bOX];
120 | NSString *rgbStr = [NSString stringWithFormat:@"RGB(%@)",self.colorRgbStr];
121 |
122 |
123 | UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"复制到剪切板" preferredStyle:UIAlertControllerStyleActionSheet];
124 | [alertController addAction:[UIAlertAction actionWithTitle:oxStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
125 | UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
126 | [pasteboard setString:oxStr];
127 | }]];
128 |
129 | [alertController addAction:[UIAlertAction actionWithTitle:rgbStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
130 | UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
131 | [pasteboard setString:rgbStr];
132 | }]];
133 | [alertController addAction:[UIAlertAction actionWithTitle:@"收藏" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
134 |
135 | //save
136 | NSLog(@"click fav");
137 | [[CoreDataOperations sharedInstance] saveColorOX:[NSString stringWithFormat:@"%@%@%@",rOX,gOX,bOX] andRGB:[NSString stringWithFormat:@"%@",self.colorRgbStr]];
138 | if ([self.interstitial isReady]) {
139 | [self.interstitial presentFromRootViewController:self];
140 | }
141 |
142 | }]];
143 | [alertController addAction:[UIAlertAction actionWithTitle:@"cancel" style:UIAlertActionStyleCancel handler:nil]];
144 | [self presentViewController:alertController animated:YES completion:nil];
145 |
146 | }
147 |
148 | //转16进制字符串
149 | - (NSString *)stringWithHexNumber:(NSUInteger)hexNumber{
150 | char hexChar[6];
151 | sprintf(hexChar, "%X", (int)hexNumber);
152 | NSString *hexString = [NSString stringWithCString:hexChar encoding:NSUTF8StringEncoding];
153 | return hexString;
154 | }
155 |
156 | - (void)didReceiveMemoryWarning {
157 | [super didReceiveMemoryWarning];
158 | // Dispose of any resources that can be recreated.
159 | }
160 |
161 | @end
162 |
--------------------------------------------------------------------------------
/ColorM/ColorM/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | 配色助手
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | com.gongwenkai.ColorMShopping
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.2
21 | CFBundleVersion
22 | 5
23 | LSRequiresIPhoneOS
24 |
25 | NSAppTransportSecurity
26 |
27 | NSAllowsArbitraryLoads
28 |
29 |
30 | NSLocationAlwaysUsageDescription
31 | 总是使用定位
32 | NSLocationWhenInUseUsageDescription
33 | 使用定位
34 | UILaunchStoryboardName
35 | LaunchScreen
36 | UIMainStoryboardFile
37 | Main
38 | UIRequiredDeviceCapabilities
39 |
40 | armv7
41 |
42 | UISupportedInterfaceOrientations
43 |
44 | UIInterfaceOrientationPortrait
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/ColorM/ColorM/UI03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/UI03.jpg
--------------------------------------------------------------------------------
/ColorM/ColorM/UIButton+Color.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIButton+Color.h
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/29.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | @interface UIButton (Color)
12 | @property(nonatomic,copy)NSString *colorStr;
13 | @end
14 |
--------------------------------------------------------------------------------
/ColorM/ColorM/UIButton+Color.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIButton+Color.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/29.
6 | // Copyright © 2017年 gongwenkai. All rights reserved.
7 | //
8 |
9 | #import "UIButton+Color.h"
10 | static const void *kColorStr = @"colorStr";
11 |
12 | @implementation UIButton (Color)
13 | - (NSString *)colorStr {
14 | return objc_getAssociatedObject(self, kColorStr);
15 |
16 | }
17 | - (void)setColorStr:(NSString *)colorStr{
18 | objc_setAssociatedObject(self, kColorStr, colorStr, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
19 |
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/ColorM/ColorM/WSColorImageView.h:
--------------------------------------------------------------------------------
1 | //
2 | // WSColorImageView.h
3 | // 1111
4 | //
5 | // Created by iMac on 16/12/12.
6 | // Copyright © 2016年 zws. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface WSColorImageView : UIImageView
12 |
13 |
14 | @property (copy, nonatomic) void(^currentColorBlock)(UIColor *color,NSString *rgbStr);
15 |
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/ColorM/ColorM/WSColorImageView.m:
--------------------------------------------------------------------------------
1 | //
2 | // WSColorImageView.m
3 | // 1111
4 | //
5 | // Created by iMac on 16/12/12.
6 | // Copyright © 2016年 zws. All rights reserved.
7 | //
8 |
9 | #import "WSColorImageView.h"
10 |
11 | @interface WSColorImageView()
12 | @property (nonatomic,copy)NSString *rgbStr;
13 |
14 | @end
15 | @implementation WSColorImageView
16 |
17 | - (instancetype)initWithFrame:(CGRect)frame
18 | {
19 | self = [super initWithFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.width)];
20 | if (self) {
21 |
22 | self.image = [UIImage imageNamed:@"palette"];
23 | self.userInteractionEnabled = YES;
24 | self.layer.cornerRadius = frame.size.width/2;
25 | self.layer.masksToBounds = YES;
26 |
27 | }
28 | return self;
29 | }
30 |
31 |
32 | - (void)touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event {
33 |
34 | UITouch *touch = [touches anyObject];
35 | CGPoint pointL = [touch locationInView:self];
36 |
37 | if (pow(pointL.x - self.bounds.size.width/2, 2)+pow(pointL.y-self.bounds.size.width/2, 2) <= pow(self.bounds.size.width/2, 2)) {
38 |
39 | UIColor *color = [self colorAtPixel:pointL];
40 | if (self.currentColorBlock) {
41 |
42 | self.currentColorBlock(color,self.rgbStr);
43 | }
44 | }
45 | }
46 |
47 |
48 | - (void)touchesMoved:(NSSet *)touches withEvent:(nullable UIEvent *)event {
49 |
50 | UITouch *touch = [touches anyObject];
51 | CGPoint pointL = [touch locationInView:self];
52 |
53 | if (pow(pointL.x - self.bounds.size.width/2, 2)+pow(pointL.y-self.bounds.size.width/2, 2) <= pow(self.bounds.size.width/2, 2)) {
54 |
55 | UIColor *color = [self colorAtPixel:pointL];
56 |
57 | if (self.currentColorBlock) {
58 |
59 | self.currentColorBlock(color,self.rgbStr);
60 | }
61 | }
62 | }
63 |
64 |
65 |
66 | - (void)touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event {
67 | UITouch *touch = [touches anyObject];
68 | CGPoint pointL = [touch locationInView:self];
69 |
70 | if (pow(pointL.x - self.bounds.size.width/2, 2)+pow(pointL.y-self.bounds.size.width/2, 2) <= pow(self.bounds.size.width/2, 2)) {
71 |
72 | UIColor *color = [self colorAtPixel:pointL];
73 |
74 | if (self.currentColorBlock) {
75 |
76 | self.currentColorBlock(color,self.rgbStr);
77 | }
78 | }
79 | }
80 |
81 |
82 |
83 | //获取图片某一点的颜色
84 | - (UIColor *)colorAtPixel:(CGPoint)point {
85 | if (!CGRectContainsPoint(CGRectMake(0.0f, 0.0f, self.image.size.width, self.image.size.height), point)) {
86 | return nil;
87 | }
88 |
89 | NSInteger pointX = trunc(point.x);
90 | NSInteger pointY = trunc(point.y);
91 | CGImageRef cgImage = self.image.CGImage;
92 | NSUInteger width = self.image.size.width;
93 | NSUInteger height = self.image.size.height;
94 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
95 | int bytesPerPixel = 4;
96 | int bytesPerRow = bytesPerPixel * 1;
97 | NSUInteger bitsPerComponent = 8;
98 | unsigned char pixelData[4] = { 0, 0, 0, 0 };
99 | CGContextRef context = CGBitmapContextCreate(pixelData,
100 | 1,
101 | 1,
102 | bitsPerComponent,
103 | bytesPerRow,
104 | colorSpace,
105 | kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
106 | CGColorSpaceRelease(colorSpace);
107 | CGContextSetBlendMode(context, kCGBlendModeCopy);
108 |
109 | CGContextTranslateCTM(context, -pointX, pointY-(CGFloat)height);
110 | CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, (CGFloat)width, (CGFloat)height), cgImage);
111 | CGContextRelease(context);
112 |
113 | CGFloat red = (CGFloat)pixelData[0] / 255.0f;
114 | CGFloat green = (CGFloat)pixelData[1] / 255.0f;
115 | CGFloat blue = (CGFloat)pixelData[2] / 255.0f;
116 | CGFloat alpha = (CGFloat)pixelData[3] / 255.0f;
117 |
118 | NSLog(@"%f***%f***%f***%f",red,green,blue,alpha);
119 | NSLog(@"%d,%d,%d",pixelData[0],pixelData[1],pixelData[2]);
120 | self.rgbStr = [NSString stringWithFormat:@"%d,%d,%d",pixelData[0],pixelData[1],pixelData[2]];
121 | return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
122 | }
123 |
124 | - (void)setImage:(UIImage *)image {
125 | UIImage *temp = [self imageForResizeWithImage:image resize:CGSizeMake(self.frame.size.width, self.frame.size.width)];
126 | [super setImage:temp];
127 | }
128 |
129 | - (UIImage *)imageForResizeWithImage:(UIImage *)picture resize:(CGSize)resize {
130 | CGSize imageSize = resize; //CGSizeMake(25, 25)
131 | UIGraphicsBeginImageContextWithOptions(imageSize, NO,0.0);
132 | CGRect imageRect = CGRectMake(0.0, 0.0, imageSize.width, imageSize.height);
133 | [picture drawInRect:imageRect];
134 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
135 | return image;
136 | }
137 |
138 |
139 | @end
140 |
--------------------------------------------------------------------------------
/ColorM/ColorM/colorList.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | plistName
7 | red
8 | name
9 | 红色系
10 | descriptionName
11 | --是一种激奋的色彩。
12 | detail
13 | 红色--是一种激奋的色彩。刺激效果,能使人产生冲动,愤怒,热情,活力的感觉。
14 |
15 |
16 | plistName
17 | orange
18 | name
19 | 橙色系
20 | descriptionName
21 | --也是一种激奋的色彩。
22 | detail
23 | 橙色--也是一种激奋的色彩,具有轻快,欢欣,热烈,温馨,时尚的效果。
24 |
25 |
26 | plistName
27 | yellow
28 | name
29 | 黄色系
30 | descriptionName
31 | --具有快乐,希望,智慧和轻快的个性。
32 | detail
33 | 黄色--具有快乐,希望,智慧和轻快的个性,它的明度最高。
34 |
35 |
36 | plistName
37 | green
38 | name
39 | 绿色系
40 | descriptionName
41 | --介于冷暖两种色彩的中间。
42 | detail
43 | 绿色--介于冷暖两种色彩的中间。显得和睦,宁静,健康,安全的感觉。它和金黄,淡白搭配,可以产生优雅,舒适的气氛。
44 |
45 |
46 | plistName
47 | blue
48 | name
49 | 青色系
50 | descriptionName
51 | --最具凉爽,清新,专业的色彩。
52 | detail
53 | 青色--最具凉爽,清新,专业的色彩。它和白色混合,能体现柔顺,淡雅,浪漫的气氛。
54 |
55 |
56 | plistName
57 | purple
58 | name
59 | 紫色系
60 | descriptionName
61 | --波长最短的可见光波。
62 | detail
63 | 紫色--波长最短的可见光波。紫色是非知觉的色,它美丽又神秘,给人深刻的印象,它既富有威胁性,又富有鼓舞性。紫色象征虔诚的色相,当光明与理解照亮了蒙昧的虔诚之色时,优美可爱的晕色就会使人心醉!
64 |
65 |
66 | plistName
67 | neutral
68 | name
69 | 无彩色
70 | descriptionName
71 | --指除了色彩以外的其他颜色。
72 | detail
73 | 无彩色--指除了色彩以外的其他颜色,明度从0变化到100,而彩度很小接近于0。
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/ColorM/ColorM/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ColorM
4 | //
5 | // Created by gongwenkai on 2017/1/25.
6 | // Copyright © 2017年 gongwenkai. 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 |
--------------------------------------------------------------------------------
/ColorM/ColorM/neutral.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | color
7 | 243,240,225
8 | colorDescription
9 | 闪光
10 | colorName
11 | 贝色
12 | colors
13 |
14 |
15 | 169,215,221
16 | 243,240,225
17 | 251,230,189
18 |
19 |
20 | 223,240,199
21 | 193,214,168
22 | 243,240,225
23 |
24 |
25 | 243,240,225
26 | 241,204,196
27 | 215,174,196
28 |
29 |
30 | 206,213,164
31 | 243,240,225
32 | 246,200,153
33 |
34 |
35 |
36 |
37 | color
38 | 139,115,88
39 | colorDescription
40 | 空阔
41 | colorName
42 | 空五倍子色
43 | colors
44 |
45 |
46 | 160,98,121
47 | 103,81,76
48 | 139,115,88
49 |
50 |
51 | 139,115,88
52 | 108,85,115
53 | 150,118,146
54 |
55 |
56 | 114,139,125
57 | 84,92,76
58 | 139,115,88
59 |
60 |
61 | 139,115,88
62 | 75,83,118
63 | 95,139,116
64 |
65 |
66 |
67 |
68 | color
69 | 174,158,121
70 | colorDescription
71 | 怀念
72 | colorName
73 | 灰汁色
74 | colors
75 |
76 |
77 | 174,158,121
78 | 190,180,120
79 | 128,152,113
80 |
81 |
82 | 174,158,121
83 | 149,184,177
84 | 102,129,106
85 |
86 |
87 | 73,112,129
88 | 202,195,126
89 | 174,158,121
90 |
91 |
92 | 161,95,113
93 | 183,187,155
94 | 174,158,121
95 |
96 |
97 |
98 |
99 | color
100 | 115,113,114
101 | colorDescription
102 | 中庸
103 | colorName
104 | 中灰
105 | colors
106 |
107 |
108 | 194,182,206
109 | 115,113,114
110 | 195,155,134
111 |
112 |
113 | 194,160,157
114 | 115,113,114
115 | 175,186,174
116 |
117 |
118 | 148,176,160
119 | 215,210,217
120 | 115,113,114
121 |
122 |
123 | 115,113,114
124 | 170,128,148
125 | 219,190,192
126 |
127 |
128 |
129 |
130 | color
131 | 144,142,143
132 | colorDescription
133 | 模糊
134 | colorName
135 | 浅灰
136 | colors
137 |
138 |
139 | 116,101,138
140 | 196,179,153
141 | 144,142,143
142 |
143 |
144 | 144,142,143
145 | 205,186,158
146 | 129,129,100
147 |
148 |
149 | 91,121,140
150 | 144,142,143
151 | 190,180,145
152 |
153 |
154 | 144,142,143
155 | 155,64,92
156 | 207,202,171
157 |
158 |
159 |
160 |
161 | color
162 | 118,136,142
163 | colorDescription
164 | 精致
165 | colorName
166 | 蓝灰
167 | colors
168 |
169 |
170 | 159,86,132
171 | 193,152,138
172 | 118,136,142
173 |
174 |
175 | 118,136,142
176 | 191,165,172
177 | 100,112,154
178 |
179 |
180 | 108,85,115
181 | 192,164,186
182 | 118,136,142
183 |
184 |
185 | 73,117,151
186 | 118,136,142
187 | 159,170,147
188 |
189 |
190 |
191 |
192 | color
193 | 168,130,137
194 | colorDescription
195 | 谦虚
196 | colorName
197 | 锈玫瑰
198 | colors
199 |
200 |
201 | 184,136,116
202 | 101,76,64
203 | 168,130,137
204 |
205 |
206 | 168,178,159
207 | 168,130,137
208 | 167,179,188
209 |
210 |
211 | 168,130,137
212 | 65,103,97
213 | 129,153,138
214 |
215 |
216 | 73,84,107
217 | 168,130,137
218 | 156,74,87
219 |
220 |
221 |
222 |
223 | color
224 | 198,198,198
225 | colorDescription
226 | 纤细
227 | colorName
228 | 银灰
229 | colors
230 |
231 |
232 | 215,188,178
233 | 157,180,191
234 | 198,198,198
235 |
236 |
237 | 201,179,199
238 | 239,216,194
239 | 198,198,198
240 |
241 |
242 | 198,198,198
243 | 235,225,216
244 | 219,171,179
245 |
246 |
247 | 166,204,177
248 | 225,229,198
249 | 198,198,198
250 |
251 |
252 |
253 |
254 | color
255 | 70,59,57
256 | colorDescription
257 | 深沉
258 | colorName
259 | 黑灰
260 | colors
261 |
262 |
263 | 153,46,46
264 | 70,59,57
265 | 73,92,133
266 |
267 |
268 | 158,77,47
269 | 70,59,57
270 | 83,127,136
271 |
272 |
273 | 114,103,144
274 | 70,59,57
275 | 110,132,94
276 |
277 |
278 | 137,91,121
279 | 70,59,57
280 | 153,113,88
281 |
282 |
283 |
284 |
285 | color
286 | 164,120,70
287 | colorDescription
288 | 衰退
289 | colorName
290 | 黄灰
291 | colors
292 |
293 |
294 | 109,73,36
295 | 164,120,70
296 | 132,50,68
297 |
298 |
299 | 164,120,70
300 | 175,178,156
301 | 105,85,125
302 |
303 |
304 | 82,63,99
305 | 147,81,63
306 | 164,120,70
307 |
308 |
309 | 114,142,132
310 | 69,105,117
311 | 164,120,70
312 |
313 |
314 |
315 |
316 | color
317 | 202,146,125
318 | colorDescription
319 | 迟缓
320 | colorName
321 | 赤白灰
322 | colors
323 |
324 |
325 | 202,146,125
326 | 197,185,143
327 | 133,173,141
328 |
329 |
330 | 202,146,125
331 | 117,124,96
332 | 115,85,107
333 |
334 |
335 | 158,76,89
336 | 202,146,125
337 | 73,86,108
338 |
339 |
340 | 162,167,129
341 | 111,106,73
342 | 202,146,125
343 |
344 |
345 |
346 |
347 | color
348 | 139,154,125
349 | colorDescription
350 | 谦逊
351 | colorName
352 | 青白灰
353 | colors
354 |
355 |
356 | 169,189,182
357 | 139,154,125
358 | 185,184,166
359 |
360 |
361 | 139,154,125
362 | 205,182,160
363 | 171,149,97
364 |
365 |
366 | 178,193,153
367 | 139,154,125
368 | 202,172,138
369 |
370 |
371 | 220,186,185
372 | 182,185,136
373 | 139,154,125
374 |
375 |
376 |
377 |
378 | color
379 | 140,116,122
380 | colorDescription
381 | 归隐
382 | colorName
383 | 鸠羽灰
384 | colors
385 |
386 |
387 | 131,78,102
388 | 189,183,149
389 | 140,116,122
390 |
391 |
392 | 97,110,111
393 | 162,164,146
394 | 140,116,122
395 |
396 |
397 | 140,116,122
398 | 85,98,114
399 | 126,145,136
400 |
401 |
402 | 135,137,151
403 | 128,80,120
404 | 140,116,122
405 |
406 |
407 |
408 |
409 | color
410 | 133,150,125
411 | colorDescription
412 | 幽远
413 | colorName
414 | 青绿灰
415 | colors
416 |
417 |
418 | 133,150,125
419 | 77,107,104
420 | 129,155,163
421 |
422 |
423 | 167,181,178
424 | 133,150,125
425 | 197,160,148
426 |
427 |
428 | 150,121,151
429 | 200,178,162
430 | 133,150,125
431 |
432 |
433 | 133,150,125
434 | 168,186,193
435 | 118,158,171
436 |
437 |
438 |
439 |
440 | color
441 | 91,102,90
442 | colorDescription
443 | 豁达
444 | colorName
445 | 青灰
446 | colors
447 |
448 |
449 | 91,102,90
450 | 169,154,142
451 | 100,87,118
452 |
453 |
454 | 91,102,90
455 | 128,144,153
456 | 123,90,109
457 |
458 |
459 | 117,88,81
460 | 161,132,134
461 | 91,102,90
462 |
463 |
464 | 95,84,122
465 | 163,112,125
466 | 91,102,90
467 |
468 |
469 |
470 |
471 | color
472 | 112,110,111
473 | colorDescription
474 | 沉闷
475 | colorName
476 | 铅色
477 | colors
478 |
479 |
480 | 112,110,111
481 | 189,173,179
482 | 131,116,148
483 |
484 |
485 | 120,149,159
486 | 184,168,162
487 | 112,110,111
488 |
489 |
490 | 200,173,194
491 | 112,110,111
492 | 137,153,177
493 |
494 |
495 | 112,110,111
496 | 209,184,161
497 | 144,159,145
498 |
499 |
500 |
501 |
502 | color
503 | 9,20,10
504 | colorDescription
505 | 崇高
506 | colorName
507 | 濡雨色
508 | colors
509 |
510 |
511 | 9,20,10
512 | 55,122,104
513 | 118,176,90
514 |
515 |
516 | 169,54,119
517 | 9,20,10
518 | 218,85,83
519 |
520 |
521 | 226,192,50
522 | 217,99,38
523 | 9,20,10
524 |
525 |
526 | 9,20,10
527 | 102,176,202
528 | 32,140,169
529 |
530 |
531 |
532 |
533 | color
534 | 68,49,43
535 | colorDescription
536 | 混浊
537 | colorName
538 | 中黄黑
539 | colors
540 |
541 |
542 | 193,114,73
543 | 68,49,43
544 | 142,148,80
545 |
546 |
547 | 166,96,47
548 | 218,183,110
549 | 68,49,43
550 |
551 |
552 | 68,49,43
553 | 161,175,141
554 | 44,97,107
555 |
556 |
557 | 142,148,80
558 | 68,49,43
559 | 165,99,124
560 |
561 |
562 |
563 |
564 | color
565 | 68,64,63
566 | colorDescription
567 | 暗淡
568 | colorName
569 | 消炭色
570 | colors
571 |
572 |
573 | 176,161,138
574 | 118,124,72
575 | 68,64,63
576 |
577 |
578 | 79,93,128
579 | 155,111,79
580 | 68,64,63
581 |
582 |
583 | 127,69,74
584 | 68,64,63
585 | 98,124,97
586 |
587 |
588 | 65,74,101
589 | 138,72,98
590 | 68,64,63
591 |
592 |
593 |
594 |
595 | color
596 | 147,143,142
597 | colorDescription
598 | 无常
599 | colorName
600 | 薄墨色
601 | colors
602 |
603 |
604 | 215,206,171
605 | 147,143,142
606 | 227,178,182
607 |
608 |
609 | 206,206,216
610 | 147,143,142
611 | 214,163,186
612 |
613 |
614 | 169,195,211
615 | 147,143,142
616 | 216,172,189
617 |
618 |
619 | 177,207,191
620 | 147,143,142
621 | 196,211,161
622 |
623 |
624 |
625 |
626 |
627 |
--------------------------------------------------------------------------------
/ColorM/ColorM/palette.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/ColorM/palette.png
--------------------------------------------------------------------------------
/ColorM/ColorM/purple.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | color
7 | 205,183,215
8 | colorDescription
9 | 脱俗
10 | colorName
11 | 薰衣草
12 | colors
13 |
14 |
15 | 133,172,205
16 | 242,238,188
17 | 205,183,215
18 |
19 |
20 | 205,183,215
21 | 212,229,184
22 | 155,166,138
23 |
24 |
25 | 171,201,196
26 | 84,114,146
27 | 205,183,215
28 |
29 |
30 | 229,200,169
31 | 180,98,154
32 | 205,183,215
33 |
34 |
35 |
36 |
37 | color
38 | 116,79,167
39 | colorDescription
40 | 风雅
41 | colorName
42 | 紫藤
43 | colors
44 |
45 |
46 | 116,79,167
47 | 172,115,112
48 | 91,116,129
49 |
50 |
51 | 116,79,167
52 | 209,204,169
53 | 115,153,118
54 |
55 |
56 | 116,79,167
57 | 174,153,165
58 | 162,206,152
59 |
60 |
61 | 43,78,144
62 | 81,150,160
63 | 116,79,167
64 |
65 |
66 |
67 |
68 | color
69 | 177,147,206
70 | colorDescription
71 | 清纯
72 | colorName
73 | 丁香
74 | colors
75 |
76 |
77 | 229,177,207
78 | 177,147,206
79 | 195,207,145
80 |
81 |
82 | 193,230,183
83 | 177,147,206
84 | 180,209,237
85 |
86 |
87 | 130,170,213
88 | 217,199,183
89 | 177,147,206
90 |
91 |
92 | 177,147,206
93 | 233,206,168
94 | 216,157,116
95 |
96 |
97 |
98 |
99 | color
100 | 176,105,183
101 | colorDescription
102 | 温存
103 | colorName
104 | 菖蒲色
105 | colors
106 |
107 |
108 | 176,105,183
109 | 228,206,191
110 | 160,140,181
111 |
112 |
113 | 176,105,183
114 | 207,46,132
115 | 233,229,181
116 |
117 |
118 | 178,197,230
119 | 176,105,183
120 | 193,221,144
121 |
122 |
123 | 176,105,183
124 | 233,229,181
125 | 183,199,124
126 |
127 |
128 |
129 |
130 | color
131 | 137,37,140
132 | colorDescription
133 | 神秘
134 | colorName
135 | 紫色
136 | colors
137 |
138 |
139 | 155,174,111
140 | 137,37,140
141 | 236,171,204
142 |
143 |
144 | 137,37,140
145 | 140,163,92
146 | 212,210,165
147 |
148 |
149 | 137,37,140
150 | 243,209,124
151 | 49,99,164
152 |
153 |
154 | 223,144,111
155 | 137,37,140
156 | 115,173,185
157 |
158 |
159 |
160 |
161 | color
162 | 136,61,156
163 | colorDescription
164 | 别致
165 | colorName
166 | 兰紫色
167 | colors
168 |
169 |
170 | 198,175,110
171 | 136,61,156
172 | 125,162,159
173 |
174 |
175 | 136,61,156
176 | 207,206,159
177 | 101,125,76
178 |
179 |
180 | 189,148,188
181 | 136,61,156
182 | 192,163,71
183 |
184 |
185 | 172,203,180
186 | 103,152,129
187 | 136,61,156
188 |
189 |
190 |
191 |
192 | color
193 | 176,33,131
194 | colorDescription
195 | 靓丽
196 | colorName
197 | 红紫色
198 | colors
199 |
200 |
201 | 229,202,127
202 | 98,182,198
203 | 176,33,131
204 |
205 |
206 | 172,204,97
207 | 225,222,199
208 | 176,33,131
209 |
210 |
211 | 176,33,131
212 | 228,124,151
213 | 176,206,152
214 |
215 |
216 | 90,45,134
217 | 229,200,169
218 | 176,33,131
219 |
220 |
221 |
222 |
223 | color
224 | 169,38,120
225 | colorDescription
226 | 雅致
227 | colorName
228 | 李子色
229 | colors
230 |
231 |
232 | 169,38,120
233 | 233,229,187
234 | 120,167,161
235 |
236 |
237 | 242,228,199
238 | 222,166,193
239 | 169,38,120
240 |
241 |
242 | 109,141,179
243 | 169,38,120
244 | 208,107,132
245 |
246 |
247 | 169,38,120
248 | 197,225,218
249 | 82,117,185
250 |
251 |
252 |
253 |
254 | color
255 | 117,71,139
256 | colorDescription
257 | 直觉
258 | colorName
259 | 紫水晶
260 | colors
261 |
262 |
263 | 210,95,143
264 | 117,71,139
265 | 133,140,202
266 |
267 |
268 | 85,173,178
269 | 117,71,139
270 | 144,193,85
271 |
272 |
273 | 192,69,75
274 | 117,71,139
275 | 200,164,63
276 |
277 |
278 | 194,77,133
279 | 233,229,181
280 | 117,71,139
281 |
282 |
283 |
284 |
285 | color
286 | 207,179,211
287 | colorDescription
288 | 柔美
289 | colorName
290 | 兰花色
291 | colors
292 |
293 |
294 | 207,179,211
295 | 234,231,183
296 | 224,150,150
297 |
298 |
299 | 210,217,166
300 | 207,179,211
301 | 249,197,186
302 |
303 |
304 | 207,179,211
305 | 138,160,195
306 | 171,201,196
307 |
308 |
309 | 207,179,211
310 | 233,229,187
311 | 109,155,196
312 |
313 |
314 |
315 |
316 | color
317 | 171,161,197
318 | colorDescription
319 | 淡薄
320 | colorName
321 | 欧薄荷
322 | colors
323 |
324 |
325 | 211,144,161
326 | 234,208,221
327 | 171,161,197
328 |
329 |
330 | 224,201,175
331 | 171,161,197
332 | 188,227,216
333 |
334 |
335 | 171,161,197
336 | 244,243,193
337 | 162,206,152
338 |
339 |
340 | 171,161,197
341 | 253,233,199
342 | 221,194,112
343 |
344 |
345 |
346 |
347 | color
348 | 184,156,180
349 | colorDescription
350 | 诡秘
351 | colorName
352 | 灰紫色
353 | colors
354 |
355 |
356 | 184,156,180
357 | 93,50,78
358 | 166,152,110
359 |
360 |
361 | 184,156,180
362 | 85,111,142
363 | 175,182,157
364 |
365 |
366 | 59,86,114
367 | 233,229,178
368 | 184,156,180
369 |
370 |
371 | 126,171,182
372 | 216,190,174
373 | 184,156,180
374 |
375 |
376 |
377 |
378 | color
379 | 108,90,163
380 | colorDescription
381 | 理智
382 | colorName
383 | 青紫色
384 | colors
385 |
386 |
387 | 108,90,163
388 | 221,190,193
389 | 137,43,119
390 |
391 |
392 | 163,172,207
393 | 108,90,163
394 | 212,179,94
395 |
396 |
397 | 91,141,195
398 | 244,243,192
399 | 108,90,163
400 |
401 |
402 | 218,185,146
403 | 108,90,163
404 | 200,100,152
405 |
406 |
407 |
408 |
409 | color
410 | 107,60,132
411 | colorDescription
412 | 博大
413 | colorName
414 | 暗紫罗兰
415 | colors
416 |
417 |
418 | 198,180,143
419 | 178,103,166
420 | 107,60,132
421 |
422 |
423 | 89,113,163
424 | 164,180,170
425 | 107,60,132
426 |
427 |
428 | 68,101,106
429 | 179,170,127
430 | 107,60,132
431 |
432 |
433 | 130,66,106
434 | 180,180,139
435 | 107,60,132
436 |
437 |
438 |
439 |
440 | color
441 | 137,105,179
442 | colorDescription
443 | 时尚
444 | colorName
445 | 虹膜色
446 | colors
447 |
448 |
449 | 183,120,129
450 | 219,234,165
451 | 137,105,179
452 |
453 |
454 | 122,168,196
455 | 222,236,192
456 | 137,105,179
457 |
458 |
459 | 230,166,122
460 | 244,218,184
461 | 137,105,179
462 |
463 |
464 | 137,105,179
465 | 207,200,152
466 | 152,175,102
467 |
468 |
469 |
470 |
471 | color
472 | 123,43,131
473 | colorDescription
474 | 典雅
475 | colorName
476 | 暗紫色
477 | colors
478 |
479 |
480 | 90,141,170
481 | 178,186,205
482 | 123,43,131
483 |
484 |
485 | 88,40,78
486 | 222,181,148
487 | 123,43,131
488 |
489 |
490 | 72,106,117
491 | 144,175,128
492 | 123,43,131
493 |
494 |
495 | 123,43,131
496 | 220,193,173
497 | 120,133,192
498 |
499 |
500 |
501 |
502 | color
503 | 198,148,181
504 | colorDescription
505 | 朦胧
506 | colorName
507 | 古代紫
508 | colors
509 |
510 |
511 | 198,148,181
512 | 232,158,170
513 | 249,204,173
514 |
515 |
516 | 198,148,181
517 | 207,199,175
518 | 177,139,186
519 |
520 |
521 | 173,172,193
522 | 223,242,226
523 | 198,148,181
524 |
525 |
526 | 177,209,188
527 | 198,148,181
528 | 225,188,198
529 |
530 |
531 |
532 |
533 | color
534 | 123,22,92
535 | colorDescription
536 | 独立
537 | colorName
538 | 蝴蝶花
539 | colors
540 |
541 |
542 | 123,22,92
543 | 200,169,118
544 | 168,95,37
545 |
546 |
547 | 200,68,116
548 | 123,22,92
549 | 88,141,128
550 |
551 |
552 | 188,177,91
553 | 123,22,92
554 | 100,134,93
555 |
556 |
557 | 151,183,143
558 | 123,22,92
559 | 70,127,128
560 |
561 |
562 |
563 |
564 | color
565 | 101,37,111
566 | colorDescription
567 | 美丽
568 | colorName
569 | 香水草
570 | colors
571 |
572 |
573 | 101,37,111
574 | 188,189,145
575 | 84,125,105
576 |
577 |
578 | 137,37,140
579 | 198,148,181
580 | 101,37,111
581 |
582 |
583 | 60,68,128
584 | 170,143,71
585 | 101,37,111
586 |
587 |
588 | 155,127,83
589 | 101,37,111
590 | 154,97,129
591 |
592 |
593 |
594 |
595 | color
596 | 126,33,109
597 | colorDescription
598 | 亲切
599 | colorName
600 | 红豆色
601 | colors
602 |
603 |
604 | 126,33,109
605 | 193,153,131
606 | 29,113,107
607 |
608 |
609 | 126,33,109
610 | 214,166,96
611 | 59,96,144
612 |
613 |
614 | 104,64,133
615 | 167,170,122
616 | 126,33,109
617 |
618 |
619 | 50,50,100
620 | 177,108,94
621 | 126,33,109
622 |
623 |
624 |
625 |
626 |
627 |
--------------------------------------------------------------------------------
/ColorM/ColorM/red.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | color
7 | 206,51,45
8 | colorDescription
9 | 华丽
10 | colorName
11 | 绯
12 | colors
13 |
14 |
15 | 243,222,196
16 | 206,51,45
17 | 123,38,45
18 |
19 |
20 | 135,139,202
21 | 233,177,105
22 | 206,51,45
23 |
24 |
25 | 35,91,83
26 | 206,51,45
27 | 219,234,165
28 |
29 |
30 | 206,51,45
31 | 230,223,201
32 | 44,88,164
33 |
34 |
35 |
36 |
37 | color
38 | 232,43,52
39 | colorDescription
40 | 大胆
41 | colorName
42 | 绯红
43 | colors
44 |
45 |
46 | 174,189,61
47 | 232,43,52
48 | 90,62,145
49 |
50 |
51 | 239,114,41
52 | 232,43,52
53 | 37,170,174
54 |
55 |
56 | 232,43,52
57 | 246,181,46
58 | 213,63,56
59 |
60 |
61 | 175,40,110
62 | 50,154,88
63 | 232,43,52
64 |
65 |
66 |
67 |
68 | color
69 | 196,39,46
70 | colorDescription
71 | 威严
72 | colorName
73 | 深绯
74 | colors
75 |
76 |
77 | 200,108,118
78 | 196,39,46
79 | 67,27,50
80 |
81 |
82 | 196,39,46
83 | 119,116,29
84 | 71,85,117
85 |
86 |
87 | 75,61,95
88 | 196,39,46
89 | 174,152,83
90 |
91 |
92 | 41,117,74
93 | 94,8,24
94 | 196,39,46
95 |
96 |
97 |
98 |
99 | color
100 | 218,89,96
101 | colorDescription
102 | 温馨
103 | colorName
104 | 浅绯
105 | colors
106 |
107 |
108 | 218,89,96
109 | 235,179,177
110 | 253,221,185
111 |
112 |
113 | 239,194,146
114 | 218,89,96
115 | 147,80,73
116 |
117 |
118 | 166,177,195
119 | 227,198,187
120 | 218,89,96
121 |
122 |
123 | 137,176,192
124 | 218,89,96
125 | 176,205,152
126 |
127 |
128 |
129 |
130 | color
131 | 212,41,39
132 | colorDescription
133 | 力量
134 | colorName
135 | 正红
136 | colors
137 |
138 |
139 | 248,176,45
140 | 212,41,39
141 | 59,76,154
142 |
143 |
144 | 78,166,86
145 | 212,41,39
146 | 37,170,174
147 |
148 |
149 | 212,41,39
150 | 239,114,41
151 | 214,57,125
152 |
153 |
154 | 238,164,150
155 | 212,41,39
156 | 174,189,61
157 |
158 |
159 |
160 |
161 | color
162 | 214,131,127
163 | colorDescription
164 | 和气
165 | colorName
166 | 薄红
167 | colors
168 |
169 |
170 | 214,131,127
171 | 254,241,156
172 | 188,224,128
173 |
174 |
175 | 192,213,174
176 | 214,131,127
177 | 149,182,200
178 |
179 |
180 | 145,217,226
181 | 252,231,208
182 | 214,131,127
183 |
184 |
185 | 228,124,159
186 | 248,189,142
187 | 214,131,127
188 |
189 |
190 |
191 |
192 | color
193 | 241,119,141
194 | colorDescription
195 | 娇媚
196 | colorName
197 | 浓粉
198 | colors
199 |
200 |
201 | 241,119,141
202 | 250,211,149
203 | 239,114,41
204 |
205 |
206 | 200,68,116
207 | 241,119,141
208 | 88,141,128
209 |
210 |
211 | 207,196,100
212 | 241,119,141
213 | 118,158,110
214 |
215 |
216 | 173,211,164
217 | 241,119,141
218 | 88,162,162
219 |
220 |
221 |
222 |
223 | color
224 | 249,204,210
225 | colorDescription
226 | 轻柔
227 | colorName
228 | 浅粉
229 | colors
230 |
231 |
232 | 249,204,210
233 | 232,158,170
234 | 249,205,173
235 |
236 |
237 | 249,204,210
238 | 177,139,186
239 | 217,209,168
240 |
241 |
242 | 173,172,193
243 | 184,224,216
244 | 249,204,210
245 |
246 |
247 | 166,221,187
248 | 249,204,210
249 | 236,171,204
250 |
251 |
252 |
253 |
254 | color
255 | 212,29,119
256 | colorDescription
257 | 娇艳
258 | colorName
259 | 牡丹红
260 | colors
261 |
262 |
263 | 174,189,61
264 | 212,29,119
265 | 90,62,145
266 |
267 |
268 | 212,29,119
269 | 239,114,41
270 | 89,179,176
271 |
272 |
273 | 212,29,119
274 | 43,103,153
275 | 236,162,94
276 |
277 |
278 | 65,124,96
279 | 226,161,147
280 | 212,29,119
281 |
282 |
283 |
284 |
285 | color
286 | 235,75,126
287 | colorDescription
288 | 愉快
289 | colorName
290 | 山茶粉
291 | colors
292 |
293 |
294 | 229,132,79
295 | 219,225,89
296 | 235,75,126
297 |
298 |
299 | 178,207,88
300 | 235,75,126
301 | 121,194,213
302 |
303 |
304 | 235,75,126
305 | 219,234,165
306 | 215,64,56
307 |
308 |
309 | 235,75,126
310 | 216,181,146
311 | 135,76,146
312 |
313 |
314 |
315 |
316 | color
317 | 207,68,109
318 | colorDescription
319 | 微笑
320 | colorName
321 | 山茶色
322 | colors
323 |
324 |
325 | 243,222,196
326 | 207,68,109
327 | 244,156,185
328 |
329 |
330 | 95,162,136
331 | 249,205,173
332 | 207,68,109
333 |
334 |
335 | 237,212,138
336 | 207,68,109
337 | 181,214,217
338 |
339 |
340 | 207,68,109
341 | 210,187,216
342 | 125,54,75
343 |
344 |
345 |
346 |
347 | color
348 | 241,202,208
349 | colorDescription
350 | 动人
351 | colorName
352 | 浅山茶色
353 | colors
354 |
355 |
356 | 241,202,208
357 | 235,179,177
358 | 253,221,185
359 |
360 |
361 | 241,202,208
362 | 176,187,212
363 | 215,101,128
364 |
365 |
366 | 158,193,211
367 | 241,202,208
368 | 183,157,198
369 |
370 |
371 | 126,174,192
372 | 241,202,208
373 | 167,206,155
374 |
375 |
376 |
377 |
378 | color
379 | 232,36,108
380 | colorDescription
381 | 典雅
382 | colorName
383 | 蔷薇色
384 | colors
385 |
386 |
387 | 61,127,184
388 | 155,211,216
389 | 241,202,208
390 |
391 |
392 | 88,40,78
393 | 241,202,208
394 | 222,181,148
395 |
396 |
397 | 39,84,97
398 | 241,202,208
399 | 167,199,107
400 |
401 |
402 | 241,202,208
403 | 230,223,201
404 | 75,75,144
405 |
406 |
407 |
408 |
409 | color
410 | 237,166,185
411 | colorDescription
412 | 雅致
413 | colorName
414 | 珊瑚粉
415 | colors
416 |
417 |
418 | 237,166,185
419 | 243,222,196
420 | 120,167,161
421 |
422 |
423 | 225,222,199
424 | 161,153,209
425 | 237,166,185
426 |
427 |
428 | 109,141,179
429 | 237,166,185
430 | 207,107,132
431 |
432 |
433 | 237,166,185
434 | 197,226,218
435 | 82,117,185
436 |
437 |
438 |
439 |
440 | color
441 | 246,180,192
442 | colorDescription
443 | 梦想
444 | colorName
445 | 红梅粉
446 | colors
447 |
448 |
449 | 209,204,145
450 | 130,186,185
451 | 246,180,192
452 |
453 |
454 | 193,221,144
455 | 239,231,166
456 | 246,180,192
457 |
458 |
459 | 246,180,192
460 | 137,176,192
461 | 204,196,218
462 |
463 |
464 | 188,136,180
465 | 246,180,192
466 | 252,221,201
467 |
468 |
469 |
470 |
471 | color
472 | 239,107,153
473 | colorDescription
474 | 柔顺
475 | colorName
476 | 玫瑰粉
477 | colors
478 |
479 |
480 | 239,107,153
481 | 228,206,191
482 | 160,140,181
483 |
484 |
485 | 239,107,153
486 | 206,46,133
487 | 233,229,181
488 |
489 |
490 | 180,198,232
491 | 239,107,153
492 | 193,221,144
493 |
494 |
495 | 239,107,153
496 | 250,218,120
497 | 183,199,124
498 |
499 |
500 |
501 |
502 | color
503 | 210,27,73
504 | colorDescription
505 | 生动
506 | colorName
507 | 洋红
508 | colors
509 |
510 |
511 | 210,27,73
512 | 237,204,178
513 | 101,171,60
514 |
515 |
516 | 34,89,171
517 | 32,154,159
518 | 210,27,73
519 |
520 |
521 | 210,27,73
522 | 244,151,66
523 | 215,64,56
524 |
525 |
526 | 210,27,73
527 | 253,222,146
528 | 97,72,143
529 |
530 |
531 |
532 |
533 | color
534 | 235,71,56
535 | colorDescription
536 | 积极
537 | colorName
538 | 朱红
539 | colors
540 |
541 |
542 | 210,201,76
543 | 235,71,56
544 | 109,172,223
545 |
546 |
547 | 235,71,56
548 | 142,60,105
549 | 227,139,113
550 |
551 |
552 | 235,71,56
553 | 247,182,54
554 | 106,202,197
555 |
556 |
557 | 157,211,85
558 | 235,71,56
559 | 245,156,66
560 |
561 |
562 |
563 |
564 | color
565 | 216,59,55
566 | colorDescription
567 | 热情
568 | colorName
569 | 中国红
570 | colors
571 |
572 |
573 | 37,78,162
574 | 216,59,55
575 | 223,172,64
576 |
577 |
578 | 229,110,154
579 | 250,218,120
580 | 216,59,55
581 |
582 |
583 | 132,187,78
584 | 216,59,55
585 | 237,163,147
586 |
587 |
588 | 50,155,88
589 | 216,59,55
590 | 45,177,205
591 |
592 |
593 |
594 |
595 | color
596 | 187,62,60
597 | colorDescription
598 | 成熟
599 | colorName
600 | 深红
601 | colors
602 |
603 |
604 | 187,62,60
605 | 188,189,145
606 | 105,149,125
607 |
608 |
609 | 210,187,216
610 | 187,62,60
611 | 85,63,97
612 |
613 |
614 | 63,92,133
615 | 130,115,70
616 | 187,62,60
617 |
618 |
619 | 194,105,65
620 | 187,62,60
621 | 89,18,13
622 |
623 |
624 |
625 |
626 | color
627 | 172,21,64
628 | colorDescription
629 | 高贵
630 | colorName
631 | 酒红
632 | colors
633 |
634 |
635 | 172,21,64
636 | 200,158,112
637 | 123,38,45
638 |
639 |
640 | 204,101,52
641 | 226,185,153
642 | 172,21,64
643 |
644 |
645 | 186,88,98
646 | 172,21,64
647 | 87,30,73
648 |
649 |
650 | 172,21,64
651 | 99,140,173
652 | 50,50,100
653 |
654 |
655 |
656 |
657 | color
658 | 90,30,46
659 | colorDescription
660 | 坚强
661 | colorName
662 | 浓酒红
663 | colors
664 |
665 |
666 | 156,69,91
667 | 166,125,69
668 | 90,30,46
669 |
670 |
671 | 41,117,74
672 | 90,30,46
673 | 66,117,140
674 |
675 |
676 | 81,71,111
677 | 150,127,104
678 | 90,30,46
679 |
680 |
681 | 76,101,88
682 | 90,30,46
683 | 136,14,57
684 |
685 |
686 |
687 |
688 | color
689 | 195,32,93
690 | colorDescription
691 | 富足
692 | colorName
693 | 宝石红
694 | colors
695 |
696 |
697 | 195,32,93
698 | 233,176,169
699 | 235,67,86
700 |
701 |
702 | 195,32,93
703 | 251,210,93
704 | 68,139,189
705 |
706 |
707 | 104,64,133
708 | 242,134,51
709 | 195,32,93
710 |
711 |
712 | 50,50,100
713 | 195,32,93
714 | 130,31,52
715 |
716 |
717 |
718 |
719 | color
720 | 181,91,119
721 | colorDescription
722 | 古朴
723 | colorName
724 | 枯红
725 | colors
726 |
727 |
728 | 181,91,119
729 | 221,210,161
730 | 166,177,195
731 |
732 |
733 | 181,91,119
734 | 228,206,191
735 | 155,93,61
736 |
737 |
738 | 224,152,124
739 | 181,91,119
740 | 158,183,122
741 |
742 |
743 | 181,91,119
744 | 136,61,50
745 | 160,140,181
746 |
747 |
748 |
749 |
750 | color
751 | 218,97,150
752 | colorDescription
753 | 浪漫
754 | colorName
755 | 桃色
756 | colors
757 |
758 |
759 | 218,97,150
760 | 174,203,205
761 | 141,120,160
762 |
763 |
764 | 195,171,216
765 | 218,97,150
766 | 251,218,145
767 |
768 |
769 | 167,208,196
770 | 205,220,242
771 | 218,97,150
772 |
773 |
774 | 218,97,150
775 | 200,224,174
776 | 94,156,155
777 |
778 |
779 |
780 |
781 | color
782 | 147,17,76
783 | colorDescription
784 | 豪华
785 | colorName
786 | 葡萄色
787 | colors
788 |
789 |
790 | 147,17,76
791 | 202,126,96
792 | 67,27,50
793 |
794 |
795 | 147,17,76
796 | 234,148,63
797 | 44,86,148
798 |
799 |
800 | 91,45,116
801 | 149,111,69
802 | 147,17,76
803 |
804 |
805 | 168,186,124
806 | 27,98,74
807 | 147,17,76
808 |
809 |
810 |
811 |
812 | color
813 | 194,31,116
814 | colorDescription
815 | 个性
816 | colorName
817 | 品红
818 | colors
819 |
820 |
821 | 213,99,131
822 | 194,31,116
823 | 90,155,161
824 |
825 |
826 | 248,176,45
827 | 44,88,165
828 | 194,31,116
829 |
830 |
831 | 194,31,116
832 | 169,170,51
833 | 206,51,45
834 |
835 |
836 | 55,130,128
837 | 129,195,98
838 | 194,31,116
839 |
840 |
841 |
842 |
843 | color
844 | 168,55,87
845 | colorDescription
846 | 风韵
847 | colorName
848 | 胭脂红
849 | colors
850 |
851 |
852 | 204,157,144
853 | 168,55,87
854 | 119,33,94
855 |
856 |
857 | 90,140,153
858 | 168,55,87
859 | 92,9,24
860 |
861 |
862 | 174,182,86
863 | 35,91,83
864 | 168,55,87
865 |
866 |
867 | 233,177,105
868 | 83,44,107
869 | 168,55,87
870 |
871 |
872 |
873 |
874 |
875 |
--------------------------------------------------------------------------------
/ColorM/GDTMobBannerView.h:
--------------------------------------------------------------------------------
1 | //
2 | // GDTMobBannerView.h
3 | // GDTMobSDK
4 | //
5 | // Created by chaogao on 13-11-5.
6 | // Copyright (c) 2013年 Tencent. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | /**
13 | * 广点通推荐尺寸,开发者在嵌入Banner条时,可以手动设置Banner条的宽度用来满足场景需求,
14 | * 而高度的话广点通侧不建议更改,否则显示效果会有影响
15 | */
16 | #define GDTMOB_AD_SUGGEST_SIZE_320x50 CGSizeMake(320, 50) //For iPhone
17 | #define GDTMOB_AD_SUGGEST_SIZE_468x60 CGSizeMake(468, 60) //For iPad
18 | #define GDTMOB_AD_SUGGEST_SIZE_728x90 CGSizeMake(728, 90) //For iPad
19 |
20 | @protocol GDTMobBannerViewDelegate
21 |
22 | @optional
23 |
24 | - (void)bannerViewMemoryWarning;
25 |
26 | /**
27 | * 请求广告条数据成功后调用
28 | * 详解:当接收服务器返回的广告数据成功后调用该函数
29 | */
30 | - (void)bannerViewDidReceived;
31 |
32 | /**
33 | * 请求广告条数据失败后调用
34 | * 详解:当接收服务器返回的广告数据失败后调用该函数
35 | */
36 | - (void)bannerViewFailToReceived:(NSError *)error;
37 |
38 | /**
39 | * 应用进入后台时调用
40 | * 详解:当点击应用下载或者广告调用系统程序打开,应用将被自动切换到后台
41 | */
42 | - (void)bannerViewWillLeaveApplication;
43 |
44 | /**
45 | * banner条被用户关闭时调用
46 | * 详解:当打开showCloseBtn开关时,用户有可能点击关闭按钮从而把广告条关闭
47 | */
48 | - (void)bannerViewWillClose;
49 | /**
50 | * banner条曝光回调
51 | */
52 | - (void)bannerViewWillExposure;
53 | /**
54 | * banner条点击回调
55 | */
56 | - (void)bannerViewClicked;
57 |
58 | /**
59 | * banner广告点击以后即将弹出全屏广告页
60 | */
61 | - (void)bannerViewWillPresentFullScreenModal;
62 | /**
63 | * banner广告点击以后弹出全屏广告页完毕
64 | */
65 | - (void)bannerViewDidPresentFullScreenModal;
66 | /**
67 | * 全屏广告页即将被关闭
68 | */
69 | - (void)bannerViewWillDismissFullScreenModal;
70 | /**
71 | * 全屏广告页已经被关闭
72 | */
73 | - (void)bannerViewDidDismissFullScreenModal;
74 | @end
75 |
76 | @interface GDTMobBannerView : UIView
77 |
78 | /**
79 | * 父视图
80 | * 详解:[必选]需设置为显示广告的UIViewController
81 | */
82 | @property (nonatomic, weak) UIViewController *currentViewController;
83 |
84 | /**
85 | * 委托 [可选]
86 | */
87 | @property(nonatomic, weak) id delegate;
88 |
89 | /**
90 | * 广告刷新间隔 [可选]
91 | */
92 | @property(nonatomic, assign) int interval;
93 |
94 | /**
95 | * GPS精准广告定位模式开关,默认Gps关闭
96 | * 详解:[可选]GPS精准定位模式开关,YES为开启GPS,NO为关闭GPS,建议设为开启,可以获取地理位置信息,提高广告的填充率,增加收益。
97 | */
98 | @property(nonatomic, assign) BOOL isGpsOn;
99 |
100 | /**
101 | * Banner展现和轮播时的动画效果开关,默认打开
102 | */
103 | @property(nonatomic, assign) BOOL isAnimationOn;
104 |
105 | /**
106 | * Banner条展示关闭按钮,默认打开
107 | */
108 | @property(nonatomic, assign) BOOL showCloseBtn;
109 |
110 | /**
111 | * 构造方法
112 | * 详解:frame是广告banner展示的位置和大小,包含四个参数(x, y, width, height)
113 | * appkey是应用id
114 | * placementId是广告位id
115 | */
116 | - (id) initWithFrame:(CGRect)frame appkey:(NSString *)appkey placementId:(NSString *)placementId;
117 |
118 | /**
119 | * 拉取并展示广告
120 | */
121 | - (void) loadAdAndShow;
122 | @end
123 |
--------------------------------------------------------------------------------
/ColorM/GDTMobInterstitial.h:
--------------------------------------------------------------------------------
1 | //
2 | // GDTMobInterstitial.h
3 | // GDTMobApp
4 | //
5 | // Created by GaoChao on 13-12-30.
6 | // Copyright (c) 2013年 Tencent. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @class GDTMobInterstitial;
13 |
14 | @protocol GDTMobInterstitialDelegate
15 |
16 | @optional
17 |
18 | /**
19 | * 广告预加载成功回调
20 | * 详解:当接收服务器返回的广告数据成功后调用该函数
21 | */
22 | - (void)interstitialSuccessToLoadAd:(GDTMobInterstitial *)interstitial;
23 |
24 | /**
25 | * 广告预加载失败回调
26 | * 详解:当接收服务器返回的广告数据失败后调用该函数
27 | */
28 | - (void)interstitialFailToLoadAd:(GDTMobInterstitial *)interstitial error:(NSError *)error;
29 |
30 | /**
31 | * 插屏广告将要展示回调
32 | * 详解: 插屏广告即将展示回调该函数
33 | */
34 | - (void)interstitialWillPresentScreen:(GDTMobInterstitial *)interstitial;
35 |
36 | /**
37 | * 插屏广告视图展示成功回调
38 | * 详解: 插屏广告展示成功回调该函数
39 | */
40 | - (void)interstitialDidPresentScreen:(GDTMobInterstitial *)interstitial;
41 |
42 | /**
43 | * 插屏广告展示结束回调
44 | * 详解: 插屏广告展示结束回调该函数
45 | */
46 | - (void)interstitialDidDismissScreen:(GDTMobInterstitial *)interstitial;
47 |
48 | /**
49 | * 应用进入后台时回调
50 | * 详解: 当点击下载应用时会调用系统程序打开,应用切换到后台
51 | */
52 | - (void)interstitialApplicationWillEnterBackground:(GDTMobInterstitial *)interstitial;
53 |
54 | /**
55 | * 插屏广告曝光回调
56 | */
57 | - (void)interstitialWillExposure:(GDTMobInterstitial *)interstitial;
58 |
59 | /**
60 | * 插屏广告点击回调
61 | */
62 | - (void)interstitialClicked:(GDTMobInterstitial *)interstitial;
63 |
64 | /**
65 | * 点击插屏广告以后即将弹出全屏广告页
66 | */
67 | - (void)interstitialAdWillPresentFullScreenModal:(GDTMobInterstitial *)interstitial;
68 |
69 | /**
70 | * 点击插屏广告以后弹出全屏广告页
71 | */
72 | - (void)interstitialAdDidPresentFullScreenModal:(GDTMobInterstitial *)interstitial;
73 |
74 | /**
75 | * 全屏广告页将要关闭
76 | */
77 | - (void)interstitialAdWillDismissFullScreenModal:(GDTMobInterstitial *)interstitial;
78 |
79 | /**
80 | * 全屏广告页被关闭
81 | */
82 | - (void)interstitialAdDidDismissFullScreenModal:(GDTMobInterstitial *)interstitial;
83 |
84 | @end
85 |
86 | @interface GDTMobInterstitial : NSObject
87 |
88 | /**
89 | * GPS精准广告定位模式开关,默认Gps关闭
90 | * 详解:[可选]GPS精准定位模式开关,YES为开启GPS,NO为关闭GPS,建议设为开启,可以获取地理位置信息,提高广告的填充率,增加收益。
91 | */
92 | @property(nonatomic, assign) BOOL isGpsOn;
93 |
94 | /**
95 | * 插屏广告预加载是否完成
96 | */
97 | @property (nonatomic) BOOL isReady;
98 |
99 | /**
100 | * 委托对象
101 | */
102 | @property (nonatomic, weak) id delegate;
103 |
104 | /**
105 | * 构造方法
106 | * 详解:appkey是应用id, placementId是广告位id
107 | */
108 | -(id)initWithAppkey:(NSString *)appkey placementId:(NSString *)placementId;
109 |
110 | /**
111 | * 广告发起请求方法
112 | * 详解:[必选]发起拉取广告请求
113 | */
114 | -(void)loadAd;
115 |
116 | /**
117 | * 广告展示方法
118 | * 详解:[必选]发起展示广告请求, 必须传入用于显示插播广告的UIViewController
119 | */
120 | -(void)presentFromRootViewController:(UIViewController *)rootViewController;
121 |
122 | @end
123 |
--------------------------------------------------------------------------------
/ColorM/GDTNativeAd.h:
--------------------------------------------------------------------------------
1 | //
2 | // GDTNativeAd.h
3 | // GDTMobApp
4 | //
5 | // Created by GaoChao on 14/11/6.
6 | // Copyright (c) 2014年 Tencent. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | extern NSString* const GDTNativeAdDataKeyTitle;
13 | extern NSString* const GDTNativeAdDataKeyDesc;
14 | extern NSString* const GDTNativeAdDataKeyIconUrl;
15 | extern NSString* const GDTNativeAdDataKeyImgUrl;
16 | extern NSString* const GDTNativeAdDataKeyAppRating;
17 | extern NSString* const GDTNativeAdDataKeyAppPrice;
18 |
19 | @interface GDTNativeAdData : NSObject
20 |
21 | /*
22 | * 广告内容字典
23 | * 详解:[必选]开发者调用LoadAd成功之后从该属性中获取广告数据
24 | * 广告数据以字典的形式存储,开发者目前可以通过如下键获取数据
25 | * 1. GDTNativeAdDataKeyTitle 标题
26 | * 2. GDTNativeAdDataKeyDesc 描述
27 | * 3. GDTNativeAdDataKeyIconUrl 图标Url
28 | * 4. GDTNativeAdDataKeyImgUrl 大图Url
29 | * 5. GDTNativeAdDataKeyAppRating 应用类广告的星级
30 | * 6. GDTNativeAdDataKeyAppPrice 应用类广告的价格
31 | */
32 | @property (nonatomic, retain, readonly) NSDictionary *properties;
33 |
34 | @end
35 |
36 | @class GDTNativeAd;
37 |
38 | @protocol GDTNativeAdDelegate
39 |
40 | /**
41 | * 原生广告加载广告数据成功回调,返回为GDTNativeAdData对象的数组
42 | */
43 | -(void)nativeAdSuccessToLoad:(NSArray *)nativeAdDataArray;
44 |
45 | /**
46 | * 原生广告加载广告数据失败回调
47 | */
48 | -(void)nativeAdFailToLoad:(NSError *)error;
49 |
50 | @optional
51 | /**
52 | * 原生广告点击之后将要展示内嵌浏览器或应用内AppStore回调
53 | */
54 | - (void)nativeAdWillPresentScreen;
55 |
56 | /**
57 | * 原生广告点击之后应用进入后台时回调
58 | */
59 | - (void)nativeAdApplicationWillEnterBackground;
60 |
61 | /**
62 | * 原生广告点击以后,内置AppStore或是内置浏览器被关闭时回调
63 | */
64 | - (void)nativeAdClosed;
65 |
66 | @end
67 |
68 | @interface GDTNativeAd : NSObject
69 |
70 | /*
71 | * viewControllerForPresentingModalView
72 | * 详解:[必选]开发者需传入用来弹出目标页的ViewController,一般为当前ViewController
73 | */
74 | @property (nonatomic, weak) UIViewController *controller;
75 |
76 | /**
77 | * 委托对象
78 | */
79 | @property (nonatomic, weak) id delegate;
80 |
81 | /**
82 | * 构造方法
83 | * 详解:appkey是应用id, placementId是广告位id
84 | */
85 | -(instancetype)initWithAppkey:(NSString *)appkey placementId:(NSString *)placementId;
86 |
87 | /**
88 | * 广告发起请求方法
89 | * 详解:[必选]发起拉取广告请求,在获得广告数据后回调delegate
90 | * @param adCount 一次拉取广告的个数
91 | */
92 | -(void)loadAd:(int)adCount;
93 |
94 | /**
95 | * 广告数据渲染完毕即将展示时调用方法
96 | * 详解:[必选]广告数据渲染完毕,即将展示时需调用本方法。
97 | * @param nativeAdData 广告渲染的数据对象
98 | * @param view 渲染出的广告结果页面
99 | */
100 | -(void)attachAd:(GDTNativeAdData *)nativeAdData toView:(UIView *)view;
101 |
102 | /**
103 | * 广告点击调用方法
104 | * 详解:当用户点击广告时,开发者需调用本方法,系统会弹出内嵌浏览器、或内置AppStore、
105 | * 或打开系统Safari,来展现广告目标页面
106 | * @param nativeAdData 用户点击的广告数据对象
107 | */
108 | -(void)clickAd:(GDTNativeAdData *)nativeAdData;
109 |
110 | @end
111 |
--------------------------------------------------------------------------------
/ColorM/GDTSplashAd.h:
--------------------------------------------------------------------------------
1 | //
2 | // GDTSplashAd.h
3 | // GDTMobApp
4 | //
5 | // 广点通开屏广告,目前只支持iPhone设备上展示垂直方向的开屏广告
6 | // Created by GaoChao on 15/8/20.
7 | // Copyright © 2015年 Tencent. All rights reserved.
8 | //
9 |
10 | #import
11 | #import
12 |
13 | @class GDTSplashAd;
14 |
15 | @protocol GDTSplashAdDelegate
16 |
17 | @optional
18 | /**
19 | * 开屏广告成功展示
20 | */
21 | -(void)splashAdSuccessPresentScreen:(GDTSplashAd *)splashAd;
22 |
23 | /**
24 | * 开屏广告展示失败
25 | */
26 | -(void)splashAdFailToPresent:(GDTSplashAd *)splashAd withError:(NSError *)error;
27 |
28 | /**
29 | * 应用进入后台时回调
30 | * 详解: 当点击下载应用时会调用系统程序打开,应用切换到后台
31 | */
32 | - (void)splashAdApplicationWillEnterBackground:(GDTSplashAd *)splashAd;
33 |
34 | /**
35 | * 开屏广告点击回调
36 | */
37 | - (void)splashAdClicked:(GDTSplashAd *)splashAd;
38 |
39 | /**
40 | * 开屏广告将要关闭回调
41 | */
42 | - (void)splashAdWillClosed:(GDTSplashAd *)splashAd;
43 |
44 | /**
45 | * 开屏广告关闭回调
46 | */
47 | - (void)splashAdClosed:(GDTSplashAd *)splashAd;
48 |
49 | /**
50 | * 开屏广告点击以后即将弹出全屏广告页
51 | */
52 | - (void)splashAdWillPresentFullScreenModal:(GDTSplashAd *)splashAd;
53 |
54 | /**
55 | * 开屏广告点击以后弹出全屏广告页
56 | */
57 | - (void)splashAdDidPresentFullScreenModal:(GDTSplashAd *)splashAd;
58 |
59 | /**
60 | * 点击以后全屏广告页将要关闭
61 | */
62 | - (void)splashAdWillDismissFullScreenModal:(GDTSplashAd *)splashAd;
63 |
64 | /**
65 | * 点击以后全屏广告页已经关闭
66 | */
67 | - (void)splashAdDidDismissFullScreenModal:(GDTSplashAd *)splashAd;
68 |
69 | /**
70 | * 开屏广告剩余时间回调
71 | */
72 | - (void)splashAdLifeTime:(NSUInteger)time;
73 |
74 | @end
75 |
76 | @interface GDTSplashAd : NSObject
77 |
78 | /**
79 | * 委托对象
80 | */
81 | @property (nonatomic, weak) id delegate;
82 |
83 | /**
84 | * 拉取广告超时时间,默认为3秒
85 | * 详解:拉取广告超时时间,开发者调用loadAd方法以后会立即展示backgroundColor,然后在该超时时间内,如果广告拉
86 | * 取成功,则立马展示开屏广告,否则放弃此次广告展示机会。
87 | */
88 | @property (nonatomic, assign) int fetchDelay;
89 |
90 | /**
91 | * 开屏广告的背景色
92 | * 可以设置开屏图片来作为开屏加载时的默认图片
93 | */
94 | @property (nonatomic, copy) UIColor *backgroundColor;
95 |
96 | /**
97 | * 跳过按钮的位置
98 | */
99 | @property (nonatomic, assign) CGPoint skipButtonCenter;
100 |
101 | /**
102 | * 构造方法
103 | * 详解:appkey是应用id, placementId是广告位id
104 | */
105 | -(instancetype)initWithAppkey:(NSString *)appkey placementId:(NSString *)placementId;
106 |
107 | /**
108 | * 广告发起请求并展示在Window中
109 | * 详解:[可选]发起拉取广告请求,并将获取的广告以全屏形式展示在传入的Window参数中
110 | * @param window 展示全屏开屏的容器
111 | */
112 | -(void)loadAdAndShowInWindow:(UIWindow *)window;
113 |
114 | /**
115 | * 广告发起请求并展示在Window中, 同时在屏幕底部设置应用自身的Logo页面或是自定义View
116 | * 详解:[可选]发起拉取广告请求,并将获取的广告以半屏形式展示在传入的Window的上半部,剩余部分展示传入的bottomView
117 | * 请注意bottomView需设置好宽高,所占的空间不能过大,并保证广告界面的高度大于360
118 | * @param window 展示开屏的容器
119 | * bottomView 自定义底部View,可以在此View中设置应用Logo
120 | */
121 | -(void)loadAdAndShowInWindow:(UIWindow *)window withBottomView:(UIView *)bottomView;
122 |
123 | /**
124 | * 广告发起请求并展示在Window中, 同时在屏幕底部设置应用自身的Logo页面或是自定义View,skipView是自定义的“跳过”样式
125 | * 详解:[可选]发起拉取广告请求,并将获取的广告以半屏形式展示在传入的Window的上半部,剩余部分展示传入的bottomView
126 | * 请注意bottomView需设置好宽高,所占的空间不能过大,并保证广告界面的高度大于360
127 | * skipView
128 | * @param window 展示开屏的容器
129 | * bottomView 自定义底部View,可以在此View中设置应用Logo
130 | skipView 自定义”跳过“View.
131 | */
132 | -(void)loadAdAndShowInWindow:(UIWindow *)window withBottomView:(UIView *)bottomView skipView:(UIView *)skipView;
133 |
134 |
135 | @end
136 |
--------------------------------------------------------------------------------
/ColorM/GDTTrack.h:
--------------------------------------------------------------------------------
1 | //
2 | // GDTTrack.h
3 | // GDTMobApp
4 | //
5 | // Created by GaoChao on 16/1/7.
6 | // Copyright © 2016年 Tencent. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /*! 当用户完成注册操作的时候的事件名 */
12 | extern NSString *const GDTSDKAppEventNameCompletedRegistration;
13 | /*! 当用户加入购物车操作的事件名 */
14 | extern NSString *const GDTSDKAppEventNameAddToCart;
15 | /*! 当用户完成购买进行付费行为的事件名 */
16 | extern NSString *const GDTSDKAppEventNamePurchase;
17 | /*! 当用户完成应用评分行为的事件名 */
18 | extern NSString *const GDTSDKAppEventNameAppScore;
19 | /*! 当用户完成应用搜索行为的事件名 */
20 | extern NSString *const GDTSDKAppEventNameAppSearch;
21 |
22 | @interface GDTTrack : NSObject
23 |
24 | /*!
25 | @abstract
26 | 当应用界面回到活跃Activate状态时调用此方法,SDK会统计用户留存状况以及适时统计激活数据
27 |
28 | */
29 | + (void)activateApp;
30 |
31 | /*!
32 | @abstract
33 | 当应用界面回到活跃Activate状态时调用此方法,SDK会统计用户留存状况以及适时统计激活数据
34 |
35 | @param value 此次事件的价值
36 | */
37 | + (void)activateAppWithValue:(int)value;
38 |
39 | /*!
40 | @abstract
41 | 上报事件的基础接口,目前支持注册事件的上报
42 |
43 | @param eventName 事件名
44 | */
45 | + (void)logEvent:(NSString *)eventName;
46 |
47 | /*!
48 | @abstract
49 | 上报事件的基础接口,目前支持注册事件的上报
50 |
51 | @param eventName 事件名
52 | @param value 此次事件的价值
53 | */
54 | + (void)logEvent:(NSString *)eventName
55 | withValue:(int)value;
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/ColorM/libGDTMobSDK.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gongxiaokai/ColorM/949e5833e6cb7c8a523d4a7ced12899c40f3508f/ColorM/libGDTMobSDK.a
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ColorM广告版
2 | 使用广点通SDK 支持个人开发者 审核1-2天
3 | 使用时请修改ColorPrefixHeader.pch替换广点通key
4 |
--------------------------------------------------------------------------------