├── screenshots
├── 001.png
├── 002.gif
├── 003.gif
├── 004.gif
├── 1000.png
├── 1001.png
├── 1002.png
├── 1003.png
├── 1004.png
├── 1005.png
├── 1006.png
├── 脑图.graffle
└── colorlist.gif
├── WonderfulDemo
├── Wonderful
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ ├── 001.imageset
│ │ │ ├── 001.png
│ │ │ └── Contents.json
│ │ ├── 227.imageset
│ │ │ ├── 227.png
│ │ │ └── Contents.json
│ │ ├── bgImg.imageset
│ │ │ ├── bgImg.png
│ │ │ └── Contents.json
│ │ ├── AppIcon.appiconset
│ │ │ ├── icon.png
│ │ │ └── Contents.json
│ │ └── Brand Assets.launchimage
│ │ │ ├── launch.png
│ │ │ └── Contents.json
│ ├── Page
│ │ ├── SXMainDemoPage.h
│ │ ├── SXMarqueeDemoPage.h
│ │ ├── SXColorLblDemoPage.h
│ │ ├── SXColorGradientDemoPage.h
│ │ ├── SXColorSeparateDemoPage.h
│ │ ├── SXColorWonderfulDemoPage.h
│ │ ├── SXColorListPage.h
│ │ ├── SXMainDemoPage.m
│ │ ├── SXColorLblDemoPage.m
│ │ ├── SXColorSeparateDemoPage.m
│ │ ├── SXColorListPage.m
│ │ ├── SXColorWonderfulDemoPage.m
│ │ ├── SXMarqueeDemoPage.m
│ │ └── SXColorGradientDemoPage.m
│ ├── Other
│ │ ├── AppDelegate.h
│ │ ├── SXColorListCell.h
│ │ ├── SXDataSource.h
│ │ ├── SXCLEntity.m
│ │ ├── SXColorListCell.m
│ │ ├── SXCLEntity.h
│ │ ├── AppDelegate.m
│ │ └── SXDataSource.m
│ ├── main.m
│ ├── Info.plist
│ └── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
└── Wonderful.xcodeproj
│ ├── project.xcworkspace
│ └── contents.xcworkspacedata
│ └── project.pbxproj
├── Wonderful.podspec
├── .gitignore
├── Wonderful
├── UIColor+Separate.h
├── UILabel+Wonderful.h
├── SXColorLabel.h
├── SXColorGradientView.h
├── SXMarquee.h
├── SXHeadLine.h
├── SXColorGradientView.m
├── UIColor+Separate.m
├── UILabel+Wonderful.m
├── SXColorLabel.m
├── SXHeadLine.m
├── SXMarquee.m
├── UIColor+Wonderful.m
└── UIColor+Wonderful.h
├── LICENSE
└── README.md
/screenshots/001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/001.png
--------------------------------------------------------------------------------
/screenshots/002.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/002.gif
--------------------------------------------------------------------------------
/screenshots/003.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/003.gif
--------------------------------------------------------------------------------
/screenshots/004.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/004.gif
--------------------------------------------------------------------------------
/screenshots/1000.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/1000.png
--------------------------------------------------------------------------------
/screenshots/1001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/1001.png
--------------------------------------------------------------------------------
/screenshots/1002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/1002.png
--------------------------------------------------------------------------------
/screenshots/1003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/1003.png
--------------------------------------------------------------------------------
/screenshots/1004.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/1004.png
--------------------------------------------------------------------------------
/screenshots/1005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/1005.png
--------------------------------------------------------------------------------
/screenshots/1006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/1006.png
--------------------------------------------------------------------------------
/screenshots/脑图.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/脑图.graffle
--------------------------------------------------------------------------------
/screenshots/colorlist.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/screenshots/colorlist.gif
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/001.imageset/001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/WonderfulDemo/Wonderful/Assets.xcassets/001.imageset/001.png
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/227.imageset/227.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/WonderfulDemo/Wonderful/Assets.xcassets/227.imageset/227.png
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/bgImg.imageset/bgImg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/WonderfulDemo/Wonderful/Assets.xcassets/bgImg.imageset/bgImg.png
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/AppIcon.appiconset/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/WonderfulDemo/Wonderful/Assets.xcassets/AppIcon.appiconset/icon.png
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/Brand Assets.launchimage/launch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dsxNiubility/Wonderful/HEAD/WonderfulDemo/Wonderful/Assets.xcassets/Brand Assets.launchimage/launch.png
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXMainDemoPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/26.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SXMainDemoPage : UIViewController
12 |
13 | @end
14 |
15 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXMarqueeDemoPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXMarqueeDemoVC.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/20.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SXMarqueeDemoPage : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorLblDemoPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorLblDemoVC.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/19.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SXColorLblDemoPage : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorGradientDemoPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorGradientDemoVC.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/20.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SXColorGradientDemoPage : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorSeparateDemoPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorSeparateDemoVC.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/20.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SXColorSeparateDemoPage : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorWonderfulDemoPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorWonderfulDemoVC.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/20.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SXColorWonderfulDemoPage : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Other/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/26.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorListPage.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorListPage.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/30.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SXColorListPage : UIViewController
12 |
13 | @property(nonatomic,strong)NSArray *titleArray;
14 | @property(nonatomic,strong)NSMutableArray *marray;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/26.
6 | // Copyright © 2015年 Sankuai. 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 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Other/SXColorListCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorListCell.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/30.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SXColorListCell : UITableViewCell
12 | @property (weak, nonatomic) IBOutlet UILabel *NumLabel;
13 | @property (weak, nonatomic) IBOutlet UILabel *NameLabel;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/001.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "001.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/227.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "227.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/bgImg.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "bgImg.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/Wonderful.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'Wonderful'
3 | s.version = '1.2.1'
4 | s.license = 'MIT'
5 | s.summary = 'Include wonderfulcolor api, marquee, colorLabel, Gradient, Separate.'
6 | s.homepage = 'https://github.com/dsxNiubility/Wonderful'
7 | s.authors = { '董尚先' => 'dantesx2012@gmail.com' }
8 | s.source = { :git => 'https://github.com/dsxNiubility/Wonderful.git', :tag => s.version.to_s }
9 | s.requires_arc = true
10 | s.ios.deployment_target = '7.0'
11 | s.source_files = 'Wonderful/*.{h,m}'
12 |
13 | end
14 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Other/SXDataSource.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXDataSource.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/21.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "SXCLEntity.h"
11 |
12 | @interface SXDataSource : NSObject
13 |
14 | @property(nonatomic,strong)NSArray *titleArray;
15 | @property(nonatomic,strong)NSMutableArray *marray;
16 |
17 | - (SXCLEntity *)randomAColorEntity;
18 | - (void)getDataSource;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Other/SXCLEntity.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorListEntity.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/30.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXCLEntity.h"
10 |
11 | @implementation SXCLEntity
12 |
13 | + (instancetype)CWV:(int)value D:(NSString *)desc N:(NSString *)name
14 | {
15 | SXCLEntity *entity = [[self alloc]init];
16 | entity.colorValue = value;
17 | entity.desc = desc;
18 | entity.methodName = name;
19 | return entity;
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Other/SXColorListCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorListCell.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/30.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXColorListCell.h"
10 |
11 | @implementation SXColorListCell
12 |
13 | - (void)awakeFromNib {
14 | // Initialization code
15 | }
16 |
17 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
18 | [super setSelected:selected animated:animated];
19 |
20 | // Configure the view for the selected state
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Other/SXCLEntity.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorListEntity.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/30.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | // ------这里其实是SXColorListEntity demo程序不用较真,就是为了方法较短不用换行看着整齐
12 | @interface SXCLEntity : NSObject
13 |
14 | @property(nonatomic,assign)int colorValue;
15 | @property(nonatomic,copy)NSString *desc;
16 | @property(nonatomic,copy)NSString *methodName;
17 |
18 | + (instancetype)CWV:(int)value D:(NSString *)desc N:(NSString *)name;
19 | @end
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | build/
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | *.xccheckout
14 | *.moved-aside
15 | DerivedData
16 | *.hmap
17 | *.ipa
18 | *.xcuserstate
19 |
20 | # CocoaPods
21 | #
22 | # We recommend against adding the Pods directory to your .gitignore. However
23 | # you should judge for yourself, the pros and cons are mentioned at:
24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
25 | #
26 | #Pods/
27 |
--------------------------------------------------------------------------------
/Wonderful/UIColor+Separate.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+Separate.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/11/1.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, SXColorType) {
12 | SXColorTypeRed = 1,
13 | SXColorTypeGreen = 2,
14 | SXColorTypeBlue = 3,
15 | SXColorTypeAlpha = 4
16 | };
17 |
18 | @interface UIColor (Separate)
19 |
20 | - (CGColorSpaceModel) colorSpaceModel;
21 | - (CGFloat) red;
22 | - (CGFloat) green;
23 | - (CGFloat) blue;
24 | - (CGFloat) alpha;
25 |
26 | - (UIColor *)reverseColor;
27 | - (NSString *)printDetail;
28 |
29 | - (UIColor *)up:(SXColorType)type num:(NSInteger)num;
30 | - (UIColor *)down:(SXColorType)type num:(NSInteger)num;
31 |
32 | @end
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 董铂然
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Wonderful/UILabel+Wonderful.h:
--------------------------------------------------------------------------------
1 | //
2 | // UILabel+Wonderful.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 16/1/7.
6 | // Copyright © 2016年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UILabel (Wonderful)
12 |
13 | /**
14 | * Set text which contains color mark
15 | *
16 | * @param text Text with color mark
17 | */
18 | - (void)setColorText:(NSString *)text;
19 |
20 | /**
21 | * Set text which contains font mark
22 | *
23 | * @param text Text with font mark
24 | */
25 | - (void)setFontText:(NSString *)text;
26 |
27 | /**
28 | * Set text which contains color and font mark
29 | *
30 | * @param text Text with color and font mark
31 | */
32 | - (void)setColorFontText:(NSString *)text;
33 |
34 | /**
35 | * Set a highlight color to show emphasis between the beginmark and endmark
36 | *
37 | * @param color A color different from label.TextColor
38 | */
39 | + (void)setAnotherColor:(UIColor *)color;
40 |
41 | /**
42 | * Set a highlight font to show emphasis between the beginmark and endmark
43 | *
44 | * @param font A font different from label.font
45 | */
46 | + (void)setAnotherFont:(UIFont *)font;
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/Wonderful/SXColorLabel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorLabel.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/19.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface SXColorLabel : UILabel
12 |
13 | /**
14 | * Set a highlight color to show emphasis between the beginmark and endmark
15 | *
16 | * @param color A color different from label.TextColor
17 | */
18 | + (void)setAnotherColor:(UIColor *)color;
19 |
20 | /**
21 | * Set a highlight font to show emphasis between the beginmark and endmark
22 | *
23 | * @param font A font different from label.font
24 | */
25 | + (void)setAnotherFont:(UIFont *)font;
26 |
27 | /**
28 | * Instance method to set color, the priority is higher.
29 | *
30 | */
31 | - (void)setAnotherColor:(UIColor *)color;
32 |
33 | /**
34 | * Instance method to set font, the priority is higher.
35 | *
36 | */
37 | - (void)setAnotherFont:(UIFont *)font;
38 |
39 | /**
40 | * The color for this label instance
41 | */
42 | @property(nonatomic,strong)UIColor *anotherColor;
43 | /**
44 | * The font for this label instance
45 | */
46 | @property(nonatomic,strong)UIFont *anotherFont;
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/Wonderful/SXColorGradientView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorGradientView.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/11/1.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, SXGradientDirection) {
12 | SXGradientToTop = 1,
13 | SXGradientToLeft = 2,
14 | SXGradientToBottom = 3,
15 | SXGradientToRight = 4,
16 | };
17 |
18 | @interface SXColorGradientView : UIView
19 |
20 | /**
21 | * use one color to init the gradientView,default is this color to clear.
22 | *
23 | * @param visible can you see other view what below the gradientView
24 | * @param direction the direction we want gradient to clear
25 | *
26 | * @return
27 | */
28 | + (instancetype)createWithColor:(UIColor *)color frame:(CGRect)frame direction:(SXGradientDirection)direction;
29 |
30 | /**
31 | * use two color to init the gradientView, from fromColor gradient to toColor
32 | *
33 | * @param direction the direction we want gradient to toColor
34 | *
35 | * @return
36 | */
37 | + (instancetype)createWithFromColor:(UIColor *)fromColor toColor:(UIColor *)toColor frame:(CGRect)frame direction:(SXGradientDirection)direction;
38 |
39 | /**
40 | * use a colorArray to generate a wonderful gradientView.
41 | *
42 | * @param colorArray array with UIColor
43 | *
44 | * @return
45 | */
46 | + (instancetype)createWithColorArray:(NSArray *)colorArray frame:(CGRect)frame direction:(SXGradientDirection)direction;
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "size" : "60x60",
25 | "idiom" : "iphone",
26 | "filename" : "icon.png",
27 | "scale" : "2x"
28 | },
29 | {
30 | "idiom" : "iphone",
31 | "size" : "60x60",
32 | "scale" : "3x"
33 | },
34 | {
35 | "idiom" : "ipad",
36 | "size" : "29x29",
37 | "scale" : "1x"
38 | },
39 | {
40 | "idiom" : "ipad",
41 | "size" : "29x29",
42 | "scale" : "2x"
43 | },
44 | {
45 | "idiom" : "ipad",
46 | "size" : "40x40",
47 | "scale" : "1x"
48 | },
49 | {
50 | "idiom" : "ipad",
51 | "size" : "40x40",
52 | "scale" : "2x"
53 | },
54 | {
55 | "idiom" : "ipad",
56 | "size" : "76x76",
57 | "scale" : "1x"
58 | },
59 | {
60 | "idiom" : "ipad",
61 | "size" : "76x76",
62 | "scale" : "2x"
63 | },
64 | {
65 | "idiom" : "ipad",
66 | "size" : "83.5x83.5",
67 | "scale" : "2x"
68 | }
69 | ],
70 | "info" : {
71 | "version" : 1,
72 | "author" : "xcode"
73 | }
74 | }
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/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 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Assets.xcassets/Brand Assets.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "8.0",
8 | "subtype" : "736h",
9 | "scale" : "3x"
10 | },
11 | {
12 | "extent" : "full-screen",
13 | "idiom" : "iphone",
14 | "subtype" : "667h",
15 | "filename" : "launch.png",
16 | "minimum-system-version" : "8.0",
17 | "orientation" : "portrait",
18 | "scale" : "2x"
19 | },
20 | {
21 | "orientation" : "portrait",
22 | "idiom" : "ipad",
23 | "extent" : "full-screen",
24 | "minimum-system-version" : "7.0",
25 | "scale" : "1x"
26 | },
27 | {
28 | "orientation" : "landscape",
29 | "idiom" : "ipad",
30 | "extent" : "full-screen",
31 | "minimum-system-version" : "7.0",
32 | "scale" : "1x"
33 | },
34 | {
35 | "orientation" : "portrait",
36 | "idiom" : "ipad",
37 | "extent" : "full-screen",
38 | "minimum-system-version" : "7.0",
39 | "scale" : "2x"
40 | },
41 | {
42 | "orientation" : "landscape",
43 | "idiom" : "ipad",
44 | "extent" : "full-screen",
45 | "minimum-system-version" : "7.0",
46 | "scale" : "2x"
47 | },
48 | {
49 | "orientation" : "portrait",
50 | "idiom" : "iphone",
51 | "minimum-system-version" : "7.0",
52 | "scale" : "2x"
53 | },
54 | {
55 | "orientation" : "portrait",
56 | "idiom" : "iphone",
57 | "minimum-system-version" : "7.0",
58 | "subtype" : "retina4",
59 | "scale" : "2x"
60 | }
61 | ],
62 | "info" : {
63 | "version" : 1,
64 | "author" : "xcode"
65 | }
66 | }
--------------------------------------------------------------------------------
/Wonderful/SXMarquee.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXMarquee.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/11/5.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, SXMarqueeSpeedLevel) {
12 | SXMarqueeSpeedLevelFast = 2,
13 | SXMarqueeSpeedLevelMediumFast = 4,
14 | SXMarqueeSpeedLevelMediumSlow = 6,
15 | SXMarqueeSpeedLevelSlow = 8,
16 | };
17 |
18 | @interface SXMarquee : UIView
19 |
20 | /**
21 | * style is default, backgroundColor is white,textColor is black;
22 | *
23 | * @param speed you can set 2,4,6,8. smaller is faster
24 | *
25 | * @return
26 | */
27 | - (instancetype)initWithFrame:(CGRect)frame speed:(SXMarqueeSpeedLevel)speed Msg:(NSString *)msg ;
28 |
29 | /**
30 | * style is diy, backgroundColor and textColor can config
31 | *
32 | * @param speed you can set 2,4,6,8. smaller is faster
33 | * @param bgColor backgroundColor
34 | * @param txtColor textColor
35 | *
36 | * @return
37 | */
38 | - (instancetype)initWithFrame:(CGRect)frame speed:(SXMarqueeSpeedLevel)speed Msg:(NSString *)msg bgColor:(UIColor *)bgColor txtColor:(UIColor *)txtColor;
39 |
40 | /**
41 | * you can change the tapAction show or jump, without this method default is tap to stop
42 | *
43 | * @param action tapAction block code
44 | */
45 | - (void)changeTapMarqueeAction:(void(^)())action;
46 |
47 | /**
48 | * you can change marqueeLabel 's font before start
49 | *
50 | */
51 | - (void)changeMarqueeLabelFont:(UIFont *)font;
52 |
53 | /**
54 | * when you set everything what you want,you can use this method to begin animate
55 | */
56 | - (void)start;
57 |
58 | /**
59 | * pause
60 | */
61 | - (void)stop;
62 |
63 | /**
64 | * will start with the point we stoped.
65 | */
66 | - (void)restart;
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/Wonderful/SXHeadLine.h:
--------------------------------------------------------------------------------
1 | //
2 | // SXHeadLine.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 16/2/18.
6 | // Copyright © 2016年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef void(^actionBlock)(NSInteger index);
12 |
13 | @interface SXHeadLine : UIView
14 |
15 | /**
16 | * input messages
17 | */
18 | @property (nonatomic,strong) NSArray *messageArray;
19 | /**
20 | * text color for message label
21 | */
22 | @property (nonatomic,strong) UIColor *textColor;
23 | /**
24 | * text font for message label
25 | */
26 | @property (nonatomic,strong) UIFont *textFont;
27 | /**
28 | * backgroundColor for headlineView
29 | */
30 | @property (nonatomic,strong) UIColor *bgColor;
31 | /**
32 | * set self.layer.cornerRadius
33 | */
34 | @property (nonatomic,assign) CGFloat cornerRadius;
35 | /**
36 | * if set yes ,it would add two gradientViews on top and bottom. style is from backgoundColor to transparent. like marquee 's left and right.
37 | */
38 | @property (nonatomic,assign) BOOL hasGradient;
39 | /**
40 | * the Animation duration for label scroll to nextLabel.
41 | */
42 | @property (nonatomic,assign) NSTimeInterval scrollDuration;
43 | /**
44 | * the duration for the label hold at a standstill
45 | */
46 | @property (nonatomic,assign) NSTimeInterval stayDuration;
47 | /**
48 | * you can set three property together.
49 | */
50 | - (void)setBgColor:(UIColor *)bgColor textColor:(UIColor *)textColor textFont:(UIFont *)textFont;
51 | /**
52 | * you can set two timeInterval setting toghter.
53 | */
54 | - (void)setScrollDuration:(NSTimeInterval)scrollDuration stayDuration:(NSTimeInterval)stayDuration;
55 |
56 | /**
57 | * you can change the tapAction show or jump, without this method default is tap to stop
58 | *
59 | * @param action tapAction block code
60 | */
61 | //- (void)changeTapMarqueeAction:(void(^)(NSInteger index))action;
62 | - (void)changeTapMarqueeAction:(actionBlock)action;
63 |
64 | /**
65 | * add the timer and start headline animation.
66 | */
67 | - (void)start;
68 | /**
69 | * stop the timer.
70 | */
71 | - (void)stop;
72 |
73 |
74 |
75 | @end
76 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Other/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/26.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 | - (void)applicationWillResignActive:(UIApplication *)application {
24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26 | }
27 |
28 | - (void)applicationDidEnterBackground:(UIApplication *)application {
29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
31 | }
32 |
33 | - (void)applicationWillEnterForeground:(UIApplication *)application {
34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
35 | }
36 |
37 | - (void)applicationDidBecomeActive:(UIApplication *)application {
38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application {
42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXMainDemoPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/26.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXMainDemoPage.h"
10 | #import "UIColor+Wonderful.h"
11 | #import "SXColorGradientView.h"
12 | #import "UIColor+Separate.h"
13 | #import "SXMarquee.h"
14 | #import "SXCLEntity.h"
15 |
16 | @interface SXMainDemoPage ()
17 |
18 | @end
19 |
20 | @implementation SXMainDemoPage
21 |
22 |
23 | - (void)viewDidLoad {
24 | [super viewDidLoad];
25 |
26 |
27 |
28 |
29 | // UIColor *testC = [UIColor salmonColor];
30 | // float r= [testC red];
31 | // float g= [testC green];
32 | // float b= [testC blue];
33 | // float alpha= [testC alpha];
34 | // NSLog(@"****** %f,%f,%f,%f",r,g,b,alpha);
35 | //
36 | // [[UIColor salmonColor]printDetail];
37 |
38 | // self.view.backgroundColor = [[UIColor redColor]up:3 num:255];
39 | // Do any additional setup after loading the view, typically from a nib.
40 |
41 | // SXColorGradientView *view2 = [SXColorGradientView createWithColor:[UIColor goldColor] frame:CGRectMake(0, 84, 375, 64) visible:NO direction:3];
42 |
43 |
44 | // SXColorGradientView *view2 = [SXColorGradientView createWithFromColor:[UIColor lawnGreen] toColor:[UIColor peachRed] frame:CGRectMake(0, 84, 375, 200) direction:2];
45 |
46 | // self.view.backgroundColor = [UIColor khakiColor];
47 | // self.view.backgroundColor = [UIColor chocolateColor];
48 | //
49 | // self.view.backgroundColor = Wonderful_YelloeColor4;
50 | // self.view.backgroundColor = Wonderful_BrownColor4;
51 | //
52 | // UIColor *navColor = [[UIColor redColor]up:SXColorTypeBlue num:30]; // 在红色上把蓝色色值提高30
53 | // UIColor *barColor = [[UIColor blueColor]up:1 num:140]; // 可以直接用枚举对应的tag
54 | // UIColor *bgColor = [[UIColor blackColor]down:SXColorTypeAlpha num:10]; // 取一个比黑色稍微淡的颜色
55 | // UIColor *lineColor = [bgColor up:3 num:20]; // 不管背景是什么颜色 线都比背景浅20.
56 |
57 | // [self.view addSubview:view2];
58 |
59 |
60 | // self.view.backgroundColor = [UIColor salmonColor];
61 | //
62 | // [UIView animateWithDuration:5 animations:^{
63 | // self.view.backgroundColor = [UIColor lightPink];
64 | // }];
65 | }
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/Wonderful/SXColorGradientView.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorGradientView.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/11/1.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXColorGradientView.h"
10 | #import "UIColor+Separate.h"
11 |
12 | @implementation SXColorGradientView
13 |
14 | + (instancetype)createWithColor:(UIColor *)color frame:(CGRect)frame direction:(SXGradientDirection)direction{
15 | return [[self alloc]initWithColorArray:@[color,[color down:SXColorTypeAlpha num:255]] frame:frame direction:direction];
16 | }
17 |
18 | + (instancetype)createWithFromColor:(UIColor *)fromColor toColor:(UIColor *)toColor frame:(CGRect)frame direction:(SXGradientDirection)direction{
19 | return [[self alloc]initWithColorArray:@[fromColor,toColor] frame:frame direction:direction];
20 | }
21 |
22 | + (instancetype)createWithColorArray:(NSArray *)colorArray frame:(CGRect)frame direction:(SXGradientDirection)direction{
23 | return [[self alloc]initWithColorArray:colorArray frame:frame direction:direction];
24 | }
25 |
26 | - (instancetype)initWithColorArray:(NSArray *)colorArray frame:(CGRect)frame direction:(SXGradientDirection)direction{
27 | if (self = [super initWithFrame:frame]) {
28 | SXColorGradientView *gradientView = [[SXColorGradientView alloc]initWithFrame:frame];
29 | self = gradientView;
30 | CAGradientLayer *la = [[CAGradientLayer alloc]init];
31 | la.frame = gradientView.bounds;
32 | [gradientView.layer addSublayer:la];
33 | NSMutableArray *marray = [NSMutableArray array];
34 | for (UIColor *color in colorArray) {
35 | [marray addObject:(__bridge id)color.CGColor];
36 | }
37 | la.colors = marray;
38 |
39 | switch (direction) {
40 | case 1:
41 | la.startPoint = CGPointMake(0.5, 1);
42 | la.endPoint = CGPointMake(0.5, 0);
43 | break;
44 | case 2:
45 | la.startPoint = CGPointMake(1, 0.5);
46 | la.endPoint = CGPointMake(0, 0.5);
47 | break;
48 | case 3:
49 | la.startPoint = CGPointMake(0.5, 0);
50 | la.endPoint = CGPointMake(0.5, 1);
51 | break;
52 | case 4:
53 | la.startPoint = CGPointMake(0, 0.5);
54 | la.endPoint = CGPointMake(1, 0.5);
55 | break;
56 |
57 | default:
58 | break;
59 | }
60 | }
61 | return self;
62 | }
63 | @end
64 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorLblDemoPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorLblDemoVC.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/19.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXColorLblDemoPage.h"
10 | #import "SXColorLabel.h"
11 | #import "UIColor+Wonderful.h"
12 |
13 | #import "UILabel+Wonderful.h"
14 |
15 | @interface SXColorLblDemoPage ()
16 | @property (weak, nonatomic) IBOutlet UILabel *msgLabel;
17 | @property (weak, nonatomic) IBOutlet UIView *bodyView;
18 |
19 | @end
20 |
21 | @implementation SXColorLblDemoPage
22 |
23 |
24 | - (void)viewDidLoad {
25 | [super viewDidLoad];
26 |
27 | self.title = @"SXColorLabel";
28 |
29 | // UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(30, 300, 300, 30)];
30 | // label.font = [UIFont systemFontOfSize:14];
31 | // [label setColorText:@"我<也>不知道[<是>什么][啊啊]<啊>"];
32 | // [label setFontText:@"我<也>不知道[<是>]什么[>啊]啊[啊]"];
33 | // [label setColorFontText:@"我<也>不知道[<是>什么]啊啊[啊]"];
34 | // [self.view addSubview:label];
35 |
36 | self.msgLabel.text = @"a.把text里重要的内容用特殊符号包起来,就会特殊显示\nb.如果用<>包起来,就会显示高亮颜色。\nc.如果用[]包起来,就会显示高亮的字体。\nd.这个高亮颜色和高亮字体可以自行设置。\ne.两者也可以混合使用。 高亮的字体里有高亮颜色。\nf.如果输入格式错误,将会不正常显示";
37 | [self addBody];
38 | // Do any additional setup after loading the view.
39 | }
40 |
41 | - (void)addBody
42 | {
43 | [SXColorLabel setAnotherColor:[UIColor salmonColor]];
44 | [SXColorLabel setAnotherFont:[UIFont boldSystemFontOfSize:18]];
45 | UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(5, 10, 350, 30)];
46 | lbl.font = [UIFont systemFontOfSize:14];
47 | lbl.text = @"例1:今天要记得通知和去开会。";
48 | [self.bodyView addSubview:lbl];
49 |
50 | SXColorLabel *sxlbl = [[SXColorLabel alloc]initWithFrame:CGRectMake(40, 40, 350, 30)];
51 | [sxlbl setAnotherColor:[UIColor springGreen]];
52 | sxlbl.font = [UIFont systemFontOfSize:14];
53 | sxlbl.text = @"今天要记得通知和去开会。";
54 | [self.bodyView addSubview:sxlbl];
55 |
56 | UILabel *lbl2 = [[UILabel alloc]initWithFrame:CGRectMake(5, 90, 350, 30)];
57 | lbl2.font = [UIFont systemFontOfSize:14];
58 | lbl2.text = @"例2:礼物很有[粪]量,你会大吃一[斤]!";
59 | [self.bodyView addSubview:lbl2];
60 |
61 | SXColorLabel *sxlbl2 = [[SXColorLabel alloc]initWithFrame:CGRectMake(40, 120, 350, 30)];
62 | [sxlbl2 setAnotherFont:[UIFont systemFontOfSize:25]];
63 | sxlbl2.font = [UIFont systemFontOfSize:14];
64 | sxlbl2.text = @"礼物很有[粪]量,你会大吃一[斤]!";
65 | [self.bodyView addSubview:sxlbl2];
66 |
67 | UILabel *lbl3 = [[UILabel alloc]initWithFrame:CGRectMake(5, 170, 350, 30)];
68 | lbl3.font = [UIFont systemFontOfSize:14];
69 | lbl3.text = @"例3:一定要:[通知和去开会]";
70 | [self.bodyView addSubview:lbl3];
71 |
72 | SXColorLabel *sxlbl3 = [[SXColorLabel alloc]initWithFrame:CGRectMake(40, 200, 350, 30)];
73 | sxlbl3.font = [UIFont systemFontOfSize:14];
74 | sxlbl3.text = @"一定要:[通知和去开会]";
75 | [self.bodyView addSubview:sxlbl3];
76 |
77 |
78 |
79 | }
80 |
81 | - (void)didReceiveMemoryWarning {
82 | [super didReceiveMemoryWarning];
83 | // Dispose of any resources that can be recreated.
84 | }
85 |
86 | /*
87 | #pragma mark - Navigation
88 |
89 | // In a storyboard-based application, you will often want to do a little preparation before navigation
90 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
91 | // Get the new view controller using [segue destinationViewController].
92 | // Pass the selected object to the new view controller.
93 | }
94 | */
95 |
96 | @end
97 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorSeparateDemoPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorSeparateDemoVC.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/20.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXColorSeparateDemoPage.h"
10 | #import "UIColor+Wonderful.h"
11 | #import "UIColor+Separate.h"
12 | #import "SXDataSource.h"
13 |
14 | @interface SXColorSeparateDemoPage ()
15 | @property (weak, nonatomic) IBOutlet UIView *topView;
16 | @property (weak, nonatomic) IBOutlet UILabel *printLabel;
17 |
18 | @end
19 |
20 | @implementation SXColorSeparateDemoPage
21 |
22 | - (void)viewDidLoad {
23 | [super viewDidLoad];
24 | self.title = @"UIColor+Separate";
25 |
26 | self.printLabel.text = @"点击颜色色块,会将改颜色的各种详情信息打印\n\n点击下面的反色的按钮会将颜色显示为该颜色的反色";
27 |
28 | [self addColorView];
29 |
30 | }
31 |
32 | - (void)printDetailWithBtn:(UIButton *)sender
33 | {
34 |
35 | [UIView animateWithDuration:0.2 animations:^{
36 | sender.transform = CGAffineTransformMakeScale(0.6, 0.6);
37 | } completion:^(BOOL finished) {
38 | [UIView animateWithDuration:0.2 animations:^{
39 | sender.transform = CGAffineTransformIdentity;
40 | }];
41 | }];
42 | UIColor *color = sender.backgroundColor;
43 | self.printLabel.text = [color printDetail];
44 | }
45 |
46 | - (void)reverseWithBtn:(UIButton *)sender
47 | {
48 | UIButton *btn = sender.superview.subviews[0];
49 | UIColor *bgColor = btn.backgroundColor;
50 |
51 |
52 | [UIView animateWithDuration:0.2 animations:^{
53 | btn.transform = CGAffineTransformMakeScale(0.6, 0.6);
54 | } completion:^(BOOL finished) {
55 | btn.backgroundColor = [bgColor reverseColor];
56 | [UIView animateWithDuration:0.2 animations:^{
57 | btn.transform = CGAffineTransformIdentity;
58 | }];
59 | }];
60 | }
61 |
62 | - (void)didReceiveMemoryWarning {
63 | [super didReceiveMemoryWarning];
64 | // Dispose of any resources that can be recreated.
65 | }
66 |
67 | - (void)addColorView
68 | {
69 |
70 | CGFloat x;
71 | CGFloat y;
72 | CGFloat w = 75;
73 | CGFloat h = 100;
74 | int col;
75 | int row;
76 | for (int i=0; i<10; i++) {
77 | UIView *view = [[UIView alloc]init];
78 | row = i/5;
79 | col = i%5;
80 | x = col*75;
81 | y = row*100;
82 | view.frame = CGRectMake(x, y, w, h);
83 |
84 | UIButton *btn = [[UIButton alloc]init];
85 | btn.frame = CGRectMake(10, 10, 60, 60);
86 |
87 | // ------这里这么写是为了吧rgb 0~30 和 235~256 隔离了,避免出现很极端很难看的颜色。
88 | NSInteger r = arc4random()%205 + 30;
89 | NSInteger g = arc4random()%205 + 30;
90 | NSInteger b = arc4random()%205 + 30;
91 | btn.backgroundColor = SXRGBAColor(r, g, b, 1);
92 | [btn addTarget:self action:@selector(printDetailWithBtn:) forControlEvents:UIControlEventTouchUpInside];
93 |
94 | btn.layer.cornerRadius = 30;
95 | btn.layer.masksToBounds = YES;
96 | [view addSubview:btn];
97 |
98 | UIButton *reverse = [[UIButton alloc]init];
99 | reverse.frame = CGRectMake(0, 75, 75, 20);
100 | [reverse setTitle:@"反色" forState:UIControlStateNormal];
101 | [reverse setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
102 | reverse.titleLabel.font = [UIFont boldSystemFontOfSize:14];
103 | [reverse addTarget:self action:@selector(reverseWithBtn:) forControlEvents:UIControlEventTouchUpInside];
104 | [view addSubview:reverse];
105 |
106 | [self.topView addSubview:view];
107 | }
108 |
109 | }
110 |
111 | @end
112 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorListPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorListPage.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/30.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXColorListPage.h"
10 | #import "SXColorListCell.h"
11 | #import "UIColor+Wonderful.h"
12 | #import "UIColor+Separate.h"
13 | #import
14 | #import "SXCLEntity.h"
15 |
16 | @interface SXColorListPage ()
17 | @property (weak, nonatomic) IBOutlet UITableView *tableView;
18 |
19 |
20 |
21 | @end
22 |
23 | @implementation SXColorListPage
24 |
25 | - (void)viewDidLoad {
26 | [super viewDidLoad];
27 | // Do any additional setup after loading the view.
28 |
29 |
30 | self.tableView.dataSource = self;
31 | self.tableView.delegate = self;
32 | self.tableView.rowHeight = 40;
33 |
34 | // UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(20, 120, 50, 50)];
35 | // btn.backgroundColor = [UIColor blackColor];
36 | // btn.layer.cornerRadius = 25;
37 | // btn.layer.masksToBounds = YES;
38 | // [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
39 | // [btn setTitle:@"dismiss" forState:UIControlStateNormal];
40 | // [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
41 | // btn.titleLabel.font = [UIFont boldSystemFontOfSize:11];
42 | // [self.view addSubview:btn];
43 |
44 | }
45 |
46 | //- (void)btnClick
47 | //{
48 | // [self dismissViewControllerAnimated:YES completion:nil];
49 | //}
50 |
51 |
52 | //- (void)runTests
53 | //{
54 | // unsigned int count;
55 | // Method *methods = class_copyMethodList([UIColor class], &count);
56 | // for (int i = 0; i < count; i++)
57 | // {
58 | // Method method = methods[i];
59 | // SEL selector = method_getName(method);
60 | // NSString *name = NSStringFromSelector(selector);
61 | // NSLog(@"方法名字 ==== %@",name);
62 | //
63 | // }
64 | //}
65 | - (IBAction)change:(UIBarButtonItem *)sender {
66 | BOOL result = ![self.tableView isEditing];
67 | [self.tableView setEditing:result animated:YES];
68 | }
69 |
70 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
71 | {
72 | return 10;
73 | }
74 |
75 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
76 | {
77 | return [self.marray[section] count];
78 | }
79 |
80 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
81 | {
82 | SXCLEntity *cle = self.marray[indexPath.section][indexPath.row];
83 | SXColorListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"colorCell"];
84 | cell.NameLabel.text = cle.desc;
85 | cell.NumLabel.text = cle.methodName;
86 | cell.backgroundColor = SXRGB16Color(cle.colorValue);
87 |
88 | return cell;
89 |
90 | }
91 |
92 | - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath
93 | {
94 |
95 | // SXCLE *cle = self.marray[sourceIndexPath.section][sourceIndexPath.row];
96 | // [self.marray removeObjectAtIndex:sourceIndexPath.row];
97 | // [self.marray insertObject:cle atIndex:destinationIndexPath.row];
98 |
99 | NSMutableArray *temArray = [NSMutableArray array];
100 | [temArray addObjectsFromArray:self.marray[sourceIndexPath.section]];
101 |
102 | SXCLEntity *cle = temArray[sourceIndexPath.row];
103 | [temArray removeObjectAtIndex:sourceIndexPath.row];
104 | [temArray insertObject:cle atIndex:destinationIndexPath.row];
105 |
106 | self.marray[sourceIndexPath.section] = temArray;
107 |
108 | }
109 |
110 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
111 | {
112 | return self.titleArray[section];
113 | }
114 |
115 |
116 |
117 | @end
118 |
--------------------------------------------------------------------------------
/Wonderful/UIColor+Separate.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+Separate.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/11/1.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "UIColor+Separate.h"
10 | #import "UIColor+Wonderful.h"
11 |
12 | @implementation UIColor (Separate)
13 |
14 | - (CGColorSpaceModel) colorSpaceModel
15 | {
16 | return CGColorSpaceGetModel(CGColorGetColorSpace(self.CGColor));
17 | }
18 |
19 | - (NSString *) colorSpaceString
20 | {
21 | switch ([self colorSpaceModel])
22 | {
23 | case kCGColorSpaceModelUnknown:
24 | return @"kCGColorSpaceModelUnknown";
25 | case kCGColorSpaceModelMonochrome:
26 | return @"kCGColorSpaceModelMonochrome";
27 | case kCGColorSpaceModelRGB:
28 | return @"kCGColorSpaceModelRGB";
29 | case kCGColorSpaceModelCMYK:
30 | return @"kCGColorSpaceModelCMYK";
31 | case kCGColorSpaceModelLab:
32 | return @"kCGColorSpaceModelLab";
33 | case kCGColorSpaceModelDeviceN:
34 | return @"kCGColorSpaceModelDeviceN";
35 | case kCGColorSpaceModelIndexed:
36 | return @"kCGColorSpaceModelIndexed";
37 | case kCGColorSpaceModelPattern:
38 | return @"kCGColorSpaceModelPattern";
39 | default:
40 | return @"Not a valid color space";
41 | }
42 | }
43 |
44 | - (CGFloat) red
45 | {
46 | const CGFloat *c = CGColorGetComponents(self.CGColor);
47 | return c[0];
48 | }
49 |
50 | - (CGFloat) green
51 | {
52 | const CGFloat *c = CGColorGetComponents(self.CGColor);
53 | if ([self colorSpaceModel] == kCGColorSpaceModelMonochrome) return c[0];
54 | return c[1];
55 | }
56 |
57 | - (CGFloat) blue
58 | {
59 | const CGFloat *c = CGColorGetComponents(self.CGColor);
60 | if ([self colorSpaceModel] == kCGColorSpaceModelMonochrome) return c[0];
61 | return c[2];
62 | }
63 |
64 | - (CGFloat) alpha
65 | {
66 | const CGFloat *c = CGColorGetComponents(self.CGColor);
67 | return c[CGColorGetNumberOfComponents(self.CGColor)-1];
68 | }
69 |
70 | - (UIColor *)reverseColor
71 | {
72 | float r= 1 - [self red];
73 | float g= 1 - [self green];
74 | float b= 1 - [self blue];
75 | float alpha= [self alpha];
76 | UIColor *rcolor = [UIColor colorWithRed:r green:g blue:b alpha:alpha];
77 | return rcolor;
78 | }
79 |
80 | - (NSString *)printDetail
81 | {
82 | float r= [self red];
83 | float g= [self green];
84 | float b= [self blue];
85 | float R= [self red] * 255;
86 | float G= [self green] *255;
87 | float B= [self blue] *255;
88 | float alpha= [self alpha];
89 |
90 | NSString *str = [NSString stringWithFormat:@"\nThis Color's Red:%.0f, Green:%.0f, Blue:%.0f, Alpha:%.0f\nDecimal red:%.4f green:%.4f blue:%.4f \nHexadecimal 0x%x%x%x",R,G,B,alpha,r,g,b,(int)R,(int)G,(int)B];
91 | NSLog(@"%@",str);
92 | return str;
93 | }
94 |
95 | - (UIColor *)up:(SXColorType)type num:(NSInteger)num
96 | {
97 | float r = [self red] * 255.0;
98 | float g = [self green] * 255.0;
99 | float b = [self blue] * 255.0;
100 | float a = [self alpha];
101 |
102 | switch (type) {
103 | case 1:
104 | return SXRGBAColor(r+num, g, b, a);
105 | break;
106 | case 2:
107 | return SXRGBAColor(r, g+num, b, a);
108 | break;
109 | case 3:
110 | return SXRGBAColor(r, g, b+num, a);
111 | break;
112 | case 4:
113 | return SXRGBAColor(r, g, b, a+num/255.0);
114 | break;
115 | default:
116 | return self;
117 | break;
118 | }
119 | }
120 | - (UIColor *)down:(SXColorType)type num:(NSInteger)num
121 | {
122 | float r = [self red] * 255.0;
123 | float g = [self green] * 255.0;
124 | float b = [self blue] * 255.0;
125 | float a = [self alpha];
126 |
127 | switch (type) {
128 | case 1:
129 | return SXRGBAColor(r-num, g, b, a);
130 | break;
131 | case 2:
132 | return SXRGBAColor(r, g-num, b, a);
133 | break;
134 | case 3:
135 | return SXRGBAColor(r, g, b-num, a);
136 | break;
137 | case 4:
138 | return SXRGBAColor(r, g, b, a-num/255.0);
139 | break;
140 | default:
141 | return self;
142 | break;
143 | }
144 | }
145 |
146 |
147 | @end
148 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorWonderfulDemoPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorWonderfulDemoVC.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/20.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXColorWonderfulDemoPage.h"
10 | #import "SXDataSource.h"
11 | #import "UIColor+Wonderful.h"
12 | #import "SXColorListPage.h"
13 |
14 | @interface SXColorWonderfulDemoPage ()
15 | @property (weak, nonatomic) IBOutlet UILabel *showLbl1;
16 | @property (weak, nonatomic) IBOutlet UILabel *showLbl2;
17 | @property (weak, nonatomic) IBOutlet UILabel *showLbl3;
18 | @property (weak, nonatomic) IBOutlet UILabel *showLbl4;
19 | @property (weak, nonatomic) IBOutlet UILabel *showLbl5;
20 | @property (weak, nonatomic) IBOutlet UILabel *msgLabel1;
21 | @property (weak, nonatomic) IBOutlet UIView *bottomView;
22 |
23 | @property(nonatomic,strong)SXDataSource *dataSource;
24 | @end
25 |
26 | @implementation SXColorWonderfulDemoPage
27 |
28 | - (void)viewDidLoad {
29 | [super viewDidLoad];
30 | self.title = @"UIColor+Wonderful";
31 |
32 | self.showLbl1.layer.cornerRadius = 4;
33 | self.showLbl1.layer.masksToBounds = YES;
34 |
35 | self.showLbl2.layer.cornerRadius = 4;
36 | self.showLbl2.layer.masksToBounds = YES;
37 |
38 | self.showLbl3.layer.cornerRadius = 4;
39 | self.showLbl3.layer.masksToBounds = YES;
40 |
41 | self.showLbl4.layer.cornerRadius = 4;
42 | self.showLbl4.layer.masksToBounds = YES;
43 |
44 | self.showLbl5.layer.cornerRadius = 4;
45 | self.showLbl5.layer.masksToBounds = YES;
46 | self.msgLabel1.text = @"a.提供了近百种扩充颜色可以以用户习惯的方式敲出\nb.上面的颜色也可以用阶梯的宏敲出";
47 |
48 | self.dataSource = [SXDataSource new];
49 |
50 | [self randomColor];
51 | [self addBottom];
52 | }
53 |
54 | - (IBAction)randomColor {
55 | SXCLEntity *item1 = [self.dataSource randomAColorEntity];
56 | self.showLbl1.backgroundColor = SXRGB16Color(item1.colorValue);
57 | self.showLbl1.text = [NSString stringWithFormat:@"[UIColor %@]\n%@",item1.methodName,item1.desc];
58 |
59 | SXCLEntity *item2 = [self.dataSource randomAColorEntity];
60 | self.showLbl2.backgroundColor = SXRGB16Color(item2.colorValue);
61 | self.showLbl2.text = [NSString stringWithFormat:@"[UIColor %@]\n%@",item2.methodName,item2.desc];
62 |
63 | SXCLEntity *item3 = [self.dataSource randomAColorEntity];
64 | self.showLbl3.backgroundColor = SXRGB16Color(item3.colorValue);
65 | self.showLbl3.text = [NSString stringWithFormat:@"[UIColor %@]\n%@",item3.methodName,item3.desc];
66 |
67 | SXCLEntity *item4 = [self.dataSource randomAColorEntity];
68 | self.showLbl4.backgroundColor = SXRGB16Color(item4.colorValue);
69 | self.showLbl4.text = [NSString stringWithFormat:@"[UIColor %@]\n%@",item4.methodName,item4.desc];
70 |
71 | SXCLEntity *item5 = [self.dataSource randomAColorEntity];
72 | self.showLbl5.backgroundColor = SXRGB16Color(item5.colorValue);
73 | self.showLbl5.text = [NSString stringWithFormat:@"[UIColor %@]\n%@",item5.methodName,item5.desc];
74 |
75 |
76 | }
77 |
78 | - (void)addBottom
79 | {
80 | for (int i = 0; i < 5; i++) {
81 | UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(0,i*30, 170, 25)];
82 | lbl.text = [NSString stringWithFormat:@"Wonderful_GreenColor%d",2*i+1];
83 | lbl.textColor = SXRGBAColor(100, 56, 32, 1);
84 | lbl.font = [UIFont boldSystemFontOfSize:14];
85 | [self.bottomView addSubview:lbl];
86 |
87 | UIView *view = [[UIView alloc]initWithFrame:CGRectMake(180, i*30, 140, 25)];
88 | view.layer.cornerRadius = 2;
89 | view.layer.masksToBounds = YES;
90 | switch (2*i+1) {
91 | case 1:
92 | view.backgroundColor = Wonderful_GreenColor1;
93 | break;
94 | case 3:
95 | view.backgroundColor = Wonderful_GreenColor3;
96 | break;
97 | case 5:
98 | view.backgroundColor = Wonderful_GreenColor5;
99 | break;
100 | case 7:
101 | view.backgroundColor = Wonderful_GreenColor7;
102 | break;
103 | case 9:
104 | view.backgroundColor = Wonderful_GreenColor9;
105 | break;
106 |
107 | default:
108 | break;
109 | }
110 | [self.bottomView addSubview:view];
111 | }
112 | }
113 |
114 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
115 | {
116 | if ([segue.destinationViewController isKindOfClass:[SXColorListPage class]]) {
117 | SXColorListPage *page = (SXColorListPage *)segue.destinationViewController;
118 | page.marray = self.dataSource.marray;
119 | page.titleArray = self.dataSource.titleArray;
120 | }
121 | }
122 |
123 | @end
124 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Wonderful
2 |
3 | [](https://developer.apple.com/iphone/index.action)
4 | [](https://en.wikipedia.org/wiki/Objective-C)
6 | [](http://mit-license.org)
7 | 
8 |
9 | 一个关于色彩的库
10 |
11 | 
12 |
13 |
14 |
15 |
16 |
17 |
18 | #### ChangeLog 1.2.1
19 |
20 | 1.2.1版本修复了:
21 |
22 | 有marquee或是headline组件的页面,后台回到前台偶现错乱的问题
23 |
24 | 有marquee或是headline组件的页面,停留在当前页面,锁屏解锁偶现错乱的问题
25 |
26 | 允许marquee在运行中修改文字
27 |
28 |
29 |
30 | #### Demo程序截图
31 |
32 | _建议使用iPhone6运行Demo程序_
33 | 
34 |
35 | #### 一、UIColor+Wonderful
36 | 1.这个分类里扩充了更多的颜色扩展,以后随手写个小Demo再也不需要redColor buleColor了。
37 |
38 | self.view.backgroundColor = [UIColor khakiColor];
39 | self.view.backgroundColor = [UIColor chocolateColor];
40 |
41 | 2.平均每个色系有10种颜色,不仅可以使用名称直接敲出,还能使用颜色阶梯的宏敲出,在你想不起词的时候更加方便。 宏从1~10是颜色渐深,可以根据自己的感觉使用浅一级的宏或深一级的宏。
42 |
43 | self.view.backgroundColor = Wonderful_YelloeColor4;
44 | self.view.backgroundColor = Wonderful_BrownColor4;
45 |
46 |
47 | 
48 |
49 | #### 二、UIColor+Separate
50 | 1.提供颜色分离方案,可以将任何颜色的rgb喝alpha的值取出。
51 |
52 | UIColor *testC = [UIColor salmonColor];
53 | float r= [testC red];
54 | float g= [testC green];
55 | float b= [testC blue];
56 | float alpha= [testC alpha];
57 | NSLog(@"****** %f,%f,%f,%f",r,g,b,alpha);
58 |
59 | 2.可以通过一个颜色算出此颜色的反色,使得背景无论被用户设置成什么色,文字颜色都是背景的反色。
60 |
61 | self.showLbl1.backgroundColor = [UIColor peachRed];
62 | self.showLbl1.textColor = [[UIColor peachRed]reverseColor];
63 |
64 | 3.也可以直接打印这个颜色的各项详细数值。
65 |
66 | [[UIColor salmonColor]printDetail];
67 | // 打印结果
68 | This Color's Red:250, Green:128, Blue:114, Alpha:1
69 | decimal red:0.9804 green:0.5020 blue:0.4471
70 | Hexadecimal 0xfa8072
71 |
72 | 4.提供了颜色微调方案,可以让一个已知颜色的rgb的某值上升或下降若干,可用于不管背景是什么色,边框都比背景深20。 也可以将认可颜色的详细值打印出来。
73 |
74 | UIColor *navColor = [[UIColor redColor]up:SXColorTypeBlue num:30]; // 在红色上把蓝色色值提高30
75 | UIColor *barColor = [[UIColor blueColor]up:1 num:140]; // 可以直接用枚举对应的tag
76 | UIColor *bgColor = [[UIColor blackColor]down:SXColorTypeAlpha num:10]; // 取一个比黑色稍微淡的颜色
77 | UIColor *lineColor = [bgColor up:3 num:20]; // 不管背景是什么颜色 线都比背景浅20.
78 |
79 | 
80 |
81 | #### 三、SXColorGradientView
82 | 1.颜色渐变的view,可以设置任何颜色到透明的过渡。
83 |
84 | SXColorGradientView *grv1 = [SXColorGradientView createWithColor:[UIColor paleGreen] frame:CGRectMake(10, 10, 80, 30) visible:YES direction:SXColorGradientToRight];
85 |
86 | 2.也可以设置两个颜色相互过渡。
87 |
88 | SXColorGradientView *grv3 = [SXColorGradientView createWithFromColor:[UIColor peruColor] toColor:[UIColor ghostWhite] frame:CGRectMake(10, 50, 80, 30) direction:SXColorGradientToRight];
89 |
90 | 3.可以设置向上下左右四个过渡的方向。
91 |
92 | typedef NS_ENUM(NSInteger, SXColorGradientDirection) {
93 | SXColorGradientToTop = 1,
94 | SXColorGradientToLeft = 2,
95 | SXColorGradientToBottom = 3,
96 | SXColorGradientToRight = 4,
97 | };
98 |
99 | 4.支持增加传入一个数组,然后搭建一个多个颜色过渡的view。
100 | 
101 |
102 | #### 四、SXMarquee
103 | 1.实现任何样式的跑马灯。
104 |
105 | SXMarquee *mar3 = [[SXMarquee alloc]initWithFrame:CGRectMake(20, 390, 335, 25) speed:2 Msg:@"If you've submitted an update to fix a critical bug in your app on the App Store and you are requesting an expedited review." bgColor:[UIColor goldColor] txtColor:[UIColor goldenrod]];
106 | [mar3 changeMarqueeLabelFont:[UIFont boldSystemFontOfSize:12]]; // 可以用默认也可以配置更多属性
107 | [mar3 start];
108 |
109 | 2.跑马灯的背景可以设置任何颜色,这个是基于颜色过渡view做的。
110 | 3.跑马灯可以实现点击拖动,或者绑定更多点击事件。
111 | 
112 |
113 | #### 五、SXColorLabel
114 | 1.把text里重要的内容用特殊符号包起来,就会特殊显示
115 | 
116 |
117 |
118 | 2.如果用<>包起来,就会显示高亮颜色。如果用[]包起来,就会显示高亮的字体。
119 |
120 | lbl.text = @"例1:今天要记得通知和去开会。";
121 | lbl2.text = @"例2:礼物很有[粪]量,你会大吃一[斤]!";
122 |
123 | 3.这个高亮颜色和高亮字体可以自行设置。
124 |
125 | [SXColorLabel setAnotherColor:[UIColor salmonColor]];
126 | [SXColorLabel setAnotherFont:[UIFont boldSystemFontOfSize:18]];
127 |
128 | 4.两者也可以混合使用。 高亮的字体里有高亮颜色。
129 |
130 | lbl3.text = @"例3:一定要:[通知和去开会]";
131 |
132 | _旧版demo_
133 | _颜色列表_
134 | 
135 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXMarqueeDemoPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXMarqueeDemoVC.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/20.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXMarqueeDemoPage.h"
10 | #import "UIColor+Wonderful.h"
11 | #import "SXMarquee.h"
12 | #import "SXHeadLine.h"
13 |
14 | @interface SXMarqueeDemoPage ()
15 | @property (weak, nonatomic) IBOutlet UILabel *msgLabel2;
16 | @end
17 |
18 | @implementation SXMarqueeDemoPage
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 | self.title = @"SXMarquee-SXHeadLine";
23 | // Do any additional setup after loading the view.
24 | self.msgLabel2.text = @"a.可创建各种颜色的跑马灯\nb.默认按下停止可以拖动,也可绑定其他点击事件\nc.可以设置速度,颜色,字体等多种属性\nd.后续会有更多扩展";
25 | }
26 | - (void)viewWillAppear:(BOOL)animated
27 | {
28 | [super viewWillAppear:animated];
29 | SXMarquee *mar = [[SXMarquee alloc]initWithFrame:CGRectMake(20, 255, 335, 35) speed:4 Msg:@"重大活动,天猫的双十一,然而并没卵用" bgColor:[UIColor salmonColor] txtColor:[UIColor whiteColor]];
30 | [mar changeMarqueeLabelFont:[UIFont systemFontOfSize:26]];
31 | [mar changeTapMarqueeAction:^{
32 | UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"点击事件" message:@"可以设置弹窗,当然也能设置别的" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
33 | [alert show];
34 | }];
35 | [mar start];
36 |
37 | SXMarquee *mar2 = [[SXMarquee alloc]initWithFrame:CGRectMake(20, 305, 335, 30) speed:4 Msg:@"重大活动,京东的双十一,然而并没卵用"];
38 | [mar2 changeMarqueeLabelFont:[UIFont boldSystemFontOfSize:15]];
39 | [mar2 start];
40 |
41 | SXMarquee *mar3 = [[SXMarquee alloc]initWithFrame:CGRectMake(20, 350, 335, 25) speed:2 Msg:@"If you've submitted an update to fix a critical bug in your app on the App Store and you are requesting an expedited review, be sure to include the steps to reproduce the bug on the current version of your app." bgColor:[UIColor goldColor] txtColor:[UIColor goldenrod]];
42 | [mar3 changeMarqueeLabelFont:[UIFont boldSystemFontOfSize:12]];
43 | [mar3 start];
44 |
45 | SXMarquee *mar4 = [[SXMarquee alloc]initWithFrame:CGRectMake(20, 390, 335, 25) speed:8 Msg:@"If you've submitted an update to fix a critical bug in your app on the App Store and you are requesting an expedited review, be sure to include the steps to reproduce the bug on the current version of your app." bgColor:[UIColor paleGreen] txtColor:[UIColor plumColor]];
46 | [mar4 changeMarqueeLabelFont:[UIFont boldSystemFontOfSize:13]];
47 | [mar4 start];
48 |
49 | UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(20, 450, 80, 30)];
50 | label1.text = @"一条信息";
51 | label1.font = [UIFont systemFontOfSize:12];
52 |
53 | UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(20, 490, 80, 30)];
54 | label2.text = @"两条信息";
55 | label2.font = [UIFont systemFontOfSize:12];
56 |
57 | UILabel *label3 = [[UILabel alloc]initWithFrame:CGRectMake(20, 530, 80, 30)];
58 | label3.text = @"三条以上";
59 | label3.font = [UIFont systemFontOfSize:12];
60 |
61 |
62 | SXHeadLine *headLine1 = [[SXHeadLine alloc]initWithFrame:CGRectMake(100, 450, 250, 30)];
63 | headLine1.messageArray = @[@"天猫的双十一,然而并没卵用"];
64 | [headLine1 setBgColor:[UIColor springGreen] textColor:[UIColor darkGreen] textFont:[UIFont systemFontOfSize:14]];
65 | [headLine1 start];
66 |
67 | SXHeadLine *headLine2 = [[SXHeadLine alloc]initWithFrame:CGRectMake(100, 490, 250, 30)];
68 | headLine2.messageArray = @[@"郑爽胡彦斌约会,瘦成一道闪电",@"范冰冰李晨回家过年,年夜饭朴素"];
69 | [headLine2 setBgColor:[UIColor violetColor] textColor:[UIColor mistyRose] textFont:[UIFont boldSystemFontOfSize:12]];
70 | [headLine2 setScrollDuration:1.0 stayDuration:5.0];
71 | headLine2.hasGradient = YES;
72 | [headLine2 start];
73 |
74 | SXHeadLine *headLine3 = [[SXHeadLine alloc]initWithFrame:CGRectMake(100, 530, 250, 30)];
75 | headLine3.messageArray = @[@"1、库里43分,勇士吊打骑士",@"2、伦纳德死亡缠绕詹姆斯,马刺大胜骑士",@"3、乐福致命失误,骑士惨遭5连败",@"4、五小阵容发威,雄鹿吊打骑士", @"5、天猫的双十一,然而并没卵用"];
76 | [headLine3 setBgColor:[UIColor whiteColor] textColor:[UIColor orangeRed] textFont:[UIFont systemFontOfSize:13]];
77 | [headLine3 setScrollDuration:0.5 stayDuration:3];
78 | headLine3.hasGradient = YES;
79 |
80 | [headLine3 changeTapMarqueeAction:^(NSInteger index) {
81 |
82 | NSLog(@"你点击了第 %ld 个button!内容:%@", index, headLine3.messageArray[index]);
83 |
84 | }];
85 | [headLine3 start];
86 |
87 | [self.view addSubview:mar];
88 | [self.view addSubview:mar2];
89 | [self.view addSubview:mar3];
90 | [self.view addSubview:mar4];
91 |
92 | [self.view addSubview:label1];
93 | [self.view addSubview:label2];
94 | [self.view addSubview:label3];
95 |
96 | [self.view addSubview:headLine1];
97 | [self.view addSubview:headLine2];
98 | [self.view addSubview:headLine3];
99 | }
100 | - (void)didReceiveMemoryWarning {
101 | [super didReceiveMemoryWarning];
102 | // Dispose of any resources that can be recreated.
103 | }
104 |
105 | /*
106 | #pragma mark - Navigation
107 |
108 | // In a storyboard-based application, you will often want to do a little preparation before navigation
109 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
110 | // Get the new view controller using [segue destinationViewController].
111 | // Pass the selected object to the new view controller.
112 | }
113 | */
114 |
115 | @end
116 |
--------------------------------------------------------------------------------
/Wonderful/UILabel+Wonderful.m:
--------------------------------------------------------------------------------
1 | //
2 | // UILabel+Wonderful.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 16/1/7.
6 | // Copyright © 2016年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "UILabel+Wonderful.h"
10 |
11 | static UIColor *SXColorLabelAnotherColor;
12 | static UIFont *SXColorLabelAnotherFont;
13 |
14 | typedef NS_ENUM(NSInteger, SXLabelType) {
15 | SXLabelTypeColor = 1,
16 | SXLabelTypeFont = 2,
17 | };
18 |
19 | @implementation UILabel (Wonderful)
20 |
21 | - (void)setColorText:(NSString *)text{
22 | if ([text rangeOfString:@"<"].location != NSNotFound){
23 | if (!SXColorLabelAnotherColor) {
24 | SXColorLabelAnotherColor = [UIColor redColor];
25 | }
26 | NSMutableString *mstr = [NSMutableString string];
27 | [mstr appendString:text];
28 | NSArray *rangeColorArray = [self scanBeginStr:@"<" endStr:@">" inText:&mstr];
29 | NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:mstr];
30 | AttributedStr = [self addAttributeString:AttributedStr withArray:rangeColorArray type:1];
31 | [self setAttributedText:AttributedStr];
32 | }else{
33 | [self setText:text];
34 | }
35 | }
36 |
37 | - (void)setFontText:(NSString *)text{
38 | if ([text rangeOfString:@"["].location != NSNotFound) {
39 | if (!SXColorLabelAnotherFont) {
40 | SXColorLabelAnotherFont = [UIFont boldSystemFontOfSize:18];
41 | }
42 | NSMutableString *mstr2 = [NSMutableString string];
43 | [mstr2 appendString:text];
44 | NSArray *rangeBoldArray = [self scanBeginStr:@"[" endStr:@"]" inText:&mstr2];
45 | NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:mstr2];
46 | AttributedStr = [self addAttributeString:AttributedStr withArray:rangeBoldArray type:2];
47 | [self setAttributedText:AttributedStr];
48 | }else{
49 | [self setText:text];
50 | }
51 | }
52 |
53 | - (void)setColorFontText:(NSString *)text{
54 | if (([text rangeOfString:@"<"].location != NSNotFound)||([text rangeOfString:@"["].location != NSNotFound)) {
55 | if (!SXColorLabelAnotherFont) {
56 | SXColorLabelAnotherFont = [UIFont boldSystemFontOfSize:18];
57 | }
58 | if (!SXColorLabelAnotherColor) {
59 | SXColorLabelAnotherColor = [UIColor redColor];
60 | }
61 | NSMutableString *mstr = [NSMutableString string];
62 | NSMutableString *mstr2 = [NSMutableString string];
63 | [mstr appendString:text];
64 | [mstr2 appendString:text];
65 | [mstr replaceOccurrencesOfString:@"[" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, mstr.length)];
66 | [mstr replaceOccurrencesOfString:@"]" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, mstr.length)];
67 | [mstr2 replaceOccurrencesOfString:@"<" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, mstr2.length)];
68 | [mstr2 replaceOccurrencesOfString:@">" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, mstr2.length)];
69 | NSArray *rangeColorArray = [self scanBeginStr:@"<" endStr:@">" inText:&mstr];
70 | NSArray *rangeBoldArray = [self scanBeginStr:@"[" endStr:@"]" inText:&mstr2];
71 | NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:mstr];
72 | AttributedStr = [self addAttributeString:AttributedStr withArray:rangeColorArray type:1];
73 | AttributedStr = [self addAttributeString:AttributedStr withArray:rangeBoldArray type:2];
74 | [self setAttributedText:AttributedStr];
75 | }else{
76 | [self setText:text];
77 | }
78 | }
79 |
80 | /**
81 | * 通过传入的开始标记和结束标记在这个字符串中扫描并将获得的范围装在数组中返回
82 | *
83 | * @param beginstr 开始标记
84 | * @param endstr 结束标记
85 | * @param text 信息
86 | *
87 | * @return 字典数组装着一个个range
88 | */
89 | - (NSArray *)scanBeginStr:(NSString *)beginstr endStr:(NSString *)endstr inText:(NSMutableString * *)text{
90 | NSRange range1;
91 | NSRange range2;
92 | NSUInteger location =0;
93 | NSUInteger length = 0;
94 | range1.location = 0;
95 |
96 | NSMutableString *mstr2 = *text;
97 | NSMutableArray *rangeBoldArray = [NSMutableArray array];
98 | while (range1.location != NSNotFound) {
99 | range1 = [mstr2 rangeOfString:beginstr];
100 | range2 = [mstr2 rangeOfString:endstr];
101 | if (range1.location != NSNotFound) {
102 | location = range1.location;
103 | length = range2.location - range1.location-1;
104 | if (length > 5000)break;
105 |
106 | [mstr2 replaceOccurrencesOfString:beginstr withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, range1.location + range1.length)];
107 | [mstr2 replaceOccurrencesOfString:endstr withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, range2.location + range2.length - 1)];
108 | }
109 | NSDictionary *dict = @{@"location":@(location),@"length":@(length)};
110 | [rangeBoldArray addObject:dict];
111 | }
112 | return rangeBoldArray;
113 | }
114 |
115 | /**
116 | * 通过传入的range数组在富文本中添加特殊文本,有两种类型
117 | *
118 | * @param attributeStr 富文本
119 | * @param dictArray 字典数组里面装着range
120 | * @param type 1就是添加颜色相关,2就是添加字体相关
121 | *
122 | * @return 把传入的富文本返回
123 | */
124 | - (NSMutableAttributedString *)addAttributeString:(NSMutableAttributedString *)attributeStr withArray:(NSArray *)dictArray type:(SXLabelType)type{
125 |
126 | NSString *key = type == SXLabelTypeColor ? NSForegroundColorAttributeName : NSFontAttributeName;
127 | NSObject *value = type == SXLabelTypeColor ? SXColorLabelAnotherColor : SXColorLabelAnotherFont;
128 |
129 | for (NSDictionary *dict in dictArray) {
130 | NSUInteger lo = [dict[@"location"] integerValue];
131 | NSUInteger le = [dict[@"length"] integerValue];
132 | [attributeStr addAttribute:key
133 | value:value
134 | range:NSMakeRange(lo, le)];
135 | }
136 | return attributeStr;
137 | }
138 |
139 | + (void)setAnotherColor:(UIColor *)color
140 | {
141 | SXColorLabelAnotherColor = color;
142 | }
143 |
144 | + (void)setAnotherFont:(UIFont *)font
145 | {
146 | SXColorLabelAnotherFont = font;
147 | }
148 |
149 | @end
150 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Page/SXColorGradientDemoPage.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorGradientDemoVC.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/20.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXColorGradientDemoPage.h"
10 | #import "UIColor+Wonderful.h"
11 | #import "SXColorGradientView.h"
12 | #import "SXDataSource.h"
13 |
14 | @interface SXColorGradientDemoPage ()
15 | @property (weak, nonatomic) IBOutlet UIView *gradientContent;
16 | @property(nonatomic,weak)SXColorGradientView *grv1;
17 | @property(nonatomic,weak)SXColorGradientView *grv2;
18 | @property(nonatomic,weak)SXColorGradientView *grv3;
19 | @property(nonatomic,weak)SXColorGradientView *grv4;
20 |
21 | @property(nonatomic,weak)SXColorGradientView *grv5;
22 |
23 | @property(nonatomic,weak)SXColorGradientView *grv6;
24 | @property(nonatomic,weak)SXColorGradientView *grv7;
25 |
26 | @property(nonatomic,strong)SXDataSource *dataSource;
27 |
28 | @property (weak, nonatomic) IBOutlet UILabel *msgLabel;
29 |
30 | @end
31 |
32 | @implementation SXColorGradientDemoPage
33 |
34 | - (void)viewDidLoad {
35 | [super viewDidLoad];
36 | self.title = @"SXColorGradientView";
37 |
38 | self.dataSource = [SXDataSource new];
39 | self.msgLabel.text = @"a.支持只传一个颜色默认往透明渐变。\nb.支持传两个颜色相互渐变。\nc.支持传一个数组,自动计算渐变。\nd.支持4种渐变方向,后续还会扩展。";
40 | [self randomGradient];
41 |
42 |
43 | // SXCLEntity *item5 = [self.dataSource randomAColorEntity];
44 | // SXColorGradientView *grv51 = [SXColorGradientView createWithColor:SXRGB16Color(item5.colorValue) frame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height - 255, 375, 255) direction:SXGradientToTop];
45 | // NSArray *colorArray = @[[UIColor redColor],[UIColor orangeColor],[UIColor yellowColor],[UIColor greenColor],[UIColor blueColor],[UIColor purpleColor]];
46 | NSArray *colorArray = @[Wonderful_BlueColor4,Wonderful_PurpleColor5,Wonderful_PinkColor5,Wonderful_RedColor5,Wonderful_YelloeColor5,Wonderful_GreenColor3,Wonderful_CyanColor4];
47 | CGRect rect = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - 255, 375, 255);
48 | SXColorGradientView *grv5 = [SXColorGradientView createWithColorArray:colorArray frame:rect direction:SXGradientToRight];
49 | SXColorGradientView *grv5_5 = [SXColorGradientView createWithColor:[UIColor whiteColor] frame:rect direction:SXGradientToBottom];
50 |
51 | [self.view addSubview:grv5];
52 | [self.view addSubview:grv5_5];
53 | // self.grv5 = grv5;
54 |
55 | }
56 |
57 | - (IBAction)randomGradient {
58 | [self.grv1 removeFromSuperview];
59 | [self.grv2 removeFromSuperview];
60 | [self.grv3 removeFromSuperview];
61 | [self.grv4 removeFromSuperview];
62 | [self.grv6 removeFromSuperview];
63 | [self.grv7 removeFromSuperview];
64 |
65 | self.grv1 = nil;
66 | self.grv2 = nil;
67 | self.grv3 = nil;
68 | self.grv4 = nil;
69 | self.grv6 = nil;
70 | self.grv7 = nil;
71 |
72 |
73 | SXCLEntity *item1 = [self.dataSource randomAColorEntity];
74 | SXColorGradientView *grv1 = [SXColorGradientView createWithColor:SXRGB16Color(item1.colorValue) frame:CGRectMake(10, 10, 80, 30) direction:SXGradientToRight];
75 | [self.gradientContent addSubview:grv1];
76 |
77 | SXCLEntity *item2 = [self.dataSource randomAColorEntity];
78 | SXColorGradientView *grv2 = [SXColorGradientView createWithColor:SXRGB16Color(item2.colorValue) frame:CGRectMake(100, 10, 80, 30) direction:SXGradientToRight];
79 | [self.gradientContent addSubview:grv2];
80 |
81 | SXCLEntity *item3 = [self.dataSource randomAColorEntity];
82 | SXCLEntity *item31 = [self.dataSource randomAColorEntity];
83 | SXColorGradientView *grv3 = [SXColorGradientView createWithFromColor:SXRGB16Color(item3.colorValue) toColor:SXRGB16Color(item31.colorValue) frame:CGRectMake(10, 50, 80, 30) direction:SXGradientToRight];
84 | [self.gradientContent addSubview:grv3];
85 |
86 | SXCLEntity *item4 = [self.dataSource randomAColorEntity];
87 | SXCLEntity *item41 = [self.dataSource randomAColorEntity];
88 | SXColorGradientView *grv4 = [SXColorGradientView createWithFromColor:SXRGB16Color(item4.colorValue) toColor:SXRGB16Color(item41.colorValue) frame:CGRectMake(100, 50, 80, 30) direction:SXGradientToRight];
89 | [self.gradientContent addSubview:grv4];
90 |
91 |
92 | SXCLEntity *item6 = [self.dataSource randomAColorEntity];
93 | NSArray *array6 = @[SXRGB16Color(item1.colorValue),SXRGB16Color(item2.colorValue),SXRGB16Color(item6.colorValue)];
94 | SXColorGradientView *grv6 = [SXColorGradientView createWithColorArray:array6 frame:CGRectMake(10, 100, 335, 30) direction:SXGradientToRight];
95 | [self.gradientContent addSubview:grv6];
96 |
97 | SXCLEntity *item71 = [self.dataSource randomAColorEntity];
98 | SXCLEntity *item72 = [self.dataSource randomAColorEntity];
99 | SXCLEntity *item73 = [self.dataSource randomAColorEntity];
100 | NSArray *array7 = @[SXRGB16Color(item31.colorValue),SXRGB16Color(item41.colorValue),SXRGB16Color(item71.colorValue),SXRGB16Color(item72.colorValue),SXRGB16Color(item73.colorValue)];
101 | SXColorGradientView *grv7 = [SXColorGradientView createWithColorArray:array7 frame:CGRectMake(10, 140, 335, 30) direction:SXGradientToRight];
102 | [self.gradientContent addSubview:grv7];
103 |
104 |
105 | grv1.layer.cornerRadius = 2;
106 | grv1.layer.masksToBounds = YES;
107 | self.grv1 = grv1;
108 |
109 | grv2.layer.cornerRadius = 2;
110 | grv2.layer.masksToBounds = YES;
111 | self.grv2 = grv2;
112 |
113 | grv3.layer.cornerRadius = 2;
114 | grv3.layer.masksToBounds = YES;
115 | self.grv3 = grv3;
116 |
117 | grv4.layer.cornerRadius = 2;
118 | grv4.layer.masksToBounds = YES;
119 | self.grv4 = grv4;
120 |
121 | grv6.layer.cornerRadius = 2;
122 | grv6.layer.masksToBounds = YES;
123 | self.grv6 = grv6;
124 |
125 | grv7.layer.cornerRadius = 2;
126 | grv7.layer.masksToBounds = YES;
127 | self.grv7 = grv7;
128 |
129 | }
130 |
131 | /*
132 | #pragma mark - Navigation
133 |
134 | // In a storyboard-based application, you will often want to do a little preparation before navigation
135 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
136 | // Get the new view controller using [segue destinationViewController].
137 | // Pass the selected object to the new view controller.
138 | }
139 | */
140 |
141 | @end
142 |
--------------------------------------------------------------------------------
/Wonderful/SXColorLabel.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXColorLabel.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/19.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXColorLabel.h"
10 |
11 | @implementation SXColorLabel
12 |
13 | static UIColor *SXColorLabelAnotherColor;
14 | static UIFont *SXColorLabelAnotherFont;
15 |
16 | typedef NS_ENUM(NSInteger, SXLabelType) {
17 | SXLabelTypeColor = 1,
18 | SXLabelTypeFont = 2,
19 | };
20 |
21 | - (void)setText:(NSString *)text
22 | {
23 | BOOL hasColor = [text rangeOfString:@"<"].location != NSNotFound;
24 | BOOL hasFont = [text rangeOfString:@"["].location != NSNotFound;
25 |
26 | if ( hasColor && hasFont) {
27 | [self setColorFontText:text];
28 | }else if( hasColor && (!hasFont)){
29 | [self setColorText:text];
30 | }else if ((!hasColor) && hasFont){
31 | [self setFontText:text];
32 | }
33 | return;
34 | }
35 |
36 |
37 | - (void)setColorText:(NSString *)text{
38 | if ([text rangeOfString:@"<"].location != NSNotFound){
39 | if (!SXColorLabelAnotherColor) {
40 | SXColorLabelAnotherColor = [UIColor redColor];
41 | }
42 | NSMutableString *mstr = [NSMutableString string];
43 | [mstr appendString:text];
44 | NSArray *rangeColorArray = [self scanBeginStr:@"<" endStr:@">" inText:&mstr];
45 | NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:mstr];
46 | AttributedStr = [self addAttributeString:AttributedStr withArray:rangeColorArray type:1];
47 | [self setAttributedText:AttributedStr];
48 | }else{
49 | [self setText:text];
50 | }
51 | }
52 |
53 | - (void)setFontText:(NSString *)text{
54 | if ([text rangeOfString:@"["].location != NSNotFound) {
55 | if (!SXColorLabelAnotherFont) {
56 | SXColorLabelAnotherFont = [UIFont boldSystemFontOfSize:18];
57 | }
58 | NSMutableString *mstr2 = [NSMutableString string];
59 | [mstr2 appendString:text];
60 | NSArray *rangeBoldArray = [self scanBeginStr:@"[" endStr:@"]" inText:&mstr2];
61 | NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:mstr2];
62 | AttributedStr = [self addAttributeString:AttributedStr withArray:rangeBoldArray type:2];
63 | [self setAttributedText:AttributedStr];
64 | }else{
65 | [self setText:text];
66 | }
67 | }
68 |
69 | - (void)setColorFontText:(NSString *)text{
70 | if (([text rangeOfString:@"<"].location != NSNotFound)||([text rangeOfString:@"["].location != NSNotFound)) {
71 | if (!SXColorLabelAnotherFont) {
72 | SXColorLabelAnotherFont = [UIFont boldSystemFontOfSize:18];
73 | }
74 | if (!SXColorLabelAnotherColor) {
75 | SXColorLabelAnotherColor = [UIColor redColor];
76 | }
77 | NSMutableString *mstr = [NSMutableString string];
78 | NSMutableString *mstr2 = [NSMutableString string];
79 | [mstr appendString:text];
80 | [mstr2 appendString:text];
81 | [mstr replaceOccurrencesOfString:@"[" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, mstr.length)];
82 | [mstr replaceOccurrencesOfString:@"]" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, mstr.length)];
83 | [mstr2 replaceOccurrencesOfString:@"<" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, mstr2.length)];
84 | [mstr2 replaceOccurrencesOfString:@">" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, mstr2.length)];
85 | NSArray *rangeColorArray = [self scanBeginStr:@"<" endStr:@">" inText:&mstr];
86 | NSArray *rangeBoldArray = [self scanBeginStr:@"[" endStr:@"]" inText:&mstr2];
87 | NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:mstr];
88 | AttributedStr = [self addAttributeString:AttributedStr withArray:rangeColorArray type:1];
89 | AttributedStr = [self addAttributeString:AttributedStr withArray:rangeBoldArray type:2];
90 | [self setAttributedText:AttributedStr];
91 | }else{
92 | [self setText:text];
93 | }
94 | }
95 |
96 | /**
97 | * 通过传入的开始标记和结束标记在这个字符串中扫描并将获得的范围装在数组中返回
98 | *
99 | * @param beginstr 开始标记
100 | * @param endstr 结束标记
101 | * @param text 信息
102 | *
103 | * @return 字典数组装着一个个range
104 | */
105 | - (NSArray *)scanBeginStr:(NSString *)beginstr endStr:(NSString *)endstr inText:(NSMutableString * *)text{
106 | NSRange range1;
107 | NSRange range2;
108 | NSUInteger location =0;
109 | NSUInteger length = 0;
110 | range1.location = 0;
111 |
112 | NSMutableString *mstr2 = *text;
113 | NSMutableArray *rangeBoldArray = [NSMutableArray array];
114 | while (range1.location != NSNotFound) {
115 | range1 = [mstr2 rangeOfString:beginstr];
116 | range2 = [mstr2 rangeOfString:endstr];
117 | if (range1.location != NSNotFound) {
118 | location = range1.location;
119 | length = range2.location - range1.location-1;
120 | if (length > 5000)break;
121 |
122 | [mstr2 replaceOccurrencesOfString:beginstr withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, range1.location + range1.length)];
123 | [mstr2 replaceOccurrencesOfString:endstr withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, range2.location + range2.length - 1)];
124 | }
125 | NSDictionary *dict = @{@"location":@(location),@"length":@(length)};
126 | [rangeBoldArray addObject:dict];
127 | }
128 | return rangeBoldArray;
129 | }
130 |
131 | /**
132 | * 通过传入的range数组在富文本中添加特殊文本,有两种类型
133 | *
134 | * @param attributeStr 富文本
135 | * @param dictArray 字典数组里面装着range
136 | * @param type 1就是添加颜色相关,2就是添加字体相关
137 | *
138 | * @return 把传入的富文本返回
139 | */
140 | - (NSMutableAttributedString *)addAttributeString:(NSMutableAttributedString *)attributeStr withArray:(NSArray *)dictArray type:(SXLabelType)type{
141 |
142 | UIFont *showFont = self.anotherFont == nil ? SXColorLabelAnotherFont : self.anotherFont;
143 | NSString *key = type == SXLabelTypeColor ? NSForegroundColorAttributeName : NSFontAttributeName;
144 | UIColor *showColor = self.anotherColor == nil ? SXColorLabelAnotherColor : self.anotherColor;
145 | NSObject *value = type == SXLabelTypeColor ? showColor : showFont;
146 |
147 | for (NSDictionary *dict in dictArray) {
148 | NSUInteger lo = [dict[@"location"] integerValue];
149 | NSUInteger le = [dict[@"length"] integerValue];
150 | [attributeStr addAttribute:key
151 | value:value
152 | range:NSMakeRange(lo, le)];
153 | }
154 | return attributeStr;
155 | }
156 |
157 | + (void)setAnotherColor:(UIColor *)color
158 | {
159 | SXColorLabelAnotherColor = color;
160 | }
161 |
162 | + (void)setAnotherFont:(UIFont *)font
163 | {
164 | SXColorLabelAnotherFont = font;
165 | }
166 |
167 | - (void)setAnotherColor:(UIColor *)color{
168 | _anotherColor = color;
169 | }
170 | - (void)setAnotherFont:(UIFont *)font{
171 | _anotherFont = font;
172 | }
173 |
174 | @end
175 |
--------------------------------------------------------------------------------
/Wonderful/SXHeadLine.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXHeadLine.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 16/2/18.
6 | // Copyright © 2016年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXHeadLine.h"
10 | #import "SXColorGradientView.h"
11 |
12 | #define kSXHeadLineMargin 10
13 |
14 |
15 | //typedef void(^SXWonderfulAction)(NSInteger index);
16 | typedef NS_ENUM(NSInteger, SXMarqueeTapMode) {
17 | SXMarqueeTapForMove = 1,
18 | SXMarqueeTapForAction = 2
19 | };
20 | @interface SXHeadLine ()
21 |
22 | @property (nonatomic,strong) UILabel *label1;
23 | @property (nonatomic,strong) UILabel *label2;
24 | @property (nonatomic,assign) NSInteger messageIndex;
25 | @property (nonatomic,assign) CGFloat h;
26 | @property (nonatomic,assign) CGFloat w;
27 | @property (nonatomic,strong) NSTimer *timer;
28 | @property (nonatomic,strong) SXColorGradientView *viewTop;
29 | @property (nonatomic,strong) SXColorGradientView *viewBottom;
30 | @property (nonatomic,strong) UIButton *bgBtn;
31 | @property (nonatomic,copy ) actionBlock tapAction;
32 | @property (nonatomic,assign) SXMarqueeTapMode tapMode;
33 |
34 |
35 | @end
36 | @implementation SXHeadLine
37 |
38 | - (instancetype)initWithFrame:(CGRect)frame
39 | {
40 | self = [super initWithFrame:frame];
41 | if (self) {
42 | self.h = frame.size.height;
43 | self.w = frame.size.width;
44 | self.bgColor = [UIColor whiteColor];
45 | self.textColor = [UIColor blackColor];
46 | self.scrollDuration = 1.0f;
47 | self.stayDuration = 4.0f;
48 | self.cornerRadius = 2;
49 | self.textFont = [UIFont systemFontOfSize:12];
50 | [self addCompoment];
51 | self.layer.cornerRadius = self.cornerRadius;
52 | self.layer.masksToBounds = YES;
53 | [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(restart) name:@"UIApplicationDidBecomeActiveNotification" object:nil];
54 | }
55 | return self;
56 | }
57 |
58 | - (void)addCompoment{
59 | UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(kSXHeadLineMargin, 0, _w, _h)];
60 | UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(kSXHeadLineMargin, _h, _w, _h)];
61 | label1.font = label2.font = _textFont;
62 | label1.textColor = label2.textColor = _textColor;
63 | self.label1 = label1;
64 | self.label2 = label2;
65 | [self addSubview:label1];
66 | [self addSubview:label2];
67 | [self addSubview:self.bgBtn];
68 | }
69 |
70 | - (void)removeCompoment{
71 | [self.label1 removeFromSuperview];
72 | [self.label2 removeFromSuperview];
73 | [self.bgBtn removeFromSuperview];
74 | }
75 |
76 | - (void)dealloc{
77 | [[NSNotificationCenter defaultCenter] removeObserver:self];
78 | }
79 |
80 | #pragma mark - **************** animate
81 | - (void)scrollAnimate
82 | {
83 | CGRect rect1 = self.label1.frame;
84 | CGRect rect2 = self.label2.frame;
85 | rect1.origin.y -= _h;
86 | rect2.origin.y -= _h;
87 | [UIView animateWithDuration:_scrollDuration animations:^{
88 | self.label1.frame = rect1;
89 | self.label2.frame = rect2;
90 | } completion:^(BOOL finished) {
91 | [self checkLabelFrameChange:self.label1];
92 | [self checkLabelFrameChange:self.label2];
93 | }];
94 | }
95 |
96 | - (void)checkLabelFrameChange:(UILabel *)label
97 | {
98 | if (label.frame.origin.y < -10) {
99 | CGRect rect = label.frame;
100 | rect.origin.y = _h;
101 | label.frame = rect;
102 | label.text = self.messageArray[self.messageIndex];
103 | if (self.messageIndex == self.messageArray.count - 1) {
104 | self.messageIndex = 0;
105 | }else{
106 | self.messageIndex += 1;
107 | }
108 | }
109 | }
110 |
111 | #pragma mark - **************** opration
112 | - (void)start{
113 | if (self.messageArray.count < 2) {
114 | return;
115 | }
116 | NSTimer *timer = [NSTimer timerWithTimeInterval:_stayDuration target:self selector:@selector(scrollAnimate) userInfo:nil repeats:YES];
117 | [[NSRunLoop currentRunLoop]addTimer:timer forMode:NSRunLoopCommonModes];
118 | self.timer = timer;
119 | }
120 |
121 | - (void)stop{
122 | [self.timer invalidate];
123 | }
124 |
125 | #pragma mark - **************** set
126 | -(void)setMessageArray:(NSArray *)messageArray
127 | {
128 | _messageArray = messageArray;
129 | if (self.messageArray.count == 1) {
130 | self.messageArray = @[self.messageArray[0],self.messageArray[0]];
131 | }
132 |
133 | if (self.messageArray.count > 2) {
134 | self.label1.text = self.messageArray[0];
135 | self.label2.text = self.messageArray[1];
136 | self.messageIndex = 2;
137 | }else if (self.messageArray.count == 2){
138 | self.label1.text = self.messageArray[0];
139 | self.label2.text = self.messageArray[1];
140 | self.messageIndex = 0;
141 | }
142 | }
143 |
144 | - (void)setTextColor:(UIColor *)textColor{
145 | _textColor = textColor;
146 | self.label1.textColor = textColor;
147 | self.label2.textColor = textColor;
148 | }
149 |
150 | - (void)setTextFont:(UIFont *)textFont{
151 | _textFont = textFont;
152 | self.label1.font = textFont;
153 | self.label2.font = textFont;
154 | }
155 |
156 | - (void)setBgColor:(UIColor *)bgColor{
157 | _bgColor = bgColor;
158 | self.backgroundColor = bgColor;
159 | }
160 |
161 | - (void)setScrollDuration:(NSTimeInterval)scrollDuration{
162 | _scrollDuration = scrollDuration;
163 | }
164 |
165 | - (void)setStayDuration:(NSTimeInterval)stayDuration{
166 | _stayDuration = stayDuration;
167 | }
168 |
169 | - (void)setCornerRadius:(CGFloat)cornerRadius
170 | {
171 | _cornerRadius = cornerRadius;
172 | self.layer.cornerRadius = cornerRadius;
173 | self.layer.masksToBounds = YES;
174 | }
175 |
176 | - (void)setHasGradient:(BOOL)hasGradient{
177 | _hasGradient = hasGradient;
178 | if (hasGradient) {
179 | _viewTop = [SXColorGradientView createWithColor:self.bgColor frame:CGRectMake(0, 0, _w, _h * 0.2) direction:SXGradientToBottom];
180 | _viewBottom = [SXColorGradientView createWithColor:self.bgColor frame:CGRectMake(0, _h * 0.8, _w, _h * 0.2) direction:SXGradientToTop];
181 | [self addSubview:_viewTop];
182 | [self addSubview:_viewBottom];
183 | }else{
184 | [_viewTop removeFromSuperview];
185 | [_viewBottom removeFromSuperview];
186 | }
187 | }
188 |
189 | - (void)setBgColor:(UIColor *)bgColor textColor:(UIColor *)textColor textFont:(UIFont *)textFont
190 | {
191 | self.bgColor = bgColor;
192 | self.textColor = textColor;
193 | self.textFont = textFont;
194 | }
195 |
196 | - (void)setScrollDuration:(NSTimeInterval)scrollDuration stayDuration:(NSTimeInterval)stayDuration
197 | {
198 | self.scrollDuration = scrollDuration;
199 | self.stayDuration = stayDuration;
200 | }
201 |
202 | - (void)changeTapMarqueeAction:(actionBlock)action{
203 |
204 | self.tapAction = action;
205 | self.tapMode = SXMarqueeTapForAction;
206 | }
207 |
208 | - (void)restart
209 | {
210 | [self stop];
211 | [self removeCompoment];
212 | [self addCompoment];
213 | [self setMessageArray:_messageArray];
214 | [self start];
215 | }
216 |
217 | - (UIButton *)bgBtn
218 | {
219 | if (!_bgBtn) {
220 | CGFloat w = self.frame.size.width;
221 | CGFloat h = self.frame.size.height;
222 | _bgBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, w, h)];
223 | [_bgBtn addTarget:self action:@selector(bgButtonClick) forControlEvents:UIControlEventTouchUpInside];
224 | [_bgBtn addTarget:self action:@selector(bgButtonPress) forControlEvents:UIControlEventTouchDown];
225 | }
226 | return _bgBtn;
227 | }
228 |
229 | - (void)bgButtonClick
230 | {
231 | if (self.messageArray.count == 0) return;
232 | if (self.tapAction)
233 | {
234 | NSLog(@"***** messageIndex : %ld", (self.messageIndex + self.messageArray.count - 2)%self.messageArray.count);
235 | self.tapAction((self.messageIndex + self.messageArray.count - 2)%self.messageArray.count);
236 | }else{
237 | [self start];
238 | }
239 | }
240 |
241 | - (void)bgButtonPress
242 | {
243 | if (!self.tapAction) {
244 | [self stop];
245 | }
246 | }
247 |
248 | @end
249 |
250 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/Other/SXDataSource.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXDataSource.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/12/21.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXDataSource.h"
10 |
11 | @interface SXDataSource ()
12 |
13 | @end
14 | @implementation SXDataSource
15 |
16 | - (instancetype)init
17 | {
18 | if (self = [super init]) {
19 | [self getDataSource];
20 | }
21 | return self;
22 | }
23 |
24 | - (SXCLEntity *)randomAColorEntity
25 | {
26 | NSInteger x1 = arc4random() % 10;
27 | NSArray *ary1 = self.marray[x1];
28 | NSInteger y1 = arc4random() % ary1.count;
29 | return ary1[y1];
30 | }
31 |
32 |
33 | - (void)getDataSource
34 | {
35 | self.titleArray = @[@"红",@"黄",@"绿",@"青",@"蓝",@"紫",@"灰",@"白",@"棕",@"粉"];
36 |
37 | SXCLEntity *a1 = [SXCLEntity CWV:0xFFE4E1 D:@"薄雾玫瑰" N:@"mistyRose"];
38 | SXCLEntity *a2 = [SXCLEntity CWV:0xFFA07A D:@"浅鲑鱼色" N:@"lightSalmon"];
39 | SXCLEntity *a3 = [SXCLEntity CWV:0xF08080 D:@"淡珊瑚色" N:@"lightCoral"];
40 | SXCLEntity *a4 = [SXCLEntity CWV:0xFA8072 D:@"鲑鱼色" N:@"salmonColor"];
41 | SXCLEntity *a5 = [SXCLEntity CWV:0xFF7F50 D:@"珊瑚色" N:@"coralColor"];
42 | SXCLEntity *a6 = [SXCLEntity CWV:0xFF6347 D:@"番茄" N:@"tomatoColor"];
43 | SXCLEntity *a7 = [SXCLEntity CWV:0xFF4500 D:@"橙红色" N:@"orangeRed"];
44 | SXCLEntity *a8 = [SXCLEntity CWV:0xCD5C5C D:@"印度红" N:@"indianRed"];
45 | SXCLEntity *a9 = [SXCLEntity CWV:0xDC143C D:@"猩红" N:@"crimsonColor"];
46 | SXCLEntity *a10 = [SXCLEntity CWV:0xB22222 D:@"耐火砖" N:@"fireBrick"];
47 | NSArray *array0 = @[a1,a2,a3,a4,a5,a6,a7,a8,a9,a10];
48 |
49 |
50 | SXCLEntity *b1 = [SXCLEntity CWV:0xFFF8DC D:@"玉米色" N:@"cornColor"];
51 | SXCLEntity *b2 = [SXCLEntity CWV:0xFFFACD D:@"柠檬薄纱" N:@"LemonChiffon"];
52 | SXCLEntity *b3 = [SXCLEntity CWV:0xEEE8AA D:@"苍金麒麟" N:@"paleGodenrod"];
53 | SXCLEntity *b4 = [SXCLEntity CWV:0xF0E68C D:@"卡其色" N:@"khakiColor"];
54 | SXCLEntity *b5 = [SXCLEntity CWV:0xFFD700 D:@"金色" N:@"goldColor"];
55 | SXCLEntity *b6 = [SXCLEntity CWV:0xFFC64B D:@"雌黄" N:@"orpimentColor"];
56 | SXCLEntity *b7 = [SXCLEntity CWV:0xFFB61E D:@"藤黄" N:@"gambogeColor"];
57 | SXCLEntity *b8 = [SXCLEntity CWV:0xE9BB1D D:@"雄黄" N:@"realgarColor"];
58 | SXCLEntity *b9 = [SXCLEntity CWV:0xDAA520 D:@"金麒麟色" N:@"goldenrod"];
59 | SXCLEntity *b10 = [SXCLEntity CWV:0xA78E44 D:@"乌金" N:@"darkGold"];
60 | NSArray *array1 = @[b1,b2,b3,b4,b5,b6,b7,b8,b9,b10];
61 |
62 | SXCLEntity *c1 = [SXCLEntity CWV:0x98FB98 D:@"苍绿" N:@"paleGreen"];
63 | SXCLEntity *c2 = [SXCLEntity CWV:0x90EE90 D:@"淡绿色" N:@"lightGreen"];
64 | SXCLEntity *c3 = [SXCLEntity CWV:0x2AFD84 D:@"春绿" N:@"springGreen"];
65 | SXCLEntity *c4 = [SXCLEntity CWV:0xADFF2F D:@"绿黄色" N:@"greenYellow"];
66 | SXCLEntity *c5 = [SXCLEntity CWV:0x7CFC00 D:@"草坪绿" N:@"lawnGreen"];
67 | SXCLEntity *c6 = [SXCLEntity CWV:0x32CD32 D:@"酸橙绿" N:@"limeGreen"];
68 | SXCLEntity *c7 = [SXCLEntity CWV:0x228B22 D:@"森林绿" N:@"forestGreen"];
69 | SXCLEntity *c8 = [SXCLEntity CWV:0x2E8B57 D:@"海洋绿" N:@"seaGreen"];
70 | SXCLEntity *c9 = [SXCLEntity CWV:0x006400 D:@"深绿" N:@"darkGreen"];
71 | SXCLEntity *c10 = [SXCLEntity CWV:0x556B2F D:@"橄榄(墨绿)" N:@"olive"];
72 |
73 | NSArray *array2 = @[c1,c2,c3,c4,c5,c6,c7,c8,c9,c10];
74 |
75 | SXCLEntity *d1 = [SXCLEntity CWV:0xE1FFFF D:@"淡青色" N:@"lightCyan"];
76 | SXCLEntity *d2 = [SXCLEntity CWV:0xAFEEEE D:@"苍白绿松石" N:@"paleTurquoise"];
77 | SXCLEntity *d3 = [SXCLEntity CWV:0x7FFFD4 D:@"绿碧" N:@"aquamarine"];
78 | SXCLEntity *d4 = [SXCLEntity CWV:0x40E0D0 D:@"绿松石" N:@"turquoise"];
79 | SXCLEntity *d5 = [SXCLEntity CWV:0x48D1CC D:@"适中绿松石" N:@"mediumTurquoise"];
80 | SXCLEntity *d6 = [SXCLEntity CWV:0x2BB8AA D:@"美团色" N:@"meituanColor"];
81 | SXCLEntity *d7 = [SXCLEntity CWV:0x20B2AA D:@"浅海洋绿" N:@"lightSeaGreen"];
82 | SXCLEntity *d8 = [SXCLEntity CWV:0x008B8B D:@"深青色" N:@"darkCyan"];
83 | SXCLEntity *d9 = [SXCLEntity CWV:0x008080 D:@"水鸭色" N:@"tealColor"];
84 | SXCLEntity *d10 = [SXCLEntity CWV:0x2F4F4F D:@"深石板灰" N:@"darkSlateGray"];
85 | NSArray *array3 = @[d1,d2,d3,d4,d5,d6,d7,d8,d9,d10];
86 |
87 | SXCLEntity *e1 = [SXCLEntity CWV:0x8ACEE9 D:@"天蓝色" N:@"skyBlue"];
88 | SXCLEntity *e2 = [SXCLEntity CWV:0x8ACFF8 D:@"淡蓝" N:@"lightBLue"];
89 | SXCLEntity *e3 = [SXCLEntity CWV:0x00BFFF D:@"深天蓝" N:@"deepSkyBlue"];
90 | SXCLEntity *e4 = [SXCLEntity CWV:0x1E90FF D:@"道奇蓝" N:@"doderBlue"];
91 | SXCLEntity *e5 = [SXCLEntity CWV:0x6495ED D:@"矢车菊" N:@"cornflowerBlue"];
92 | SXCLEntity *e6 = [SXCLEntity CWV:0x4169E1 D:@"皇家蓝" N:@"royalBlue"];
93 | SXCLEntity *e7 = [SXCLEntity CWV:0x0000CD D:@"适中的蓝色" N:@"mediumBlue"];
94 | SXCLEntity *e8 = [SXCLEntity CWV:0x00008B D:@"深蓝" N:@"darkBlue"];
95 | SXCLEntity *e9 = [SXCLEntity CWV:0x000080 D:@"海军蓝" N:@"navyColor"];
96 | SXCLEntity *e10 = [SXCLEntity CWV:0x191970 D:@"午夜蓝" N:@"midnightBlue"];
97 | NSArray *array4 = @[e1,e2,e3,e4,e5,e6,e7,e8,e9,e10];
98 |
99 | SXCLEntity *f0 = [SXCLEntity CWV:0xE6E6FA D:@"薰衣草" N:@"lavender"];
100 | SXCLEntity *f1 = [SXCLEntity CWV:0xD8BFD8 D:@"蓟" N:@"thistleColor"];
101 | SXCLEntity *f2 = [SXCLEntity CWV:0xDDA0DD D:@"李子" N:@"plumColor"];
102 | SXCLEntity *f3 = [SXCLEntity CWV:0xEE82EE D:@"紫罗兰" N:@"violetColor"];
103 | SXCLEntity *f4 = [SXCLEntity CWV:0xBA55D3 D:@"适中的兰花紫" N:@"mediumOrchid"];
104 | SXCLEntity *f5 = [SXCLEntity CWV:0x9932CC D:@"深兰花紫" N:@"darkOrchid"];
105 | SXCLEntity *f6 = [SXCLEntity CWV:0x9400D3 D:@"深紫罗兰色" N:@"darkVoilet"];
106 | SXCLEntity *f7 = [SXCLEntity CWV:0x8A2BE2 D:@"泛蓝紫罗兰" N:@"blueViolet"];
107 | SXCLEntity *f8 = [SXCLEntity CWV:0x8B008B D:@"深洋红色" N:@"darkMagenta"];
108 | SXCLEntity *f9 = [SXCLEntity CWV:0x4B0082 D:@"靛青" N:@"indigoColor"];
109 | NSArray *array5 = @[f0,f1,f2,f3,f4,f5,f6,f7,f8,f9];
110 |
111 |
112 | SXCLEntity *g1 = [SXCLEntity CWV:0xF5F5F5 D:@"白烟" N:@"whiteSmoke"];
113 | SXCLEntity *g2 = [SXCLEntity CWV:0xE0EEE8 D:@"鸭蛋" N:@"duckEgg"];
114 | SXCLEntity *g3 = [SXCLEntity CWV:0xDCDCDC D:@"亮灰" N:@"gainsboroColor"];
115 | SXCLEntity *g4 = [SXCLEntity CWV:0xBBCDC5 D:@"蟹壳青" N:@"carapaceColor"];
116 | SXCLEntity *g5 = [SXCLEntity CWV:0xC0C0C0 D:@"银白色" N:@"silverColor"];
117 | SXCLEntity *g6 = [SXCLEntity CWV:0x696969 D:@"暗淡的灰色" N:@"dimGray"];
118 | NSArray *array6 = @[g1,g2,g3,g4,g5,g6];
119 |
120 |
121 | SXCLEntity *h1 = [SXCLEntity CWV:0xFFF5EE D:@"海贝壳" N:@"seaShell"];
122 | SXCLEntity *h2 = [SXCLEntity CWV:0xFFFAFA D:@"雪" N:@"snowColor"];
123 | SXCLEntity *h3 = [SXCLEntity CWV:0xFAF0E6 D:@"亚麻色" N:@"linenColor"];
124 | SXCLEntity *h4 = [SXCLEntity CWV:0xFFFAF0 D:@"花之白" N:@"floralWhite"];
125 | SXCLEntity *h5 = [SXCLEntity CWV:0xFDF5E6 D:@"老饰带" N:@"oldLace"];
126 | SXCLEntity *h6 = [SXCLEntity CWV:0xFFFFF0 D:@"象牙白" N:@"ivoryColor"];
127 | SXCLEntity *h7 = [SXCLEntity CWV:0xF0FFF0 D:@"蜂蜜露" N:@"honeydew"];
128 | SXCLEntity *h8 = [SXCLEntity CWV:0xF5FFFA D:@"薄荷奶油" N:@"mintCream"];
129 | SXCLEntity *h9 = [SXCLEntity CWV:0xF0FFFF D:@"蔚蓝色" N:@"azureColor"];
130 | SXCLEntity *h10 = [SXCLEntity CWV:0xF0F8FF D:@"爱丽丝蓝" N:@"aliceBlue"];
131 | SXCLEntity *h11 = [SXCLEntity CWV:0xF8F8FF D:@"幽灵白" N:@"ghostWhite"];
132 | SXCLEntity *h12 = [SXCLEntity CWV:0xFFF0F5 D:@"淡紫红" N:@"lavenderBlush"];
133 | SXCLEntity *h13 = [SXCLEntity CWV:0xF5F5DD D:@"米色" N:@"beigeColor"];
134 | NSArray *array7 = @[h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13];
135 |
136 |
137 |
138 | SXCLEntity *i1 = [SXCLEntity CWV:0xD2B48C D:@"黄褐色" N:@"tanColor"];
139 | SXCLEntity *i2 = [SXCLEntity CWV:0xBC8F8F D:@"玫瑰棕色" N:@"rosyBrown"];
140 | SXCLEntity *i3 = [SXCLEntity CWV:0xCD853F D:@"秘鲁" N:@"peruColor"];
141 | SXCLEntity *i4 = [SXCLEntity CWV:0xD2691E D:@"巧克力" N:@"chocolateColor"];
142 | SXCLEntity *i5 = [SXCLEntity CWV:0xB87333 D:@"古铜色" N:@"bronzeColor"];
143 | SXCLEntity *i6 = [SXCLEntity CWV:0xA0522D D:@"黄土赭色" N:@"siennaColor"];
144 | SXCLEntity *i7 = [SXCLEntity CWV:0x8B4513 D:@"马鞍棕色" N:@"saddleBrown"];
145 | SXCLEntity *i8 = [SXCLEntity CWV:0x734A12 D:@"土棕" N:@"soilColor"];
146 | SXCLEntity *i9 = [SXCLEntity CWV:0x800000 D:@"栗色" N:@"maroonColor"];
147 | SXCLEntity *i10 = [SXCLEntity CWV:0x5E2612 D:@"乌贼墨棕" N:@"inkfishBrown"];
148 | NSArray *array8 = @[i1,i2,i3,i4,i5,i6,i7,i8,i9,i10];
149 |
150 | SXCLEntity *j1 = [SXCLEntity CWV:0xF3D3E7 D:@"水粉" N:@"waterPink"];
151 | SXCLEntity *j2 = [SXCLEntity CWV:0xEDD1D8 D:@"藕色" N:@"lotusRoot"];
152 | SXCLEntity *j3 = [SXCLEntity CWV:0xFFC0CB D:@"浅粉红" N:@"lightPink"];
153 | SXCLEntity *j4 = [SXCLEntity CWV:0xFFB6C1 D:@"适中的粉红" N:@"mediumPink"];
154 | SXCLEntity *j5 = [SXCLEntity CWV:0xF47983 D:@"桃红" N:@"peachRed"];
155 | SXCLEntity *j6 = [SXCLEntity CWV:0xDB7093 D:@"苍白的紫罗兰红色" N:@"paleVioletRed"];
156 | SXCLEntity *j7 = [SXCLEntity CWV:0xFF1493 D:@"深粉色" N:@"deepPink"];
157 | NSArray *array9 = @[j1,j2,j3,j4,j5,j6,j7];
158 |
159 | self.marray = [NSMutableArray array];
160 | [self.marray addObject:array0];
161 | [self.marray addObject:array1];
162 | [self.marray addObject:array2];
163 | [self.marray addObject:array3];
164 | [self.marray addObject:array4];
165 | [self.marray addObject:array5];
166 | [self.marray addObject:array6];
167 | [self.marray addObject:array7];
168 | [self.marray addObject:array8];
169 | [self.marray addObject:array9];
170 | }
171 |
172 | @end
173 |
--------------------------------------------------------------------------------
/Wonderful/SXMarquee.m:
--------------------------------------------------------------------------------
1 | //
2 | // SXMarquee.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/11/5.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "SXMarquee.h"
10 | #import "SXColorGradientView.h"
11 |
12 | typedef void(^SXWonderfulAction)();
13 |
14 | typedef NS_ENUM(NSInteger, SXMarqueeTapMode) {
15 | SXMarqueeTapForMove = 1,
16 | SXMarqueeTapForAction = 2
17 | };
18 |
19 | @interface SXMarquee ()
20 |
21 | @property (nonatomic,strong) UIButton *bgBtn;
22 | @property (nonatomic,strong) UILabel *marqueeLbl;
23 | @property (nonatomic,strong) UIColor *bgColor;
24 | @property (nonatomic,strong) UIColor *txtColor;
25 | @property (nonatomic,copy ) NSString *msg;
26 | @property (nonatomic,strong) NSTimer *timer;
27 | @property (nonatomic,copy ) SXWonderfulAction tapAction;
28 | @property (nonatomic,strong) SXColorGradientView *leftFade;
29 | @property (nonatomic,strong) SXColorGradientView *rightFade;
30 | @property (nonatomic,assign) SXMarqueeTapMode tapMode;
31 | @property (nonatomic,assign) SXMarqueeSpeedLevel speedLevel;
32 | @property (nonatomic,strong) UIView *middleView;
33 | @property (nonatomic,strong) UIFont *marqueeLabelFont;
34 |
35 | @end
36 |
37 | @implementation SXMarquee
38 |
39 | - (instancetype)initWithFrame:(CGRect)frame speed:(SXMarqueeSpeedLevel)speed Msg:(NSString *)msg bgColor:(UIColor *)bgColor txtColor:(UIColor *)txtColor{
40 | if (self = [super initWithFrame:frame]) {
41 | self.layer.cornerRadius = 2;
42 | if(bgColor){
43 | self.bgColor = bgColor;
44 | }else{
45 | self.bgColor = [UIColor whiteColor];
46 | }
47 |
48 | if (txtColor) {
49 | self.txtColor = txtColor;
50 | }else{
51 | self.txtColor = [UIColor darkGrayColor];
52 | }
53 |
54 | if (speed) {
55 | self.speedLevel = speed;
56 | }else{
57 | self.speedLevel = 3;
58 | }
59 |
60 | self.msg = msg;
61 | [self doSometingBeginning];
62 | }
63 | return self;
64 | }
65 |
66 | - (instancetype)initWithFrame:(CGRect)frame speed:(SXMarqueeSpeedLevel)speed Msg:(NSString *)msg{
67 | if (self = [super initWithFrame:frame]) {
68 | self.msg = msg;
69 | if (speed) {
70 | self.speedLevel = speed;
71 | }else{
72 | self.speedLevel = 3;
73 | }
74 | self.bgColor = [UIColor whiteColor];
75 | self.txtColor = [UIColor darkGrayColor];
76 | [self doSometingBeginning];
77 | }
78 | return self;
79 | }
80 |
81 | - (void)dealloc{
82 | [[NSNotificationCenter defaultCenter] removeObserver:self];
83 | }
84 |
85 | - (void)setFrame:(CGRect)frame
86 | {
87 | [super setFrame:frame];
88 | CGFloat w = self.frame.size.width;
89 | CGFloat h = self.frame.size.height;
90 | self.leftFade.frame = CGRectMake(0, 0, h, h);
91 | self.rightFade.frame = CGRectMake(w - h, 0, h, h);
92 | }
93 |
94 | - (void)doSometingBeginning{
95 | self.layer.masksToBounds = YES;
96 | self.backgroundColor = self.bgColor;
97 | [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(backAndRestart) name:@"UIApplicationDidBecomeActiveNotification" object:nil];
98 | UIView *middleView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
99 | self.middleView = middleView;
100 | [_middleView addSubview:self.marqueeLbl];
101 | [self addSubview:_middleView];
102 | [self addLeftAndRightGradient];
103 | }
104 |
105 | - (void)changeTapMarqueeAction:(void(^)())action{
106 | [self addSubview:self.bgBtn];
107 | self.tapAction = action;
108 | self.tapMode = SXMarqueeTapForAction;
109 | }
110 |
111 | - (void)changeMarqueeLabelFont:(UIFont *)font{
112 | self.marqueeLbl.font = font;
113 | self.marqueeLabelFont = font;
114 | CGSize msgSize = [_marqueeLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font,NSFontAttributeName, nil]];
115 | CGRect fr = self.marqueeLbl.frame;
116 | fr.size.width = msgSize.width;
117 | self.marqueeLbl.frame = fr;
118 | }
119 |
120 | - (UIButton *)bgBtn{
121 | if (!_bgBtn) {
122 | CGFloat w = self.frame.size.width;
123 | CGFloat h = self.frame.size.height;
124 | _bgBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, w, h)];
125 | [_bgBtn addTarget:self action:@selector(bgButtonClick) forControlEvents:UIControlEventTouchUpInside];
126 | }
127 | return _bgBtn;
128 | }
129 |
130 | - (UILabel *)marqueeLbl{
131 | if (!_marqueeLbl) {
132 | self.tapMode = SXMarqueeTapForMove;
133 | CGFloat h = self.frame.size.height;
134 | _marqueeLbl = [[UILabel alloc]init];
135 | _marqueeLbl.text = self.msg;
136 | UIFont *fnt = [UIFont fontWithName:@"HelveticaNeue" size:14.0f];
137 | _marqueeLbl.font = fnt;
138 | CGSize msgSize = [_marqueeLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:fnt,NSFontAttributeName, nil]];
139 | _marqueeLbl.frame = CGRectMake(0, 0, msgSize.width, h);
140 | if (self.marqueeLabelFont != nil) {
141 | _marqueeLbl.font = self.marqueeLabelFont;
142 | }
143 | _marqueeLbl.textColor = self.txtColor;
144 | }
145 | return _marqueeLbl;
146 | }
147 |
148 | - (void)addLeftAndRightGradient{
149 | CGFloat w = self.frame.size.width;
150 | CGFloat h = self.frame.size.height;
151 | SXColorGradientView *leftFade = [SXColorGradientView createWithColor:self.bgColor frame:CGRectMake(0, 0, h, h) direction:SXGradientToRight];
152 | self.leftFade = leftFade;
153 |
154 | SXColorGradientView *rightFade = [SXColorGradientView createWithColor:self.bgColor frame:CGRectMake(w - h, 0, h, h) direction:SXGradientToLeft];
155 | self.rightFade = rightFade;
156 |
157 | [self addSubview:leftFade];
158 | [self addSubview:rightFade];
159 | }
160 |
161 | - (void)bgButtonClick{
162 | if (self.tapAction) {
163 | self.tapAction();
164 | }
165 | }
166 |
167 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
168 | if (self.tapMode == SXMarqueeTapForMove) {
169 | [self stop];
170 | }
171 | }
172 |
173 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
174 | if (self.tapMode == SXMarqueeTapForMove) {
175 | [self restart];
176 | }
177 | }
178 |
179 | #pragma mark - 操作
180 | - (void)start{
181 | [self moveAction];
182 | }
183 |
184 | - (void)backAndRestart{
185 | [self.marqueeLbl.layer removeAllAnimations];
186 | [self.marqueeLbl removeFromSuperview];
187 | self.marqueeLbl = nil;
188 | [self.middleView addSubview:self.marqueeLbl];
189 | [self moveAction];
190 | }
191 |
192 | - (void)stop{
193 | [self pauseLayer:self.marqueeLbl.layer];
194 | }
195 |
196 | - (void)restart{
197 | [self resumeLayer:self.marqueeLbl.layer];
198 | }
199 |
200 | - (void)moveAction
201 | {
202 | CGRect fr = self.marqueeLbl.frame;
203 | fr.origin.x = self.frame.size.width;
204 | self.marqueeLbl.frame = fr;
205 |
206 | CGPoint fromPoint = CGPointMake(self.frame.size.width + self.marqueeLbl.frame.size.width/2, self.frame.size.height/2);
207 |
208 | UIBezierPath *movePath = [UIBezierPath bezierPath];
209 | [movePath moveToPoint:fromPoint];
210 | [movePath addLineToPoint:CGPointMake(-self.marqueeLbl.frame.size.width/2, self.frame.size.height/2)];
211 |
212 | CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
213 | moveAnim.path = movePath.CGPath;
214 | moveAnim.removedOnCompletion = YES;
215 |
216 | moveAnim.duration = self.marqueeLbl.frame.size.width * self.speedLevel * 0.01;
217 | [moveAnim setDelegate:self];
218 |
219 | [self.marqueeLbl.layer addAnimation:moveAnim forKey:nil];
220 | }
221 |
222 | -(void)pauseLayer:(CALayer*)layer
223 | {
224 | CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
225 | layer.speed = 0.0;
226 | layer.timeOffset = pausedTime;
227 | }
228 |
229 | -(void)resumeLayer:(CALayer*)layer
230 | {
231 | CFTimeInterval pausedTime = layer.timeOffset;
232 | layer.speed = 1.0;
233 | layer.timeOffset = 0.0;
234 | layer.beginTime = 0.0;
235 | CFTimeInterval timeSincePause = [layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
236 | layer.beginTime = timeSincePause;
237 | }
238 |
239 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
240 | if (flag) {
241 | [self moveAction];
242 | }
243 | }
244 |
245 | //- (void)newThread
246 | //{
247 | // @autoreleasepool
248 | // {
249 | // NSTimer *timer = [NSTimer timerWithTimeInterval:(12) target:self selector:@selector(moveAction) userInfo:nil repeats:YES];
250 | // self.timer = timer;
251 | //
252 | // [[NSThread currentThread]setName:[NSString stringWithFormat:@"%d号",arc4random()%100]];
253 | //
254 | // [[NSRunLoop currentRunLoop]addTimer:timer forMode:NSRunLoopCommonModes];
255 | // [[NSRunLoop currentRunLoop]addPort:[NSMachPort port] forMode:NSRunLoopCommonModes];
256 | // [[NSRunLoop currentRunLoop]run];
257 | // }
258 | //}
259 |
260 | //- (void)marqueeMove{
261 | // NSLog(@"Timer %@", [NSThread currentThread]);
262 | // CGRect fr = self.marqueeLbl.frame;
263 | // if (fr.origin.x + fr.size.width < 0) {
264 | // fr.origin.x = self.frame.size.width;
265 | // }else{
266 | // fr.origin.x += -1;
267 | // }
268 | // self.marqueeLbl.frame = fr;
269 | //}
270 |
271 |
272 | @end
273 |
--------------------------------------------------------------------------------
/Wonderful/UIColor+Wonderful.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+Wonderful.m
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/26.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import "UIColor+Wonderful.h"
10 |
11 | @implementation UIColor (Wonderful)
12 |
13 | #pragma mark - **************** 红色系
14 | /** 薄雾玫瑰*/
15 | + (UIColor *)mistyRose
16 | {
17 | return SXRGB16Color(0xFFE4E1);
18 | }
19 | /** 浅鲑鱼色*/
20 | + (UIColor *)lightSalmon
21 | {
22 | return SXRGB16Color(0xFFA07A);
23 | }
24 | /** 淡珊瑚色*/
25 | + (UIColor *)lightCoral
26 | {
27 | return SXRGB16Color(0xF08080);
28 | }
29 | /** 鲑鱼色*/
30 | + (UIColor *)salmonColor
31 | {
32 | return SXRGB16Color(0xFA8072);
33 | }
34 | /** 珊瑚色*/
35 | + (UIColor *)coralColor
36 | {
37 | return SXRGB16Color(0xFF7F50);
38 | }
39 | /** 番茄*/
40 | + (UIColor *)tomatoColor
41 | {
42 | return SXRGB16Color(0xFF6347);
43 | }
44 | /** 橙红色*/
45 | + (UIColor *)orangeRed
46 | {
47 | return SXRGB16Color(0xFF4500);
48 | }
49 | /** 印度红*/
50 | + (UIColor *)indianRed
51 | {
52 | return SXRGB16Color(0xCD5C5C);
53 | }
54 | /** 猩红*/
55 | + (UIColor *)crimsonColor
56 | {
57 | return SXRGB16Color(0xDC143C);
58 | }
59 | /** 耐火砖*/
60 | + (UIColor *)fireBrick
61 | {
62 | return SXRGB16Color(0xB22222);
63 | }
64 |
65 |
66 | #pragma mark - **************** 黄色系
67 | /** 玉米色*/
68 | + (UIColor *)cornColor
69 | {
70 | return SXRGB16Color(0xFFF8DC);
71 | }
72 | /** 柠檬薄纱*/
73 | + (UIColor *)LemonChiffon
74 | {
75 | return SXRGB16Color(0xFFFACD);
76 | }
77 | /** 苍金麒麟*/
78 | + (UIColor *)paleGodenrod
79 | {
80 | return SXRGB16Color(0xEEE8AA);
81 | }
82 | /** 卡其色*/
83 | + (UIColor *)khakiColor
84 | {
85 | return SXRGB16Color(0xF0E68C);
86 | }
87 | /** 金色*/
88 | + (UIColor *)goldColor
89 | {
90 | return SXRGB16Color(0xFFD700);
91 | }
92 | /** 雌黄*/
93 | + (UIColor *)orpimentColor
94 | {
95 | return SXRGB16Color(0xFFC64B);
96 | }
97 | /** 藤黄*/
98 | + (UIColor *)gambogeColor
99 | {
100 | return SXRGB16Color(0xFFB61E);
101 | }
102 | /** 雄黄*/
103 | + (UIColor *)realgarColor
104 | {
105 | return SXRGB16Color(0xE9BB1D);
106 | }
107 | /** 金麒麟色*/
108 | + (UIColor *)goldenrod
109 | {
110 | return SXRGB16Color(0xDAA520);
111 | }
112 | /** 乌金*/
113 | + (UIColor *)darkGold
114 | {
115 | return SXRGB16Color(0xA78E44);
116 | }
117 |
118 |
119 | #pragma mark - **************** 绿色系
120 | /** 苍绿*/
121 | + (UIColor *)paleGreen
122 | {
123 | return SXRGB16Color(0x98FB98);
124 | }
125 | /** 淡绿色*/
126 | + (UIColor *)lightGreen
127 | {
128 | return SXRGB16Color(0x90EE90);
129 | }
130 | /** 春绿*/
131 | + (UIColor *)springGreen
132 | {
133 | return SXRGB16Color(0x2AFD84);
134 | }
135 | /** 绿黄色*/
136 | + (UIColor *)greenYellow
137 | {
138 | return SXRGB16Color(0xADFF2F);
139 | }
140 | /** 草坪绿*/
141 | + (UIColor *)lawnGreen
142 | {
143 | return SXRGB16Color(0x7CFC00);
144 | }
145 | /** 酸橙绿*/
146 | + (UIColor *)limeColor
147 | {
148 | return SXRGB16Color(0x00FF00);
149 | }
150 | /** 森林绿*/
151 | + (UIColor *)forestGreen
152 | {
153 | return SXRGB16Color(0x228B22);
154 | }
155 | /** 海洋绿*/
156 | + (UIColor *)seaGreen
157 | {
158 | return SXRGB16Color(0x2E8B57);
159 | }
160 | /** 深绿*/
161 | + (UIColor *)darkGreen
162 | {
163 | return SXRGB16Color(0x006400);
164 | }
165 | /** 橄榄(墨绿)*/
166 | + (UIColor *)olive
167 | {
168 | return SXRGB16Color(0x556B2F);
169 | }
170 |
171 |
172 | #pragma mark - **************** 青色系
173 | /** 淡青色*/
174 | + (UIColor *)lightCyan
175 | {
176 | return SXRGB16Color(0xE1FFFF);
177 | }
178 | /** 苍白绿松石*/
179 | + (UIColor *)paleTurquoise
180 | {
181 | return SXRGB16Color(0xAFEEEE);
182 | }
183 | /** 绿碧*/
184 | + (UIColor *)aquamarine
185 | {
186 | return SXRGB16Color(0x7FFFD4);
187 | }
188 | /** 绿松石*/
189 | + (UIColor *)turquoise
190 | {
191 | return SXRGB16Color(0x40E0D0);
192 | }
193 | /** 适中绿松石*/
194 | + (UIColor *)mediumTurquoise
195 | {
196 | return SXRGB16Color(0x48D1CC);
197 | }
198 | /** 美团色*/
199 | + (UIColor *)meituanColor
200 | {
201 | return SXRGB16Color(0x2BB8AA);
202 | }
203 | /** 浅海洋绿*/
204 | + (UIColor *)lightSeaGreen
205 | {
206 | return SXRGB16Color(0x20B2AA);
207 | }
208 | /** 深青色*/
209 | + (UIColor *)darkCyan
210 | {
211 | return SXRGB16Color(0x008B8B);
212 | }
213 | /** 水鸭色*/
214 | + (UIColor *)tealColor
215 | {
216 | return SXRGB16Color(0x008080);
217 | }
218 | /** 深石板灰*/
219 | + (UIColor *)darkSlateGray
220 | {
221 | return SXRGB16Color(0x2F4F4F);
222 | }
223 |
224 |
225 | #pragma mark - **************** 蓝色系
226 | /** 天蓝色*/
227 | + (UIColor *)skyBlue
228 | {
229 | return SXRGB16Color(0xE1FFFF);
230 | }
231 | /** 淡蓝*/
232 | + (UIColor *)lightBLue
233 | {
234 | return SXRGB16Color(0xADD8E6);
235 | }
236 | /** 深天蓝*/
237 | + (UIColor *)deepSkyBlue
238 | {
239 | return SXRGB16Color(0x00BFFF);
240 | }
241 | /** 道奇蓝*/
242 | + (UIColor *)doderBlue
243 | {
244 | return SXRGB16Color(0x1E90FF);
245 | }
246 | /** 矢车菊*/
247 | + (UIColor *)cornflowerBlue
248 | {
249 | return SXRGB16Color(0x6495ED);
250 | }
251 | /** 皇家蓝*/
252 | + (UIColor *)royalBlue
253 | {
254 | return SXRGB16Color(0x4169E1);
255 | }
256 | /** 适中的蓝色*/
257 | + (UIColor *)mediumBlue
258 | {
259 | return SXRGB16Color(0x0000CD);
260 | }
261 | /** 深蓝*/
262 | + (UIColor *)darkBlue
263 | {
264 | return SXRGB16Color(0x00008B);
265 | }
266 | /** 海军蓝*/
267 | + (UIColor *)navyColor
268 | {
269 | return SXRGB16Color(0x000080);
270 | }
271 | /** 午夜蓝*/
272 | + (UIColor *)midnightBlue
273 | {
274 | return SXRGB16Color(0x191970);
275 | }
276 |
277 |
278 | #pragma mark - **************** 紫色系
279 | /** 薰衣草*/
280 | + (UIColor *)lavender
281 | {
282 | return SXRGB16Color(0xE6E6FA);
283 | }
284 | /** 蓟*/
285 | + (UIColor *)thistleColor
286 | {
287 | return SXRGB16Color(0xD8BFD8);
288 | }
289 | /** 李子*/
290 | + (UIColor *)plumColor
291 | {
292 | return SXRGB16Color(0xDDA0DD);
293 | }
294 | /** 紫罗兰*/
295 | + (UIColor *)violetColor
296 | {
297 | return SXRGB16Color(0xEE82EE);
298 | }
299 | /** 适中的兰花紫*/
300 | + (UIColor *)mediumOrchid
301 | {
302 | return SXRGB16Color(0xBA55D3);
303 | }
304 | /** 深兰花紫*/
305 | + (UIColor *)darkOrchid
306 | {
307 | return SXRGB16Color(0x9932CC);
308 | }
309 | /** 深紫罗兰色*/
310 | + (UIColor *)darkVoilet
311 | {
312 | return SXRGB16Color(0x9400D3);
313 | }
314 | /** 泛蓝紫罗兰*/
315 | + (UIColor *)blueViolet
316 | {
317 | return SXRGB16Color(0x8A2BE2);
318 | }
319 | /** 深洋红色*/
320 | + (UIColor *)darkMagenta
321 | {
322 | return SXRGB16Color(0x8B008B);
323 | }
324 | /** 靛青*/
325 | + (UIColor *)indigoColor
326 | {
327 | return SXRGB16Color(0x4B0082);
328 | }
329 |
330 |
331 | #pragma mark - **************** 灰色系
332 | /** 白烟*/
333 | + (UIColor *)whiteSmoke
334 | {
335 | return SXRGB16Color(0xF5F5F5);
336 | }
337 | /** 鸭蛋*/
338 | + (UIColor *)duckEgg
339 | {
340 | return SXRGB16Color(0xE0EEE8);
341 | }
342 | /** 亮灰*/
343 | + (UIColor *)gainsboroColor
344 | {
345 | return SXRGB16Color(0xDCDCDC);
346 | }
347 | /** 蟹壳青*/
348 | + (UIColor *)carapaceColor
349 | {
350 | return SXRGB16Color(0xBBCDC5);
351 | }
352 | /** 银白色*/
353 | + (UIColor *)silverColor
354 | {
355 | return SXRGB16Color(0xC0C0C0);
356 | }
357 | /** 暗淡的灰色*/
358 | + (UIColor *)dimGray
359 | {
360 | return SXRGB16Color(0x696969);
361 | }
362 |
363 |
364 | #pragma mark - **************** 白色系
365 | /** 海贝壳*/
366 | + (UIColor *)seaShell
367 | {
368 | return SXRGB16Color(0xFFF5EE);
369 | }
370 | /** 雪*/
371 | + (UIColor *)snowColor
372 | {
373 | return SXRGB16Color(0xFFFAFA);
374 | }
375 | /** 亚麻色*/
376 | + (UIColor *)linenColor
377 | {
378 | return SXRGB16Color(0xFAF0E6);
379 | }
380 | /** 花之白*/
381 | + (UIColor *)floralWhite
382 | {
383 | return SXRGB16Color(0xFFFAF0);
384 | }
385 | /** 老饰带*/
386 | + (UIColor *)oldLace
387 | {
388 | return SXRGB16Color(0xFDF5E6);
389 | }
390 | /** 象牙白*/
391 | + (UIColor *)ivoryColor
392 | {
393 | return SXRGB16Color(0xFFFFF0);
394 | }
395 | /** 蜂蜜露*/
396 | + (UIColor *)honeydew
397 | {
398 | return SXRGB16Color(0xF0FFF0);
399 | }
400 | /** 薄荷奶油*/
401 | + (UIColor *)mintCream
402 | {
403 | return SXRGB16Color(0xF5FFFA);
404 | }
405 | /** 蔚蓝色*/
406 | + (UIColor *)azureColor
407 | {
408 | return SXRGB16Color(0xF0FFFF);
409 | }
410 | /** 爱丽丝蓝*/
411 | + (UIColor *)aliceBlue
412 | {
413 | return SXRGB16Color(0xF0F8FF);
414 | }
415 | /** 幽灵白*/
416 | + (UIColor *)ghostWhite
417 | {
418 | return SXRGB16Color(0xF8F8FF);
419 | }
420 | /** 淡紫红*/
421 | + (UIColor *)lavenderBlush
422 | {
423 | return SXRGB16Color(0xFFF0F5);
424 | }
425 | /** 米色*/
426 | + (UIColor *)beigeColor
427 | {
428 | return SXRGB16Color(0xF5F5DD);
429 | }
430 |
431 |
432 | #pragma mark - **************** 棕色系
433 | /** 黄褐色*/
434 | + (UIColor *)tanColor
435 | {
436 | return SXRGB16Color(0xD2B48C);
437 | }
438 | /** 玫瑰棕色*/
439 | + (UIColor *)rosyBrown
440 | {
441 | return SXRGB16Color(0xBC8F8F);
442 | }
443 | /** 秘鲁*/
444 | + (UIColor *)peruColor
445 | {
446 | return SXRGB16Color(0xCD853F);
447 | }
448 | /** 巧克力*/
449 | + (UIColor *)chocolateColor
450 | {
451 | return SXRGB16Color(0xD2691E);
452 | }
453 | /** 古铜色*/
454 | + (UIColor *)bronzeColor // $$$$$
455 | {
456 | return SXRGB16Color(0xB87333);
457 | }
458 | /** 黄土赭色*/
459 | + (UIColor *)siennaColor
460 | {
461 | return SXRGB16Color(0xA0522D);
462 | }
463 | /** 马鞍棕色*/
464 | + (UIColor *)saddleBrown
465 | {
466 | return SXRGB16Color(0x8B4513);
467 | }
468 | /** 土棕*/
469 | + (UIColor *)soilColor
470 | {
471 | return SXRGB16Color(0x734A12);
472 | }
473 | /** 栗色*/
474 | + (UIColor *)maroonColor
475 | {
476 | return SXRGB16Color(0x800000);
477 | }
478 | /** 乌贼墨棕*/
479 | + (UIColor *)inkfishBrown
480 | {
481 | return SXRGB16Color(0x5E2612);
482 | }
483 |
484 |
485 | #pragma mark - **************** 粉色系
486 | /** 水粉*/
487 | + (UIColor *)waterPink // $$$$$
488 | {
489 | return SXRGB16Color(0xF3D3E7);
490 | }
491 | /** 藕色*/
492 | + (UIColor *)lotusRoot // $$$$$
493 | {
494 | return SXRGB16Color(0xEDD1D8);
495 | }
496 | /** 浅粉红*/
497 | + (UIColor *)lightPink
498 | {
499 | return SXRGB16Color(0xFFB6C1);
500 | }
501 | /** 适中的粉红*/
502 | + (UIColor *)mediumPink
503 | {
504 | return SXRGB16Color(0xFFC0CB);
505 | }
506 | /** 桃红*/
507 | + (UIColor *)peachRed // $$$$$
508 | {
509 | return SXRGB16Color(0xF47983);
510 | }
511 | /** 苍白的紫罗兰红色*/
512 | + (UIColor *)paleVioletRed
513 | {
514 | return SXRGB16Color(0xDB7093);
515 | }
516 | /** 深粉色*/
517 | + (UIColor *)deepPink
518 | {
519 | return SXRGB16Color(0xFF1493);
520 | }
521 |
522 |
523 | @end
524 |
--------------------------------------------------------------------------------
/Wonderful/UIColor+Wonderful.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIColor+Wonderful.h
3 | // Wonderful
4 | //
5 | // Created by dongshangxian on 15/10/26.
6 | // Copyright © 2015年 Sankuai. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "UIColor+Separate.h"
11 |
12 | #define SXRGB16Color(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
13 | #define SXRGBAColor(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
14 |
15 | #define Wonderful_RedColor1 [UIColor mistyRose]
16 | #define Wonderful_RedColor2 [UIColor lightSalmon]
17 | #define Wonderful_RedColor3 [UIColor lightCoral]
18 | #define Wonderful_RedColor4 [UIColor salmonColor]
19 | #define Wonderful_RedColor5 [UIColor coralColor]
20 | #define Wonderful_RedColor6 [UIColor tomatoColor]
21 | #define Wonderful_RedColor7 [UIColor orangeRed]
22 | #define Wonderful_RedColor8 [UIColor indianRed]
23 | #define Wonderful_RedColor9 [UIColor crimsonColor]
24 | #define Wonderful_RedColor10 [UIColor fireBrick]
25 |
26 | #define Wonderful_YelloeColor1 [UIColor cornColor]
27 | #define Wonderful_YelloeColor2 [UIColor LemonChiffon]
28 | #define Wonderful_YelloeColor3 [UIColor paleGodenrod]
29 | #define Wonderful_YelloeColor4 [UIColor khakiColor]
30 | #define Wonderful_YelloeColor5 [UIColor goldColor]
31 | #define Wonderful_YelloeColor6 [UIColor orpimentColor]
32 | #define Wonderful_YelloeColor7 [UIColor gambogeColor]
33 | #define Wonderful_YelloeColor8 [UIColor realgarColor]
34 | #define Wonderful_YelloeColor9 [UIColor goldenrod]
35 | #define Wonderful_YelloeColor10 [UIColor darkGold]
36 |
37 | #define Wonderful_GreenColor1 [UIColor paleGreen]
38 | #define Wonderful_GreenColor2 [UIColor lightGreen]
39 | #define Wonderful_GreenColor3 [UIColor springGreen]
40 | #define Wonderful_GreenColor4 [UIColor greenYellow]
41 | #define Wonderful_GreenColor5 [UIColor lawnGreen]
42 | #define Wonderful_GreenColor6 [UIColor limeColor]
43 | #define Wonderful_GreenColor7 [UIColor forestGreen]
44 | #define Wonderful_GreenColor8 [UIColor seaGreen]
45 | #define Wonderful_GreenColor9 [UIColor darkGreen]
46 | #define Wonderful_GreenColor10 [UIColor olive]
47 |
48 | #define Wonderful_CyanColor1 [UIColor lightCyan]
49 | #define Wonderful_CyanColor2 [UIColor paleTurquoise]
50 | #define Wonderful_CyanColor3 [UIColor aquamarine]
51 | #define Wonderful_CyanColor4 [UIColor turquoise]
52 | #define Wonderful_CyanColor5 [UIColor mediumTurquoise]
53 | #define Wonderful_CyanColor6 [UIColor meituanColor]
54 | #define Wonderful_CyanColor7 [UIColor lightSeaGreen]
55 | #define Wonderful_CyanColor8 [UIColor darkCyan]
56 | #define Wonderful_CyanColor9 [UIColor tealColor]
57 | #define Wonderful_CyanColor10 [UIColor darkSlateGray]
58 |
59 | #define Wonderful_BlueColor1 [UIColor skyBlue]
60 | #define Wonderful_BlueColor2 [UIColor lightBLue]
61 | #define Wonderful_BlueColor3 [UIColor deepSkyBlue]
62 | #define Wonderful_BlueColor4 [UIColor doderBlue]
63 | #define Wonderful_BlueColor5 [UIColor cornflowerBlue]
64 | #define Wonderful_BlueColor6 [UIColor royalBlue]
65 | #define Wonderful_BlueColor7 [UIColor mediumBlue]
66 | #define Wonderful_BlueColor8 [UIColor darkBlue]
67 | #define Wonderful_BlueColor9 [UIColor navyColor]
68 | #define Wonderful_BlueColor10 [UIColor midnightBlue]
69 |
70 | #define Wonderful_PurpleColor1 [UIColor lavender]
71 | #define Wonderful_PurpleColor2 [UIColor thistleColor]
72 | #define Wonderful_PurpleColor3 [UIColor plumColor]
73 | #define Wonderful_PurpleColor4 [UIColor violetColor]
74 | #define Wonderful_PurpleColor5 [UIColor mediumOrchid]
75 | #define Wonderful_PurpleColor6 [UIColor darkOrchid]
76 | #define Wonderful_PurpleColor7 [UIColor darkVoilet]
77 | #define Wonderful_PurpleColor8 [UIColor blueViolet]
78 | #define Wonderful_PurpleColor9 [UIColor darkMagenta]
79 | #define Wonderful_PurpleColor10 [UIColor indigoColor]
80 |
81 | #define Wonderful_GrayColor1 [UIColor whiteSmoke]
82 | #define Wonderful_GrayColor2 [UIColor duckEgg]
83 | #define Wonderful_GrayColor3 [UIColor gainsboroColor]
84 | #define Wonderful_GrayColor4 [UIColor carapaceColor]
85 | #define Wonderful_GrayColor5 [UIColor silverColor]
86 | #define Wonderful_GrayColor6 [UIColor dimGray]
87 |
88 | #define Wonderful_WhiteColor1 [UIColor seaShell]
89 | #define Wonderful_WhiteColor2 [UIColor snowColor]
90 | #define Wonderful_WhiteColor3 [UIColor linenColor]
91 | #define Wonderful_WhiteColor4 [UIColor floralWhite]
92 | #define Wonderful_WhiteColor5 [UIColor oldLace]
93 | #define Wonderful_WhiteColor6 [UIColor ivoryColor]
94 | #define Wonderful_WhiteColor7 [UIColor honeydew]
95 | #define Wonderful_WhiteColor8 [UIColor mintCream]
96 | #define Wonderful_WhiteColor9 [UIColor azureColor]
97 | #define Wonderful_WhiteColor10 [UIColor aliceBlue]
98 | #define Wonderful_WhiteColor11 [UIColor ghostWhite]
99 | #define Wonderful_WhiteColor12 [UIColor lavenderBlush]
100 | #define Wonderful_WhiteColor13 [UIColor beigeColor]
101 |
102 | #define Wonderful_BrownColor1 [UIColor tanColor]
103 | #define Wonderful_BrownColor2 [UIColor rosyBrown]
104 | #define Wonderful_BrownColor3 [UIColor peruColor]
105 | #define Wonderful_BrownColor4 [UIColor chocolateColor]
106 | #define Wonderful_BrownColor5 [UIColor bronzeColor]
107 | #define Wonderful_BrownColor6 [UIColor siennaColor]
108 | #define Wonderful_BrownColor7 [UIColor saddleBrown]
109 | #define Wonderful_BrownColor8 [UIColor soilColor]
110 | #define Wonderful_BrownColor9 [UIColor maroonColor]
111 | #define Wonderful_BrownColor10 [UIColor inkfishBrown]
112 |
113 | #define Wonderful_PinkColor1 [UIColor waterPink]
114 | #define Wonderful_PinkColor2 [UIColor lotusRoot]
115 | #define Wonderful_PinkColor3 [UIColor lightPink]
116 | #define Wonderful_PinkColor4 [UIColor mediumPink]
117 | #define Wonderful_PinkColor5 [UIColor peachRed]
118 | #define Wonderful_PinkColor6 [UIColor paleVioletRed]
119 | #define Wonderful_PinkColor7 [UIColor deepPink]
120 |
121 | @interface UIColor (Wonderful)
122 |
123 | #pragma mark - **************** 红色系
124 | /** 薄雾玫瑰*/
125 | + (UIColor *)mistyRose;
126 | /** 浅鲑鱼色*/
127 | + (UIColor *)lightSalmon;
128 | /** 淡珊瑚色*/
129 | + (UIColor *)lightCoral;
130 | /** 鲑鱼色*/
131 | + (UIColor *)salmonColor;
132 | /** 珊瑚色*/
133 | + (UIColor *)coralColor;
134 | /** 番茄*/
135 | + (UIColor *)tomatoColor;
136 | /** 橙红色*/
137 | + (UIColor *)orangeRed;
138 | /** 印度红*/
139 | + (UIColor *)indianRed;
140 | /** 猩红*/
141 | + (UIColor *)crimsonColor;
142 | /** 耐火砖*/
143 | + (UIColor *)fireBrick;
144 |
145 | #pragma mark - **************** 黄色系
146 | /** 玉米色*/
147 | + (UIColor *)cornColor;
148 | /** 柠檬薄纱*/
149 | + (UIColor *)LemonChiffon;
150 | /** 苍金麒麟*/
151 | + (UIColor *)paleGodenrod;
152 | /** 卡其色*/
153 | + (UIColor *)khakiColor;
154 | /** 金色*/
155 | + (UIColor *)goldColor;
156 | /** 雌黄*/
157 | + (UIColor *)orpimentColor;
158 | /** 藤黄*/
159 | + (UIColor *)gambogeColor;
160 | /** 雄黄*/
161 | + (UIColor *)realgarColor;
162 | /** 金麒麟色*/
163 | + (UIColor *)goldenrod;
164 | /** 乌金*/
165 | + (UIColor *)darkGold;
166 |
167 | #pragma mark - **************** 绿色系
168 | /** 苍绿*/
169 | + (UIColor *)paleGreen;
170 | /** 淡绿色*/
171 | + (UIColor *)lightGreen;
172 | /** 春绿*/
173 | + (UIColor *)springGreen;
174 | /** 绿黄色*/
175 | + (UIColor *)greenYellow;
176 | /** 草坪绿*/
177 | + (UIColor *)lawnGreen;
178 | /** 酸橙绿*/
179 | + (UIColor *)limeColor;
180 | /** 森林绿*/
181 | + (UIColor *)forestGreen;
182 | /** 海洋绿*/
183 | + (UIColor *)seaGreen;
184 | /** 深绿*/
185 | + (UIColor *)darkGreen;
186 | /** 橄榄(墨绿)*/
187 | + (UIColor *)olive;
188 |
189 | #pragma mark - **************** 青色系
190 | /** 淡青色*/
191 | + (UIColor *)lightCyan;
192 | /** 苍白绿松石*/
193 | + (UIColor *)paleTurquoise;
194 | /** 绿碧*/
195 | + (UIColor *)aquamarine;
196 | /** 绿松石*/
197 | + (UIColor *)turquoise;
198 | /** 适中绿松石*/
199 | + (UIColor *)mediumTurquoise;
200 | /** 美团色*/
201 | + (UIColor *)meituanColor;
202 | /** 浅海洋绿*/
203 | + (UIColor *)lightSeaGreen;
204 | /** 深青色*/
205 | + (UIColor *)darkCyan;
206 | /** 水鸭色*/
207 | + (UIColor *)tealColor;
208 | /** 深石板灰*/
209 | + (UIColor *)darkSlateGray;
210 |
211 | #pragma mark - **************** 蓝色系
212 | /** 天蓝色*/
213 | + (UIColor *)skyBlue;
214 | /** 淡蓝*/
215 | + (UIColor *)lightBLue;
216 | /** 深天蓝*/
217 | + (UIColor *)deepSkyBlue;
218 | /** 道奇蓝*/
219 | + (UIColor *)doderBlue;
220 | /** 矢车菊*/
221 | + (UIColor *)cornflowerBlue;
222 | /** 皇家蓝*/
223 | + (UIColor *)royalBlue;
224 | /** 适中的蓝色*/
225 | + (UIColor *)mediumBlue;
226 | /** 深蓝*/
227 | + (UIColor *)darkBlue;
228 | /** 海军蓝*/
229 | + (UIColor *)navyColor;
230 | /** 午夜蓝*/
231 | + (UIColor *)midnightBlue;
232 |
233 | #pragma mark - **************** 紫色系
234 | /** 薰衣草*/
235 | + (UIColor *)lavender;
236 | /** 蓟*/
237 | + (UIColor *)thistleColor;
238 | /** 李子*/
239 | + (UIColor *)plumColor;
240 | /** 紫罗兰*/
241 | + (UIColor *)violetColor;
242 | /** 适中的兰花紫*/
243 | + (UIColor *)mediumOrchid;
244 | /** 深兰花紫*/
245 | + (UIColor *)darkOrchid;
246 | /** 深紫罗兰色*/
247 | + (UIColor *)darkVoilet;
248 | /** 泛蓝紫罗兰*/
249 | + (UIColor *)blueViolet;
250 | /** 深洋红色*/
251 | + (UIColor *)darkMagenta;
252 | /** 靛青*/
253 | + (UIColor *)indigoColor;
254 |
255 | #pragma mark - **************** 灰色系
256 | /** 白烟*/
257 | + (UIColor *)whiteSmoke;
258 | /** 鸭蛋*/
259 | + (UIColor *)duckEgg;
260 | /** 亮灰*/
261 | + (UIColor *)gainsboroColor;
262 | /** 蟹壳青*/
263 | + (UIColor *)carapaceColor;
264 | /** 银白色*/
265 | + (UIColor *)silverColor;
266 | /** 暗淡的灰色*/
267 | + (UIColor *)dimGray;
268 |
269 | #pragma mark - **************** 白色系
270 | /** 海贝壳*/
271 | + (UIColor *)seaShell;
272 | /** 雪*/
273 | + (UIColor *)snowColor;
274 | /** 亚麻色*/
275 | + (UIColor *)linenColor;
276 | /** 花之白*/
277 | + (UIColor *)floralWhite;
278 | /** 老饰带*/
279 | + (UIColor *)oldLace;
280 | /** 象牙白*/
281 | + (UIColor *)ivoryColor;
282 | /** 蜂蜜露*/
283 | + (UIColor *)honeydew;
284 | /** 薄荷奶油*/
285 | + (UIColor *)mintCream;
286 | /** 蔚蓝色*/
287 | + (UIColor *)azureColor;
288 | /** 爱丽丝蓝*/
289 | + (UIColor *)aliceBlue;
290 | /** 幽灵白*/
291 | + (UIColor *)ghostWhite;
292 | /** 淡紫红*/
293 | + (UIColor *)lavenderBlush;
294 | /** 米色*/
295 | + (UIColor *)beigeColor;
296 |
297 | #pragma mark - **************** 棕色系
298 | /** 黄褐色*/
299 | + (UIColor *)tanColor;
300 | /** 玫瑰棕色*/
301 | + (UIColor *)rosyBrown;
302 | /** 秘鲁*/
303 | + (UIColor *)peruColor;
304 | /** 巧克力*/
305 | + (UIColor *)chocolateColor;
306 | /** 古铜色*/
307 | + (UIColor *)bronzeColor;
308 | /** 黄土赭色*/
309 | + (UIColor *)siennaColor;
310 | /** 马鞍棕色*/
311 | + (UIColor *)saddleBrown;
312 | /** 土棕*/
313 | + (UIColor *)soilColor;
314 | /** 栗色*/
315 | + (UIColor *)maroonColor;
316 | /** 乌贼墨棕*/
317 | + (UIColor *)inkfishBrown;
318 |
319 | #pragma mark - **************** 粉色系
320 | /** 水粉*/
321 | + (UIColor *)waterPink;
322 | /** 藕色*/
323 | + (UIColor *)lotusRoot;
324 | /** 浅粉红*/
325 | + (UIColor *)lightPink;
326 | /** 适中的粉红*/
327 | + (UIColor *)mediumPink;
328 | /** 桃红*/
329 | + (UIColor *)peachRed;
330 | /** 苍白的紫罗兰红色*/
331 | + (UIColor *)paleVioletRed;
332 | /** 深粉色*/
333 | + (UIColor *)deepPink;
334 |
335 | @end
336 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1D2E43E01C3273C30002B63B /* SXColorGradientView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43D71C3273C30002B63B /* SXColorGradientView.m */; };
11 | 1D2E43E11C3273C30002B63B /* SXColorLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43D91C3273C30002B63B /* SXColorLabel.m */; };
12 | 1D2E43E21C3273C30002B63B /* SXMarquee.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43DB1C3273C30002B63B /* SXMarquee.m */; };
13 | 1D2E43E31C3273C30002B63B /* UIColor+Separate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43DD1C3273C30002B63B /* UIColor+Separate.m */; };
14 | 1D2E43E41C3273C30002B63B /* UIColor+Wonderful.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43DF1C3273C30002B63B /* UIColor+Wonderful.m */; };
15 | 1D2E43F41C3275040002B63B /* SXColorGradientDemoPage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43E71C3275040002B63B /* SXColorGradientDemoPage.m */; };
16 | 1D2E43F51C3275040002B63B /* SXColorLblDemoPage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43E91C3275040002B63B /* SXColorLblDemoPage.m */; };
17 | 1D2E43F61C3275040002B63B /* SXColorListPage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43EB1C3275040002B63B /* SXColorListPage.m */; };
18 | 1D2E43F71C3275040002B63B /* SXColorSeparateDemoPage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43ED1C3275040002B63B /* SXColorSeparateDemoPage.m */; };
19 | 1D2E43F81C3275040002B63B /* SXColorWonderfulDemoPage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43EF1C3275040002B63B /* SXColorWonderfulDemoPage.m */; };
20 | 1D2E43F91C3275040002B63B /* SXMainDemoPage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43F11C3275040002B63B /* SXMainDemoPage.m */; };
21 | 1D2E43FA1C3275040002B63B /* SXMarqueeDemoPage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43F31C3275040002B63B /* SXMarqueeDemoPage.m */; };
22 | 1D2E44041C32751A0002B63B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43FD1C32751A0002B63B /* AppDelegate.m */; };
23 | 1D2E44051C32751A0002B63B /* SXCLEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E43FF1C32751A0002B63B /* SXCLEntity.m */; };
24 | 1D2E44061C32751A0002B63B /* SXColorListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E44011C32751A0002B63B /* SXColorListCell.m */; };
25 | 1D2E44071C32751A0002B63B /* SXDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2E44031C32751A0002B63B /* SXDataSource.m */; };
26 | 1D723B031C755EA80079701D /* SXHeadLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D723B021C755EA80079701D /* SXHeadLine.m */; };
27 | 1DCCF4801BDE214900DB5EB7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DCCF47F1BDE214900DB5EB7 /* main.m */; };
28 | 1DCCF4891BDE214900DB5EB7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1DCCF4871BDE214900DB5EB7 /* Main.storyboard */; };
29 | 1DCCF48B1BDE214900DB5EB7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1DCCF48A1BDE214900DB5EB7 /* Assets.xcassets */; };
30 | 1DCCF48E1BDE214900DB5EB7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1DCCF48C1BDE214900DB5EB7 /* LaunchScreen.storyboard */; };
31 | 1DCF20121C3E6D0C0082716E /* UILabel+Wonderful.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DCF20111C3E6D0C0082716E /* UILabel+Wonderful.m */; };
32 | /* End PBXBuildFile section */
33 |
34 | /* Begin PBXFileReference section */
35 | 1D2E43D61C3273C30002B63B /* SXColorGradientView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXColorGradientView.h; sourceTree = ""; };
36 | 1D2E43D71C3273C30002B63B /* SXColorGradientView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXColorGradientView.m; sourceTree = ""; };
37 | 1D2E43D81C3273C30002B63B /* SXColorLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXColorLabel.h; sourceTree = ""; };
38 | 1D2E43D91C3273C30002B63B /* SXColorLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXColorLabel.m; sourceTree = ""; };
39 | 1D2E43DA1C3273C30002B63B /* SXMarquee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXMarquee.h; sourceTree = ""; };
40 | 1D2E43DB1C3273C30002B63B /* SXMarquee.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXMarquee.m; sourceTree = ""; };
41 | 1D2E43DC1C3273C30002B63B /* UIColor+Separate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Separate.h"; sourceTree = ""; };
42 | 1D2E43DD1C3273C30002B63B /* UIColor+Separate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Separate.m"; sourceTree = ""; };
43 | 1D2E43DE1C3273C30002B63B /* UIColor+Wonderful.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Wonderful.h"; sourceTree = ""; };
44 | 1D2E43DF1C3273C30002B63B /* UIColor+Wonderful.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Wonderful.m"; sourceTree = ""; };
45 | 1D2E43E61C3275040002B63B /* SXColorGradientDemoPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXColorGradientDemoPage.h; sourceTree = ""; };
46 | 1D2E43E71C3275040002B63B /* SXColorGradientDemoPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXColorGradientDemoPage.m; sourceTree = ""; };
47 | 1D2E43E81C3275040002B63B /* SXColorLblDemoPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXColorLblDemoPage.h; sourceTree = ""; };
48 | 1D2E43E91C3275040002B63B /* SXColorLblDemoPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXColorLblDemoPage.m; sourceTree = ""; };
49 | 1D2E43EA1C3275040002B63B /* SXColorListPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXColorListPage.h; sourceTree = ""; };
50 | 1D2E43EB1C3275040002B63B /* SXColorListPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXColorListPage.m; sourceTree = ""; };
51 | 1D2E43EC1C3275040002B63B /* SXColorSeparateDemoPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXColorSeparateDemoPage.h; sourceTree = ""; };
52 | 1D2E43ED1C3275040002B63B /* SXColorSeparateDemoPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXColorSeparateDemoPage.m; sourceTree = ""; };
53 | 1D2E43EE1C3275040002B63B /* SXColorWonderfulDemoPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXColorWonderfulDemoPage.h; sourceTree = ""; };
54 | 1D2E43EF1C3275040002B63B /* SXColorWonderfulDemoPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXColorWonderfulDemoPage.m; sourceTree = ""; };
55 | 1D2E43F01C3275040002B63B /* SXMainDemoPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXMainDemoPage.h; sourceTree = ""; };
56 | 1D2E43F11C3275040002B63B /* SXMainDemoPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXMainDemoPage.m; sourceTree = ""; };
57 | 1D2E43F21C3275040002B63B /* SXMarqueeDemoPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXMarqueeDemoPage.h; sourceTree = ""; };
58 | 1D2E43F31C3275040002B63B /* SXMarqueeDemoPage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXMarqueeDemoPage.m; sourceTree = ""; };
59 | 1D2E43FC1C32751A0002B63B /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
60 | 1D2E43FD1C32751A0002B63B /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
61 | 1D2E43FE1C32751A0002B63B /* SXCLEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXCLEntity.h; sourceTree = ""; };
62 | 1D2E43FF1C32751A0002B63B /* SXCLEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXCLEntity.m; sourceTree = ""; };
63 | 1D2E44001C32751A0002B63B /* SXColorListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXColorListCell.h; sourceTree = ""; };
64 | 1D2E44011C32751A0002B63B /* SXColorListCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXColorListCell.m; sourceTree = ""; };
65 | 1D2E44021C32751A0002B63B /* SXDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXDataSource.h; sourceTree = ""; };
66 | 1D2E44031C32751A0002B63B /* SXDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXDataSource.m; sourceTree = ""; };
67 | 1D723B011C755EA80079701D /* SXHeadLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SXHeadLine.h; sourceTree = ""; };
68 | 1D723B021C755EA80079701D /* SXHeadLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SXHeadLine.m; sourceTree = ""; };
69 | 1DCCF47B1BDE214900DB5EB7 /* Wonderful.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Wonderful.app; sourceTree = BUILT_PRODUCTS_DIR; };
70 | 1DCCF47F1BDE214900DB5EB7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
71 | 1DCCF4881BDE214900DB5EB7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
72 | 1DCCF48A1BDE214900DB5EB7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
73 | 1DCCF48D1BDE214900DB5EB7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
74 | 1DCCF48F1BDE214900DB5EB7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
75 | 1DCF20101C3E6D0C0082716E /* UILabel+Wonderful.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+Wonderful.h"; sourceTree = ""; };
76 | 1DCF20111C3E6D0C0082716E /* UILabel+Wonderful.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+Wonderful.m"; sourceTree = ""; };
77 | /* End PBXFileReference section */
78 |
79 | /* Begin PBXFrameworksBuildPhase section */
80 | 1DCCF4781BDE214900DB5EB7 /* Frameworks */ = {
81 | isa = PBXFrameworksBuildPhase;
82 | buildActionMask = 2147483647;
83 | files = (
84 | );
85 | runOnlyForDeploymentPostprocessing = 0;
86 | };
87 | /* End PBXFrameworksBuildPhase section */
88 |
89 | /* Begin PBXGroup section */
90 | 1D2E43D51C3273C30002B63B /* Wonderful */ = {
91 | isa = PBXGroup;
92 | children = (
93 | 1D2E43D61C3273C30002B63B /* SXColorGradientView.h */,
94 | 1D2E43D71C3273C30002B63B /* SXColorGradientView.m */,
95 | 1D2E43D81C3273C30002B63B /* SXColorLabel.h */,
96 | 1D2E43D91C3273C30002B63B /* SXColorLabel.m */,
97 | 1DCF20101C3E6D0C0082716E /* UILabel+Wonderful.h */,
98 | 1DCF20111C3E6D0C0082716E /* UILabel+Wonderful.m */,
99 | 1D2E43DA1C3273C30002B63B /* SXMarquee.h */,
100 | 1D2E43DB1C3273C30002B63B /* SXMarquee.m */,
101 | 1D723B011C755EA80079701D /* SXHeadLine.h */,
102 | 1D723B021C755EA80079701D /* SXHeadLine.m */,
103 | 1D2E43DC1C3273C30002B63B /* UIColor+Separate.h */,
104 | 1D2E43DD1C3273C30002B63B /* UIColor+Separate.m */,
105 | 1D2E43DE1C3273C30002B63B /* UIColor+Wonderful.h */,
106 | 1D2E43DF1C3273C30002B63B /* UIColor+Wonderful.m */,
107 | );
108 | name = Wonderful;
109 | path = ../../Wonderful;
110 | sourceTree = "";
111 | };
112 | 1D2E43E51C3275040002B63B /* Page */ = {
113 | isa = PBXGroup;
114 | children = (
115 | 1D2E43E61C3275040002B63B /* SXColorGradientDemoPage.h */,
116 | 1D2E43E71C3275040002B63B /* SXColorGradientDemoPage.m */,
117 | 1D2E43E81C3275040002B63B /* SXColorLblDemoPage.h */,
118 | 1D2E43E91C3275040002B63B /* SXColorLblDemoPage.m */,
119 | 1D2E43EA1C3275040002B63B /* SXColorListPage.h */,
120 | 1D2E43EB1C3275040002B63B /* SXColorListPage.m */,
121 | 1D2E43EC1C3275040002B63B /* SXColorSeparateDemoPage.h */,
122 | 1D2E43ED1C3275040002B63B /* SXColorSeparateDemoPage.m */,
123 | 1D2E43EE1C3275040002B63B /* SXColorWonderfulDemoPage.h */,
124 | 1D2E43EF1C3275040002B63B /* SXColorWonderfulDemoPage.m */,
125 | 1D2E43F01C3275040002B63B /* SXMainDemoPage.h */,
126 | 1D2E43F11C3275040002B63B /* SXMainDemoPage.m */,
127 | 1D2E43F21C3275040002B63B /* SXMarqueeDemoPage.h */,
128 | 1D2E43F31C3275040002B63B /* SXMarqueeDemoPage.m */,
129 | );
130 | path = Page;
131 | sourceTree = "";
132 | };
133 | 1D2E43FB1C32751A0002B63B /* Other */ = {
134 | isa = PBXGroup;
135 | children = (
136 | 1D2E43FC1C32751A0002B63B /* AppDelegate.h */,
137 | 1D2E43FD1C32751A0002B63B /* AppDelegate.m */,
138 | 1D2E43FE1C32751A0002B63B /* SXCLEntity.h */,
139 | 1D2E43FF1C32751A0002B63B /* SXCLEntity.m */,
140 | 1D2E44001C32751A0002B63B /* SXColorListCell.h */,
141 | 1D2E44011C32751A0002B63B /* SXColorListCell.m */,
142 | 1D2E44021C32751A0002B63B /* SXDataSource.h */,
143 | 1D2E44031C32751A0002B63B /* SXDataSource.m */,
144 | );
145 | path = Other;
146 | sourceTree = "";
147 | };
148 | 1DCCF4721BDE214900DB5EB7 = {
149 | isa = PBXGroup;
150 | children = (
151 | 1DCCF47D1BDE214900DB5EB7 /* Wonderful */,
152 | 1DCCF47C1BDE214900DB5EB7 /* Products */,
153 | );
154 | sourceTree = "";
155 | };
156 | 1DCCF47C1BDE214900DB5EB7 /* Products */ = {
157 | isa = PBXGroup;
158 | children = (
159 | 1DCCF47B1BDE214900DB5EB7 /* Wonderful.app */,
160 | );
161 | name = Products;
162 | sourceTree = "";
163 | };
164 | 1DCCF47D1BDE214900DB5EB7 /* Wonderful */ = {
165 | isa = PBXGroup;
166 | children = (
167 | 1D2E43D51C3273C30002B63B /* Wonderful */,
168 | 1D2E43E51C3275040002B63B /* Page */,
169 | 1D2E43FB1C32751A0002B63B /* Other */,
170 | 1DCCF4871BDE214900DB5EB7 /* Main.storyboard */,
171 | 1DCCF48A1BDE214900DB5EB7 /* Assets.xcassets */,
172 | 1DCCF48C1BDE214900DB5EB7 /* LaunchScreen.storyboard */,
173 | 1DCCF48F1BDE214900DB5EB7 /* Info.plist */,
174 | 1DCCF47E1BDE214900DB5EB7 /* Supporting Files */,
175 | );
176 | path = Wonderful;
177 | sourceTree = "";
178 | };
179 | 1DCCF47E1BDE214900DB5EB7 /* Supporting Files */ = {
180 | isa = PBXGroup;
181 | children = (
182 | 1DCCF47F1BDE214900DB5EB7 /* main.m */,
183 | );
184 | name = "Supporting Files";
185 | sourceTree = "";
186 | };
187 | /* End PBXGroup section */
188 |
189 | /* Begin PBXNativeTarget section */
190 | 1DCCF47A1BDE214900DB5EB7 /* Wonderful */ = {
191 | isa = PBXNativeTarget;
192 | buildConfigurationList = 1DCCF4921BDE214900DB5EB7 /* Build configuration list for PBXNativeTarget "Wonderful" */;
193 | buildPhases = (
194 | 1DCCF4771BDE214900DB5EB7 /* Sources */,
195 | 1DCCF4781BDE214900DB5EB7 /* Frameworks */,
196 | 1DCCF4791BDE214900DB5EB7 /* Resources */,
197 | );
198 | buildRules = (
199 | );
200 | dependencies = (
201 | );
202 | name = Wonderful;
203 | productName = Wonderful;
204 | productReference = 1DCCF47B1BDE214900DB5EB7 /* Wonderful.app */;
205 | productType = "com.apple.product-type.application";
206 | };
207 | /* End PBXNativeTarget section */
208 |
209 | /* Begin PBXProject section */
210 | 1DCCF4731BDE214900DB5EB7 /* Project object */ = {
211 | isa = PBXProject;
212 | attributes = {
213 | CLASSPREFIX = SX;
214 | LastUpgradeCheck = 0700;
215 | ORGANIZATIONNAME = Sankuai;
216 | TargetAttributes = {
217 | 1DCCF47A1BDE214900DB5EB7 = {
218 | CreatedOnToolsVersion = 7.0;
219 | DevelopmentTeam = 4HW3B6PMKD;
220 | ProvisioningStyle = Manual;
221 | };
222 | };
223 | };
224 | buildConfigurationList = 1DCCF4761BDE214900DB5EB7 /* Build configuration list for PBXProject "Wonderful" */;
225 | compatibilityVersion = "Xcode 3.2";
226 | developmentRegion = English;
227 | hasScannedForEncodings = 0;
228 | knownRegions = (
229 | en,
230 | Base,
231 | );
232 | mainGroup = 1DCCF4721BDE214900DB5EB7;
233 | productRefGroup = 1DCCF47C1BDE214900DB5EB7 /* Products */;
234 | projectDirPath = "";
235 | projectRoot = "";
236 | targets = (
237 | 1DCCF47A1BDE214900DB5EB7 /* Wonderful */,
238 | );
239 | };
240 | /* End PBXProject section */
241 |
242 | /* Begin PBXResourcesBuildPhase section */
243 | 1DCCF4791BDE214900DB5EB7 /* Resources */ = {
244 | isa = PBXResourcesBuildPhase;
245 | buildActionMask = 2147483647;
246 | files = (
247 | 1DCCF48E1BDE214900DB5EB7 /* LaunchScreen.storyboard in Resources */,
248 | 1DCCF48B1BDE214900DB5EB7 /* Assets.xcassets in Resources */,
249 | 1DCCF4891BDE214900DB5EB7 /* Main.storyboard in Resources */,
250 | );
251 | runOnlyForDeploymentPostprocessing = 0;
252 | };
253 | /* End PBXResourcesBuildPhase section */
254 |
255 | /* Begin PBXSourcesBuildPhase section */
256 | 1DCCF4771BDE214900DB5EB7 /* Sources */ = {
257 | isa = PBXSourcesBuildPhase;
258 | buildActionMask = 2147483647;
259 | files = (
260 | 1D2E43E41C3273C30002B63B /* UIColor+Wonderful.m in Sources */,
261 | 1D2E43E01C3273C30002B63B /* SXColorGradientView.m in Sources */,
262 | 1D2E44061C32751A0002B63B /* SXColorListCell.m in Sources */,
263 | 1D2E43F41C3275040002B63B /* SXColorGradientDemoPage.m in Sources */,
264 | 1D2E43FA1C3275040002B63B /* SXMarqueeDemoPage.m in Sources */,
265 | 1DCCF4801BDE214900DB5EB7 /* main.m in Sources */,
266 | 1D2E43E11C3273C30002B63B /* SXColorLabel.m in Sources */,
267 | 1D2E44041C32751A0002B63B /* AppDelegate.m in Sources */,
268 | 1D2E43F81C3275040002B63B /* SXColorWonderfulDemoPage.m in Sources */,
269 | 1D2E43F61C3275040002B63B /* SXColorListPage.m in Sources */,
270 | 1D2E44051C32751A0002B63B /* SXCLEntity.m in Sources */,
271 | 1D723B031C755EA80079701D /* SXHeadLine.m in Sources */,
272 | 1DCF20121C3E6D0C0082716E /* UILabel+Wonderful.m in Sources */,
273 | 1D2E43E31C3273C30002B63B /* UIColor+Separate.m in Sources */,
274 | 1D2E43F51C3275040002B63B /* SXColorLblDemoPage.m in Sources */,
275 | 1D2E44071C32751A0002B63B /* SXDataSource.m in Sources */,
276 | 1D2E43E21C3273C30002B63B /* SXMarquee.m in Sources */,
277 | 1D2E43F91C3275040002B63B /* SXMainDemoPage.m in Sources */,
278 | 1D2E43F71C3275040002B63B /* SXColorSeparateDemoPage.m in Sources */,
279 | );
280 | runOnlyForDeploymentPostprocessing = 0;
281 | };
282 | /* End PBXSourcesBuildPhase section */
283 |
284 | /* Begin PBXVariantGroup section */
285 | 1DCCF4871BDE214900DB5EB7 /* Main.storyboard */ = {
286 | isa = PBXVariantGroup;
287 | children = (
288 | 1DCCF4881BDE214900DB5EB7 /* Base */,
289 | );
290 | name = Main.storyboard;
291 | sourceTree = "";
292 | };
293 | 1DCCF48C1BDE214900DB5EB7 /* LaunchScreen.storyboard */ = {
294 | isa = PBXVariantGroup;
295 | children = (
296 | 1DCCF48D1BDE214900DB5EB7 /* Base */,
297 | );
298 | name = LaunchScreen.storyboard;
299 | sourceTree = "";
300 | };
301 | /* End PBXVariantGroup section */
302 |
303 | /* Begin XCBuildConfiguration section */
304 | 1DCCF4901BDE214900DB5EB7 /* Debug */ = {
305 | isa = XCBuildConfiguration;
306 | buildSettings = {
307 | ALWAYS_SEARCH_USER_PATHS = NO;
308 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
309 | CLANG_CXX_LIBRARY = "libc++";
310 | CLANG_ENABLE_MODULES = YES;
311 | CLANG_ENABLE_OBJC_ARC = YES;
312 | CLANG_WARN_BOOL_CONVERSION = YES;
313 | CLANG_WARN_CONSTANT_CONVERSION = YES;
314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
315 | CLANG_WARN_EMPTY_BODY = YES;
316 | CLANG_WARN_ENUM_CONVERSION = YES;
317 | CLANG_WARN_INT_CONVERSION = YES;
318 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
319 | CLANG_WARN_UNREACHABLE_CODE = YES;
320 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
321 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
322 | COPY_PHASE_STRIP = NO;
323 | DEBUG_INFORMATION_FORMAT = dwarf;
324 | ENABLE_STRICT_OBJC_MSGSEND = YES;
325 | ENABLE_TESTABILITY = YES;
326 | GCC_C_LANGUAGE_STANDARD = gnu99;
327 | GCC_DYNAMIC_NO_PIC = NO;
328 | GCC_NO_COMMON_BLOCKS = YES;
329 | GCC_OPTIMIZATION_LEVEL = 0;
330 | GCC_PREPROCESSOR_DEFINITIONS = (
331 | "DEBUG=1",
332 | "$(inherited)",
333 | );
334 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
335 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
336 | GCC_WARN_UNDECLARED_SELECTOR = YES;
337 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
338 | GCC_WARN_UNUSED_FUNCTION = YES;
339 | GCC_WARN_UNUSED_VARIABLE = YES;
340 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
341 | MTL_ENABLE_DEBUG_INFO = YES;
342 | ONLY_ACTIVE_ARCH = YES;
343 | SDKROOT = iphoneos;
344 | TARGETED_DEVICE_FAMILY = "1,2";
345 | };
346 | name = Debug;
347 | };
348 | 1DCCF4911BDE214900DB5EB7 /* Release */ = {
349 | isa = XCBuildConfiguration;
350 | buildSettings = {
351 | ALWAYS_SEARCH_USER_PATHS = NO;
352 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
353 | CLANG_CXX_LIBRARY = "libc++";
354 | CLANG_ENABLE_MODULES = YES;
355 | CLANG_ENABLE_OBJC_ARC = YES;
356 | CLANG_WARN_BOOL_CONVERSION = YES;
357 | CLANG_WARN_CONSTANT_CONVERSION = YES;
358 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
359 | CLANG_WARN_EMPTY_BODY = YES;
360 | CLANG_WARN_ENUM_CONVERSION = YES;
361 | CLANG_WARN_INT_CONVERSION = YES;
362 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
363 | CLANG_WARN_UNREACHABLE_CODE = YES;
364 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
365 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
366 | COPY_PHASE_STRIP = NO;
367 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
368 | ENABLE_NS_ASSERTIONS = NO;
369 | ENABLE_STRICT_OBJC_MSGSEND = YES;
370 | GCC_C_LANGUAGE_STANDARD = gnu99;
371 | GCC_NO_COMMON_BLOCKS = YES;
372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
374 | GCC_WARN_UNDECLARED_SELECTOR = YES;
375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
376 | GCC_WARN_UNUSED_FUNCTION = YES;
377 | GCC_WARN_UNUSED_VARIABLE = YES;
378 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
379 | MTL_ENABLE_DEBUG_INFO = NO;
380 | SDKROOT = iphoneos;
381 | TARGETED_DEVICE_FAMILY = "1,2";
382 | VALIDATE_PRODUCT = YES;
383 | };
384 | name = Release;
385 | };
386 | 1DCCF4931BDE214900DB5EB7 /* Debug */ = {
387 | isa = XCBuildConfiguration;
388 | buildSettings = {
389 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
390 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "Brand Assets";
391 | CODE_SIGN_IDENTITY = "iPhone Developer";
392 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
393 | DEVELOPMENT_TEAM = 4HW3B6PMKD;
394 | INFOPLIST_FILE = Wonderful/Info.plist;
395 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
396 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
397 | PRODUCT_BUNDLE_IDENTIFIER = com.Sankuai.Wonderful;
398 | PRODUCT_NAME = "$(TARGET_NAME)";
399 | PROVISIONING_PROFILE = "b257564f-9d82-4034-87a3-18a0d4029e73";
400 | PROVISIONING_PROFILE_SPECIFIER = ios_development_sunli;
401 | };
402 | name = Debug;
403 | };
404 | 1DCCF4941BDE214900DB5EB7 /* Release */ = {
405 | isa = XCBuildConfiguration;
406 | buildSettings = {
407 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
408 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "Brand Assets";
409 | CODE_SIGN_IDENTITY = "iPhone Developer";
410 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
411 | DEVELOPMENT_TEAM = "";
412 | INFOPLIST_FILE = Wonderful/Info.plist;
413 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
414 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
415 | PRODUCT_BUNDLE_IDENTIFIER = com.Sankuai.Wonderful;
416 | PRODUCT_NAME = "$(TARGET_NAME)";
417 | PROVISIONING_PROFILE = "";
418 | };
419 | name = Release;
420 | };
421 | /* End XCBuildConfiguration section */
422 |
423 | /* Begin XCConfigurationList section */
424 | 1DCCF4761BDE214900DB5EB7 /* Build configuration list for PBXProject "Wonderful" */ = {
425 | isa = XCConfigurationList;
426 | buildConfigurations = (
427 | 1DCCF4901BDE214900DB5EB7 /* Debug */,
428 | 1DCCF4911BDE214900DB5EB7 /* Release */,
429 | );
430 | defaultConfigurationIsVisible = 0;
431 | defaultConfigurationName = Release;
432 | };
433 | 1DCCF4921BDE214900DB5EB7 /* Build configuration list for PBXNativeTarget "Wonderful" */ = {
434 | isa = XCConfigurationList;
435 | buildConfigurations = (
436 | 1DCCF4931BDE214900DB5EB7 /* Debug */,
437 | 1DCCF4941BDE214900DB5EB7 /* Release */,
438 | );
439 | defaultConfigurationIsVisible = 0;
440 | defaultConfigurationName = Release;
441 | };
442 | /* End XCConfigurationList section */
443 | };
444 | rootObject = 1DCCF4731BDE214900DB5EB7 /* Project object */;
445 | }
446 |
--------------------------------------------------------------------------------
/WonderfulDemo/Wonderful/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 |
39 |
46 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
75 |
83 |
91 |
99 |
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 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
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 |
231 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
335 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
378 |
379 |
380 |
381 |
382 |
383 |
400 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
438 |
446 |
454 |
462 |
479 |
486 |
494 |
502 |
509 |
510 |
511 |
512 |
513 |
514 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
561 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
--------------------------------------------------------------------------------