├── timeLineGif.gif
├── CCTimeLine
├── Resources
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ ├── AppIcon.appiconset
│ │ │ ├── iconD@2x.png
│ │ │ ├── iconD@3x.png
│ │ │ ├── iconD40@2x.png
│ │ │ ├── iconD@2x-1.png
│ │ │ └── Contents.json
│ │ ├── LaunchImage.launchimage
│ │ │ ├── 375@2x.jpg
│ │ │ ├── 414@3x.jpg
│ │ │ └── Contents.json
│ │ ├── share_dig.imageset
│ │ │ ├── share_dig@2x.png
│ │ │ ├── share_dig@3x.png
│ │ │ └── Contents.json
│ │ ├── express_up.imageset
│ │ │ ├── express_up@2x.png
│ │ │ ├── express_up@3x.png
│ │ │ └── Contents.json
│ │ ├── express_down.imageset
│ │ │ ├── express_down@2x.png
│ │ │ ├── express_down@3x.png
│ │ │ └── Contents.json
│ │ ├── express_bad_normal.imageset
│ │ │ ├── express_bad_normal@2x.png
│ │ │ ├── express_bad_normal@3x.png
│ │ │ └── Contents.json
│ │ ├── express_good_normal.imageset
│ │ │ ├── express_good_normal@2x.png
│ │ │ ├── express_good_normal@3x.png
│ │ │ └── Contents.json
│ │ ├── express_bad_selected.imageset
│ │ │ ├── express_bad_selected@2x.png
│ │ │ ├── express_bad_selected@3x.png
│ │ │ └── Contents.json
│ │ └── express_good_selected.imageset
│ │ │ ├── express_good_selected@2x.png
│ │ │ ├── express_good_selected@3x.png
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ └── Main.storyboard
│ └── data.json
├── Third
│ ├── SVProgressHUD
│ │ ├── SVProgressHUD.bundle
│ │ │ ├── error.png
│ │ │ ├── info.png
│ │ │ ├── info@2x.png
│ │ │ ├── info@3x.png
│ │ │ ├── success.png
│ │ │ ├── angle-mask.png
│ │ │ ├── error@2x.png
│ │ │ ├── error@3x.png
│ │ │ ├── success@2x.png
│ │ │ ├── success@3x.png
│ │ │ ├── angle-mask@2x.png
│ │ │ └── angle-mask@3x.png
│ │ ├── SVRadialGradientLayer.h
│ │ ├── SVIndefiniteAnimatedView.h
│ │ ├── SVProgressAnimatedView.h
│ │ ├── SVRadialGradientLayer.m
│ │ ├── SVProgressAnimatedView.m
│ │ └── SVIndefiniteAnimatedView.m
│ ├── Masonry
│ │ ├── MASLayoutConstraint.m
│ │ ├── NSLayoutConstraint+MASDebugAdditions.h
│ │ ├── MASLayoutConstraint.h
│ │ ├── MASCompositeConstraint.h
│ │ ├── Masonry.h
│ │ ├── ViewController+MASAdditions.h
│ │ ├── NSArray+MASShorthandAdditions.h
│ │ ├── MASViewAttribute.m
│ │ ├── MASViewAttribute.h
│ │ ├── ViewController+MASAdditions.m
│ │ ├── MASViewConstraint.h
│ │ ├── MASConstraint+Private.h
│ │ ├── NSArray+MASAdditions.h
│ │ ├── View+MASAdditions.h
│ │ ├── View+MASShorthandAdditions.h
│ │ ├── MASCompositeConstraint.m
│ │ ├── MASConstraintMaker.h
│ │ ├── NSLayoutConstraint+MASDebugAdditions.m
│ │ ├── MASUtilities.h
│ │ ├── NSArray+MASAdditions.m
│ │ ├── View+MASAdditions.m
│ │ ├── MASConstraint.h
│ │ └── MASConstraint.m
│ ├── MJExtension
│ │ ├── MJFoundation.h
│ │ ├── MJExtension.h
│ │ ├── MJPropertyKey.h
│ │ ├── MJPropertyKey.m
│ │ ├── MJExtensionConst.m
│ │ ├── MJPropertyType.h
│ │ ├── NSObject+MJCoding.h
│ │ ├── NSString+MJExtension.h
│ │ ├── MJProperty.h
│ │ ├── MJFoundation.m
│ │ ├── NSObject+MJCoding.m
│ │ ├── MJPropertyType.m
│ │ ├── NSObject+MJClass.h
│ │ ├── MJExtensionConst.h
│ │ ├── NSObject+MJProperty.h
│ │ ├── NSString+MJExtension.m
│ │ ├── NSObject+MJClass.m
│ │ ├── MJProperty.m
│ │ ├── NSObject+MJKeyValue.h
│ │ └── NSObject+MJProperty.m
│ └── UITableView+FDTemplateLayoutCell
│ │ └── Classes
│ │ ├── UITableView+FDTemplateLayoutCellDebug.h
│ │ ├── UITableView+FDKeyedHeightCache.h
│ │ ├── UITableView+FDTemplateLayoutCellDebug.m
│ │ ├── UITableView+FDIndexPathHeightCache.h
│ │ ├── UITableView+FDKeyedHeightCache.m
│ │ └── UITableView+FDTemplateLayoutCell.h
├── Demo
│ ├── ViewController
│ │ ├── ViewController.h
│ │ └── ViewController.m
│ ├── Model
│ │ ├── CCModel.m
│ │ └── CCModel.h
│ └── View
│ │ └── CCContentCell.h
├── AppDelegate
│ ├── AppDelegate.h
│ └── AppDelegate.m
├── main.m
├── Info.plist
└── LaunchScreen.storyboard
├── README.md
└── CCTimeLine.xcodeproj
├── xcuserdata
└── ZXX.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ └── xcschememanagement.plist
└── project.xcworkspace
├── contents.xcworkspacedata
├── xcuserdata
└── ZXX.xcuserdatad
│ └── UserInterfaceState.xcuserstate
└── xcshareddata
└── IDEWorkspaceChecks.plist
/timeLineGif.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/timeLineGif.gif
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CCTimeLine
2 | 资讯时间轴,支持折叠和展开,支持踩赞
3 |
4 | 
5 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/error.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/info.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/info@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/info@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/info@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/info@3x.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/success.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/angle-mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/angle-mask.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/error@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/error@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/error@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/error@3x.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/success@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/success@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/success@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/success@3x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/AppIcon.appiconset/iconD@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/AppIcon.appiconset/iconD@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/AppIcon.appiconset/iconD@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/AppIcon.appiconset/iconD@3x.png
--------------------------------------------------------------------------------
/CCTimeLine.xcodeproj/xcuserdata/ZXX.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/AppIcon.appiconset/iconD40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/AppIcon.appiconset/iconD40@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/AppIcon.appiconset/iconD@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/AppIcon.appiconset/iconD@2x-1.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/LaunchImage.launchimage/375@2x.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/LaunchImage.launchimage/375@2x.jpg
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/LaunchImage.launchimage/414@3x.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/LaunchImage.launchimage/414@3x.jpg
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/angle-mask@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/angle-mask@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/angle-mask@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Third/SVProgressHUD/SVProgressHUD.bundle/angle-mask@3x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/share_dig.imageset/share_dig@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/share_dig.imageset/share_dig@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/share_dig.imageset/share_dig@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/share_dig.imageset/share_dig@3x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_up.imageset/express_up@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_up.imageset/express_up@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_up.imageset/express_up@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_up.imageset/express_up@3x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_down.imageset/express_down@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_down.imageset/express_down@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_down.imageset/express_down@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_down.imageset/express_down@3x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_bad_normal.imageset/express_bad_normal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_bad_normal.imageset/express_bad_normal@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_bad_normal.imageset/express_bad_normal@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_bad_normal.imageset/express_bad_normal@3x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_good_normal.imageset/express_good_normal@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_good_normal.imageset/express_good_normal@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_good_normal.imageset/express_good_normal@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_good_normal.imageset/express_good_normal@3x.png
--------------------------------------------------------------------------------
/CCTimeLine.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_bad_selected.imageset/express_bad_selected@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_bad_selected.imageset/express_bad_selected@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_bad_selected.imageset/express_bad_selected@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_bad_selected.imageset/express_bad_selected@3x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_good_selected.imageset/express_good_selected@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_good_selected.imageset/express_good_selected@2x.png
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_good_selected.imageset/express_good_selected@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine/Resources/Assets.xcassets/express_good_selected.imageset/express_good_selected@3x.png
--------------------------------------------------------------------------------
/CCTimeLine.xcodeproj/project.xcworkspace/xcuserdata/ZXX.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CCBrother/CCTimeLine/HEAD/CCTimeLine.xcodeproj/project.xcworkspace/xcuserdata/ZXX.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/CCTimeLine/Demo/ViewController/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // CCTimeLine
4 | //
5 | // Created by ZhangCc on 2018/8/6.
6 | // Copyright © 2018年 ZhangCc. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASLayoutConstraint.m:
--------------------------------------------------------------------------------
1 | //
2 | // MASLayoutConstraint.m
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 3/08/13.
6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved.
7 | //
8 |
9 | #import "MASLayoutConstraint.h"
10 |
11 | @implementation MASLayoutConstraint
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CCTimeLine.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJFoundation.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJFoundation.h
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 14/7/16.
6 | // Copyright (c) 2014年 小码哥. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface MJFoundation : NSObject
12 | + (BOOL)isClassFromFoundation:(Class)c;
13 | @end
14 |
--------------------------------------------------------------------------------
/CCTimeLine/AppDelegate/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // CCTimeLine
4 | //
5 | // Created by ZhangCc on 2018/8/6.
6 | // Copyright © 2018年 ZhangCc. 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 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVRadialGradientLayer.h:
--------------------------------------------------------------------------------
1 | //
2 | // SVRadialGradientLayer.h
3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
4 | //
5 | // Copyright (c) 2014-2018 Tobias Tiemerding. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | @interface SVRadialGradientLayer : CALayer
11 |
12 | @property (nonatomic) CGPoint gradientCenter;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/CCTimeLine/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // CCTimeLine
4 | //
5 | // Created by ZhangCc on 2018/8/6.
6 | // Copyright © 2018年 ZhangCc. 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 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/NSLayoutConstraint+MASDebugAdditions.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSLayoutConstraint+MASDebugAdditions.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 3/08/13.
6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved.
7 | //
8 |
9 | #import "MASUtilities.h"
10 |
11 | /**
12 | * makes debug and log output of NSLayoutConstraints more readable
13 | */
14 | @interface NSLayoutConstraint (MASDebugAdditions)
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/CCTimeLine/Demo/Model/CCModel.m:
--------------------------------------------------------------------------------
1 | //
2 | //Created by ESJsonFormatForMac on 18/08/06.
3 | //
4 |
5 | #import "CCModel.h"
6 | @implementation CCModel
7 |
8 | + (NSDictionary *)modelContainerPropertyGenericClass{
9 | return @{@"articleList" : [Article class]};
10 | }
11 |
12 |
13 | @end
14 |
15 | @implementation Article
16 |
17 |
18 | + (NSDictionary *)modelCustomPropertyMapper{
19 | return @{@"ID":@"id"};
20 | }
21 |
22 | @end
23 |
24 |
25 |
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/share_dig.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "share_dig@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "share_dig@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_up.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "express_up@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "express_up@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_down.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "express_down@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "express_down@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_bad_normal.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "express_bad_normal@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "express_bad_normal@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_good_normal.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "express_good_normal@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "express_good_normal@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVIndefiniteAnimatedView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SVIndefiniteAnimatedView.h
3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
4 | //
5 | // Copyright (c) 2014-2018 Guillaume Campagna. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | @interface SVIndefiniteAnimatedView : UIView
11 |
12 | @property (nonatomic, assign) CGFloat strokeThickness;
13 | @property (nonatomic, assign) CGFloat radius;
14 | @property (nonatomic, strong) UIColor *strokeColor;
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_bad_selected.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "express_bad_selected@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "express_bad_selected@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/express_good_selected.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "express_good_selected@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "filename" : "express_good_selected@3x.png",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressAnimatedView.h:
--------------------------------------------------------------------------------
1 | //
2 | // SVProgressAnimatedView.h
3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
4 | //
5 | // Copyright (c) 2017-2018 Tobias Tiemerding. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | @interface SVProgressAnimatedView : UIView
11 |
12 | @property (nonatomic, assign) CGFloat radius;
13 | @property (nonatomic, assign) CGFloat strokeThickness;
14 | @property (nonatomic, strong) UIColor *strokeColor;
15 | @property (nonatomic, assign) CGFloat strokeEnd;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJExtension.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJExtension.h
3 | // MJExtension
4 | //
5 | // Created by mj on 14-1-15.
6 | // Copyright (c) 2014年 小码哥. All rights reserved.
7 | // 代码地址:https://github.com/CoderMJLee/MJExtension
8 | // 代码地址:http://code4app.com/ios/%E5%AD%97%E5%85%B8-JSON-%E4%B8%8E%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%BD%AC%E6%8D%A2/5339992a933bf062608b4c57
9 |
10 | #import "NSObject+MJCoding.h"
11 | #import "NSObject+MJProperty.h"
12 | #import "NSObject+MJClass.h"
13 | #import "NSObject+MJKeyValue.h"
14 | #import "NSString+MJExtension.h"
15 | #import "MJExtensionConst.h"
--------------------------------------------------------------------------------
/CCTimeLine.xcodeproj/xcuserdata/ZXX.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | CCTimeLine.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | CCTimeLine.xcscheme_^#shared#^_
13 |
14 | orderHint
15 | 0
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASLayoutConstraint.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASLayoutConstraint.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 3/08/13.
6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved.
7 | //
8 |
9 | #import "MASUtilities.h"
10 |
11 | /**
12 | * When you are debugging or printing the constraints attached to a view this subclass
13 | * makes it easier to identify which constraints have been created via Masonry
14 | */
15 | @interface MASLayoutConstraint : NSLayoutConstraint
16 |
17 | /**
18 | * a key to associate with this constraint
19 | */
20 | @property (nonatomic, strong) id mas_key;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASCompositeConstraint.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASCompositeConstraint.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 21/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import "MASConstraint.h"
10 | #import "MASUtilities.h"
11 |
12 | /**
13 | * A group of MASConstraint objects
14 | */
15 | @interface MASCompositeConstraint : MASConstraint
16 |
17 | /**
18 | * Creates a composite with a predefined array of children
19 | *
20 | * @param children child MASConstraints
21 | *
22 | * @return a composite constraint
23 | */
24 | - (id)initWithChildren:(NSArray *)children;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJPropertyKey.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJPropertyKey.h
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/8/11.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef enum {
12 | MJPropertyKeyTypeDictionary = 0, // 字典的key
13 | MJPropertyKeyTypeArray // 数组的key
14 | } MJPropertyKeyType;
15 |
16 | /**
17 | * 属性的key
18 | */
19 | @interface MJPropertyKey : NSObject
20 | /** key的名字 */
21 | @property (copy, nonatomic) NSString *name;
22 | /** key的种类,可能是@"10",可能是@"age" */
23 | @property (assign, nonatomic) MJPropertyKeyType type;
24 |
25 | /**
26 | * 根据当前的key,也就是name,从object(字典或者数组)中取值
27 | */
28 | - (id)valueInObject:(id)object;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJPropertyKey.m:
--------------------------------------------------------------------------------
1 | //
2 | // MJPropertyKey.m
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/8/11.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJPropertyKey.h"
10 |
11 | @implementation MJPropertyKey
12 |
13 | - (id)valueInObject:(id)object
14 | {
15 | if ([object isKindOfClass:[NSDictionary class]] && self.type == MJPropertyKeyTypeDictionary) {
16 | return object[self.name];
17 | } else if ([object isKindOfClass:[NSArray class]] && self.type == MJPropertyKeyTypeArray) {
18 | NSArray *array = object;
19 | NSUInteger index = self.name.intValue;
20 | if (index < array.count) return array[index];
21 | return nil;
22 | }
23 | return nil;
24 | }
25 | @end
26 |
--------------------------------------------------------------------------------
/CCTimeLine/Demo/Model/CCModel.h:
--------------------------------------------------------------------------------
1 | //
2 | //Created by ESJsonFormatForMac on 18/08/06.
3 | //
4 |
5 | #import
6 |
7 | @class Article;
8 | @interface CCModel : NSObject
9 |
10 | @property (nonatomic, strong) NSArray *articleList;
11 |
12 | @end
13 | @interface Article : NSObject
14 |
15 | @property (nonatomic, copy) NSString *content;
16 |
17 | @property (nonatomic, copy) NSString *publishTime;
18 |
19 | @property (nonatomic, assign) NSInteger bearNum;
20 |
21 | @property (nonatomic, assign) NSInteger ID;
22 |
23 | @property (nonatomic, copy) NSString *title;
24 |
25 | @property (nonatomic, assign) NSInteger bullOrBear;
26 |
27 | @property (nonatomic, assign) NSInteger bullNum;
28 |
29 | @property (nonatomic, assign) BOOL isFolding;
30 |
31 | @end
32 |
33 |
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "11.0",
8 | "subtype" : "2436h",
9 | "scale" : "3x"
10 | },
11 | {
12 | "extent" : "full-screen",
13 | "idiom" : "iphone",
14 | "subtype" : "736h",
15 | "filename" : "414@3x.jpg",
16 | "minimum-system-version" : "8.0",
17 | "orientation" : "portrait",
18 | "scale" : "3x"
19 | },
20 | {
21 | "extent" : "full-screen",
22 | "idiom" : "iphone",
23 | "subtype" : "667h",
24 | "filename" : "375@2x.jpg",
25 | "minimum-system-version" : "8.0",
26 | "orientation" : "portrait",
27 | "scale" : "2x"
28 | }
29 | ],
30 | "info" : {
31 | "version" : 1,
32 | "author" : "xcode"
33 | }
34 | }
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/Masonry.h:
--------------------------------------------------------------------------------
1 | //
2 | // Masonry.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 20/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for Masonry.
12 | FOUNDATION_EXPORT double MasonryVersionNumber;
13 |
14 | //! Project version string for Masonry.
15 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[];
16 |
17 | #import "MASUtilities.h"
18 | #import "View+MASAdditions.h"
19 | #import "View+MASShorthandAdditions.h"
20 | #import "ViewController+MASAdditions.h"
21 | #import "NSArray+MASAdditions.h"
22 | #import "NSArray+MASShorthandAdditions.h"
23 | #import "MASConstraint.h"
24 | #import "MASCompositeConstraint.h"
25 | #import "MASViewAttribute.h"
26 | #import "MASViewConstraint.h"
27 | #import "MASConstraintMaker.h"
28 | #import "MASLayoutConstraint.h"
29 | #import "NSLayoutConstraint+MASDebugAdditions.h"
30 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJExtensionConst.m:
--------------------------------------------------------------------------------
1 | #ifndef __MJExtensionConst__M__
2 | #define __MJExtensionConst__M__
3 |
4 | #import
5 |
6 | /**
7 | * 成员变量类型(属性类型)
8 | */
9 | NSString *const MJPropertyTypeInt = @"i";
10 | NSString *const MJPropertyTypeShort = @"s";
11 | NSString *const MJPropertyTypeFloat = @"f";
12 | NSString *const MJPropertyTypeDouble = @"d";
13 | NSString *const MJPropertyTypeLong = @"l";
14 | NSString *const MJPropertyTypeLongLong = @"q";
15 | NSString *const MJPropertyTypeChar = @"c";
16 | NSString *const MJPropertyTypeBOOL1 = @"c";
17 | NSString *const MJPropertyTypeBOOL2 = @"b";
18 | NSString *const MJPropertyTypePointer = @"*";
19 |
20 | NSString *const MJPropertyTypeIvar = @"^{objc_ivar=}";
21 | NSString *const MJPropertyTypeMethod = @"^{objc_method=}";
22 | NSString *const MJPropertyTypeBlock = @"@?";
23 | NSString *const MJPropertyTypeClass = @"#";
24 | NSString *const MJPropertyTypeSEL = @":";
25 | NSString *const MJPropertyTypeId = @"@";
26 |
27 | #endif
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVRadialGradientLayer.m:
--------------------------------------------------------------------------------
1 | //
2 | // SVRadialGradientLayer.m
3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
4 | //
5 | // Copyright (c) 2014-2018 Tobias Tiemerding. All rights reserved.
6 | //
7 |
8 | #import "SVRadialGradientLayer.h"
9 |
10 | @implementation SVRadialGradientLayer
11 |
12 | - (void)drawInContext:(CGContextRef)context {
13 | size_t locationsCount = 2;
14 | CGFloat locations[2] = {0.0f, 1.0f};
15 | CGFloat colors[8] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.75f};
16 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
17 | CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, colors, locations, locationsCount);
18 | CGColorSpaceRelease(colorSpace);
19 |
20 | float radius = MIN(self.bounds.size.width , self.bounds.size.height);
21 | CGContextDrawRadialGradient (context, gradient, self.gradientCenter, 0, self.gradientCenter, radius, kCGGradientDrawsAfterEndLocation);
22 | CGGradientRelease(gradient);
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/ViewController+MASAdditions.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+MASAdditions.h
3 | // Masonry
4 | //
5 | // Created by Craig Siemens on 2015-06-23.
6 | //
7 | //
8 |
9 | #import "MASUtilities.h"
10 | #import "MASConstraintMaker.h"
11 | #import "MASViewAttribute.h"
12 |
13 | #ifdef MAS_VIEW_CONTROLLER
14 |
15 | @interface MAS_VIEW_CONTROLLER (MASAdditions)
16 |
17 | /**
18 | * following properties return a new MASViewAttribute with appropriate UILayoutGuide and NSLayoutAttribute
19 | */
20 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuide;
21 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuide;
22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideTop;
23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideBottom;
24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideTop;
25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideBottom;
26 |
27 |
28 | @end
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/CCTimeLine/Demo/View/CCContentCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // CCContentCell.h
3 | // CCTimeLine
4 | //
5 | // Created by ZhangCc on 2018/8/6.
6 | // Copyright © 2018年 ZhangCc. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | extern NSString *const CCContentCellID;
12 |
13 | typedef NS_ENUM(NSInteger, OpinionType) {
14 | OpinionTypeBear = -1,
15 | OpinionTypeNone,
16 | OpinionTypeBull
17 | };
18 |
19 | @class CCContentCell;
20 | @protocol CCContentCellDelegate
21 | @optional
22 |
23 | // 折叠/展开 cell
24 | - (void)foldingCell:(CCContentCell *)cell;
25 |
26 | // 利好/利空 1利好 -1利空
27 | - (void)opinionWithCell:(CCContentCell *)cell bullOrBear:(NSInteger)value;
28 |
29 | @end
30 |
31 | @class Article;
32 | @interface CCContentCell : UITableViewCell
33 |
34 | @property (nonatomic, strong) UIView *lineView;
35 | @property (nonatomic, strong) UIView *pointView;
36 |
37 | + (instancetype)cellWithTableView:(UITableView *)tableView;
38 |
39 | @property (nonatomic, strong) Article *model;
40 |
41 | @property (nonatomic, weak) id delegate;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJPropertyType.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJPropertyType.h
3 | // MJExtension
4 | //
5 | // Created by mj on 14-1-15.
6 | // Copyright (c) 2014年 小码哥. All rights reserved.
7 | // 包装一种类型
8 |
9 | #import
10 |
11 | /**
12 | * 包装一种类型
13 | */
14 | @interface MJPropertyType : NSObject
15 | /** 类型标识符 */
16 | @property (nonatomic, copy) NSString *code;
17 |
18 | /** 是否为id类型 */
19 | @property (nonatomic, readonly, getter=isIdType) BOOL idType;
20 |
21 | /** 是否为基本数字类型:int、float等 */
22 | @property (nonatomic, readonly, getter=isNumberType) BOOL numberType;
23 |
24 | /** 是否为BOOL类型 */
25 | @property (nonatomic, readonly, getter=isBoolType) BOOL boolType;
26 |
27 | /** 对象类型(如果是基本数据类型,此值为nil) */
28 | @property (nonatomic, readonly) Class typeClass;
29 |
30 | /** 类型是否来自于Foundation框架,比如NSString、NSArray */
31 | @property (nonatomic, readonly, getter = isFromFoundation) BOOL fromFoundation;
32 | /** 类型是否不支持KVC */
33 | @property (nonatomic, readonly, getter = isKVCDisabled) BOOL KVCDisabled;
34 |
35 | /**
36 | * 获得缓存的类型对象
37 | */
38 | + (instancetype)cachedTypeWithCode:(NSString *)code;
39 | @end
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/NSObject+MJCoding.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+MJCoding.h
3 | // MJExtension
4 | //
5 | // Created by mj on 14-1-15.
6 | // Copyright (c) 2014年 小码哥. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MJExtensionConst.h"
11 |
12 | /**
13 | * Codeing协议
14 | */
15 | @protocol MJCoding
16 | @optional
17 | /**
18 | * 这个数组中的属性名才会进行归档
19 | */
20 | + (NSArray *)mj_allowedCodingPropertyNames;
21 | /**
22 | * 这个数组中的属性名将会被忽略:不进行归档
23 | */
24 | + (NSArray *)mj_ignoredCodingPropertyNames;
25 | @end
26 |
27 | @interface NSObject (MJCoding)
28 | /**
29 | * 解码(从文件中解析对象)
30 | */
31 | - (void)mj_decode:(NSCoder *)decoder;
32 | /**
33 | * 编码(将对象写入文件中)
34 | */
35 | - (void)mj_encode:(NSCoder *)encoder;
36 | @end
37 |
38 | /**
39 | 归档的实现
40 | */
41 | #define MJCodingImplementation \
42 | - (id)initWithCoder:(NSCoder *)decoder \
43 | { \
44 | if (self = [super init]) { \
45 | [self mj_decode:decoder]; \
46 | } \
47 | return self; \
48 | } \
49 | \
50 | - (void)encodeWithCoder:(NSCoder *)encoder \
51 | { \
52 | [self mj_encode:encoder]; \
53 | }
54 |
55 | #define MJExtensionCodingImplementation MJCodingImplementation
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/NSArray+MASShorthandAdditions.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+MASShorthandAdditions.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 22/07/13.
6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved.
7 | //
8 |
9 | #import "NSArray+MASAdditions.h"
10 |
11 | #ifdef MAS_SHORTHAND
12 |
13 | /**
14 | * Shorthand array additions without the 'mas_' prefixes,
15 | * only enabled if MAS_SHORTHAND is defined
16 | */
17 | @interface NSArray (MASShorthandAdditions)
18 |
19 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block;
20 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block;
21 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block;
22 |
23 | @end
24 |
25 | @implementation NSArray (MASShorthandAdditions)
26 |
27 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block {
28 | return [self mas_makeConstraints:block];
29 | }
30 |
31 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block {
32 | return [self mas_updateConstraints:block];
33 | }
34 |
35 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block {
36 | return [self mas_remakeConstraints:block];
37 | }
38 |
39 | @end
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/NSString+MJExtension.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+MJExtension.h
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/6/7.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MJExtensionConst.h"
11 |
12 | @interface NSString (MJExtension)
13 | /**
14 | * 驼峰转下划线(loveYou -> love_you)
15 | */
16 | - (NSString *)mj_underlineFromCamel;
17 | /**
18 | * 下划线转驼峰(love_you -> loveYou)
19 | */
20 | - (NSString *)mj_camelFromUnderline;
21 | /**
22 | * 首字母变大写
23 | */
24 | - (NSString *)mj_firstCharUpper;
25 | /**
26 | * 首字母变小写
27 | */
28 | - (NSString *)mj_firstCharLower;
29 |
30 | - (BOOL)mj_isPureInt;
31 |
32 | - (NSURL *)mj_url;
33 | @end
34 |
35 | @interface NSString (MJExtensionDeprecated_v_2_5_16)
36 | - (NSString *)underlineFromCamel MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
37 | - (NSString *)camelFromUnderline MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
38 | - (NSString *)firstCharUpper MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
39 | - (NSString *)firstCharLower MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
40 | - (BOOL)isPureInt MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
41 | - (NSURL *)url MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
42 | @end
43 |
--------------------------------------------------------------------------------
/CCTimeLine/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "size" : "40x40",
25 | "idiom" : "iphone",
26 | "filename" : "iconD40@2x.png",
27 | "scale" : "2x"
28 | },
29 | {
30 | "size" : "40x40",
31 | "idiom" : "iphone",
32 | "filename" : "iconD@2x-1.png",
33 | "scale" : "3x"
34 | },
35 | {
36 | "size" : "60x60",
37 | "idiom" : "iphone",
38 | "filename" : "iconD@2x.png",
39 | "scale" : "2x"
40 | },
41 | {
42 | "size" : "60x60",
43 | "idiom" : "iphone",
44 | "filename" : "iconD@3x.png",
45 | "scale" : "3x"
46 | },
47 | {
48 | "idiom" : "ios-marketing",
49 | "size" : "1024x1024",
50 | "scale" : "1x"
51 | }
52 | ],
53 | "info" : {
54 | "version" : 1,
55 | "author" : "xcode"
56 | }
57 | }
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASViewAttribute.m:
--------------------------------------------------------------------------------
1 | //
2 | // MASViewAttribute.m
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 21/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import "MASViewAttribute.h"
10 |
11 | @implementation MASViewAttribute
12 |
13 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute {
14 | self = [self initWithView:view item:view layoutAttribute:layoutAttribute];
15 | return self;
16 | }
17 |
18 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute {
19 | self = [super init];
20 | if (!self) return nil;
21 |
22 | _view = view;
23 | _item = item;
24 | _layoutAttribute = layoutAttribute;
25 |
26 | return self;
27 | }
28 |
29 | - (BOOL)isSizeAttribute {
30 | return self.layoutAttribute == NSLayoutAttributeWidth
31 | || self.layoutAttribute == NSLayoutAttributeHeight;
32 | }
33 |
34 | - (BOOL)isEqual:(MASViewAttribute *)viewAttribute {
35 | if ([viewAttribute isKindOfClass:self.class]) {
36 | return self.view == viewAttribute.view
37 | && self.layoutAttribute == viewAttribute.layoutAttribute;
38 | }
39 | return [super isEqual:viewAttribute];
40 | }
41 |
42 | - (NSUInteger)hash {
43 | return MAS_NSUINTROTATE([self.view hash], MAS_NSUINT_BIT / 2) ^ self.layoutAttribute;
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASViewAttribute.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASViewAttribute.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 21/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import "MASUtilities.h"
10 |
11 | /**
12 | * An immutable tuple which stores the view and the related NSLayoutAttribute.
13 | * Describes part of either the left or right hand side of a constraint equation
14 | */
15 | @interface MASViewAttribute : NSObject
16 |
17 | /**
18 | * The view which the reciever relates to. Can be nil if item is not a view.
19 | */
20 | @property (nonatomic, weak, readonly) MAS_VIEW *view;
21 |
22 | /**
23 | * The item which the reciever relates to.
24 | */
25 | @property (nonatomic, weak, readonly) id item;
26 |
27 | /**
28 | * The attribute which the reciever relates to
29 | */
30 | @property (nonatomic, assign, readonly) NSLayoutAttribute layoutAttribute;
31 |
32 | /**
33 | * Convenience initializer.
34 | */
35 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute;
36 |
37 | /**
38 | * The designated initializer.
39 | */
40 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute;
41 |
42 | /**
43 | * Determine whether the layoutAttribute is a size attribute
44 | *
45 | * @return YES if layoutAttribute is equal to NSLayoutAttributeWidth or NSLayoutAttributeHeight
46 | */
47 | - (BOOL)isSizeAttribute;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/ViewController+MASAdditions.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController+MASAdditions.m
3 | // Masonry
4 | //
5 | // Created by Craig Siemens on 2015-06-23.
6 | //
7 | //
8 |
9 | #import "ViewController+MASAdditions.h"
10 |
11 | #ifdef MAS_VIEW_CONTROLLER
12 |
13 | @implementation MAS_VIEW_CONTROLLER (MASAdditions)
14 |
15 | - (MASViewAttribute *)mas_topLayoutGuide {
16 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
17 | }
18 | - (MASViewAttribute *)mas_topLayoutGuideTop {
19 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeTop];
20 | }
21 | - (MASViewAttribute *)mas_topLayoutGuideBottom {
22 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
23 | }
24 |
25 | - (MASViewAttribute *)mas_bottomLayoutGuide {
26 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop];
27 | }
28 | - (MASViewAttribute *)mas_bottomLayoutGuideTop {
29 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop];
30 | }
31 | - (MASViewAttribute *)mas_bottomLayoutGuideBottom {
32 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
33 | }
34 |
35 |
36 |
37 | @end
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/CCTimeLine/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UIStatusBarHidden
6 |
7 | CFBundleDevelopmentRegion
8 | $(DEVELOPMENT_LANGUAGE)
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJProperty.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJProperty.h
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/4/17.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | // 包装一个成员属性
8 |
9 | #import
10 | #import
11 | #import "MJPropertyType.h"
12 | #import "MJPropertyKey.h"
13 |
14 | /**
15 | * 包装一个成员
16 | */
17 | @interface MJProperty : NSObject
18 | /** 成员属性 */
19 | @property (nonatomic, assign) objc_property_t property;
20 | /** 成员属性的名字 */
21 | @property (nonatomic, readonly) NSString *name;
22 |
23 | /** 成员属性的类型 */
24 | @property (nonatomic, readonly) MJPropertyType *type;
25 | /** 成员属性来源于哪个类(可能是父类) */
26 | @property (nonatomic, assign) Class srcClass;
27 |
28 | /**** 同一个成员属性 - 父类和子类的行为可能不一致(originKey、propertyKeys、objectClassInArray) ****/
29 | /** 设置最原始的key */
30 | - (void)setOriginKey:(id)originKey forClass:(Class)c;
31 | /** 对应着字典中的多级key(里面存放的数组,数组里面都是MJPropertyKey对象) */
32 | - (NSArray *)propertyKeysForClass:(Class)c;
33 |
34 | /** 模型数组中的模型类型 */
35 | - (void)setObjectClassInArray:(Class)objectClass forClass:(Class)c;
36 | - (Class)objectClassInArrayForClass:(Class)c;
37 | /**** 同一个成员变量 - 父类和子类的行为可能不一致(key、keys、objectClassInArray) ****/
38 |
39 | /**
40 | * 设置object的成员变量值
41 | */
42 | - (void)setValue:(id)value forObject:(id)object;
43 | /**
44 | * 得到object的成员属性值
45 | */
46 | - (id)valueForObject:(id)object;
47 |
48 | /**
49 | * 初始化
50 | */
51 | + (instancetype)cachedPropertyWithProperty:(objc_property_t)property;
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASViewConstraint.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASViewConstraint.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 20/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import "MASViewAttribute.h"
10 | #import "MASConstraint.h"
11 | #import "MASLayoutConstraint.h"
12 | #import "MASUtilities.h"
13 |
14 | /**
15 | * A single constraint.
16 | * Contains the attributes neccessary for creating a NSLayoutConstraint and adding it to the appropriate view
17 | */
18 | @interface MASViewConstraint : MASConstraint
19 |
20 | /**
21 | * First item/view and first attribute of the NSLayoutConstraint
22 | */
23 | @property (nonatomic, strong, readonly) MASViewAttribute *firstViewAttribute;
24 |
25 | /**
26 | * Second item/view and second attribute of the NSLayoutConstraint
27 | */
28 | @property (nonatomic, strong, readonly) MASViewAttribute *secondViewAttribute;
29 |
30 | /**
31 | * initialises the MASViewConstraint with the first part of the equation
32 | *
33 | * @param firstViewAttribute view.mas_left, view.mas_width etc.
34 | *
35 | * @return a new view constraint
36 | */
37 | - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute;
38 |
39 | /**
40 | * Returns all MASViewConstraints installed with this view as a first item.
41 | *
42 | * @param view A view to retrieve constraints for.
43 | *
44 | * @return An array of MASViewConstraints.
45 | */
46 | + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view;
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJFoundation.m:
--------------------------------------------------------------------------------
1 | //
2 | // MJFoundation.m
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 14/7/16.
6 | // Copyright (c) 2014年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJFoundation.h"
10 | #import "MJExtensionConst.h"
11 | #import
12 |
13 | @implementation MJFoundation
14 |
15 | + (BOOL)isClassFromFoundation:(Class)c
16 | {
17 | if (c == [NSObject class] || c == [NSManagedObject class]) return YES;
18 |
19 | static NSSet *foundationClasses;
20 | static dispatch_once_t onceToken;
21 | dispatch_once(&onceToken, ^{
22 | // 集合中没有NSObject,因为几乎所有的类都是继承自NSObject,具体是不是NSObject需要特殊判断
23 | foundationClasses = [NSSet setWithObjects:
24 | [NSURL class],
25 | [NSDate class],
26 | [NSValue class],
27 | [NSData class],
28 | [NSError class],
29 | [NSArray class],
30 | [NSDictionary class],
31 | [NSString class],
32 | [NSAttributedString class], nil];
33 | });
34 |
35 | __block BOOL result = NO;
36 | [foundationClasses enumerateObjectsUsingBlock:^(Class foundationClass, BOOL *stop) {
37 | if ([c isSubclassOfClass:foundationClass]) {
38 | result = YES;
39 | *stop = YES;
40 | }
41 | }];
42 | return result;
43 | }
44 | @end
45 |
--------------------------------------------------------------------------------
/CCTimeLine/Resources/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 |
--------------------------------------------------------------------------------
/CCTimeLine/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCellDebug.h:
--------------------------------------------------------------------------------
1 | // The MIT License (MIT)
2 | //
3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
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 | #import
24 |
25 | @interface UITableView (FDTemplateLayoutCellDebug)
26 |
27 | /// Helps to debug or inspect what is this "FDTemplateLayoutCell" extention doing,
28 | /// turning on to print logs when "creating", "calculating", "precaching" or "hitting cache".
29 | ///
30 | /// Default to NO, log by NSLog.
31 | ///
32 | @property (nonatomic, assign) BOOL fd_debugLogEnabled;
33 |
34 | /// Debug log controlled by "fd_debugLogEnabled".
35 | - (void)fd_debugLog:(NSString *)message;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDKeyedHeightCache.h:
--------------------------------------------------------------------------------
1 | // The MIT License (MIT)
2 | //
3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
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 | #import
24 |
25 | @interface FDKeyedHeightCache : NSObject
26 |
27 | - (BOOL)existsHeightForKey:(id)key;
28 | - (void)cacheHeight:(CGFloat)height byKey:(id)key;
29 | - (CGFloat)heightForKey:(id)key;
30 |
31 | // Invalidation
32 | - (void)invalidateHeightForKey:(id)key;
33 | - (void)invalidateAllHeightCache;
34 | @end
35 |
36 | @interface UITableView (FDKeyedHeightCache)
37 |
38 | /// Height cache by key. Generally, you don't need to use it directly.
39 | @property (nonatomic, strong, readonly) FDKeyedHeightCache *fd_keyedHeightCache;
40 | @end
41 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCellDebug.m:
--------------------------------------------------------------------------------
1 | // The MIT License (MIT)
2 | //
3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
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 | #import "UITableView+FDTemplateLayoutCellDebug.h"
24 | #import
25 |
26 | @implementation UITableView (FDTemplateLayoutCellDebug)
27 |
28 | - (BOOL)fd_debugLogEnabled {
29 | return [objc_getAssociatedObject(self, _cmd) boolValue];
30 | }
31 |
32 | - (void)setFd_debugLogEnabled:(BOOL)debugLogEnabled {
33 | objc_setAssociatedObject(self, @selector(fd_debugLogEnabled), @(debugLogEnabled), OBJC_ASSOCIATION_RETAIN);
34 | }
35 |
36 | - (void)fd_debugLog:(NSString *)message {
37 | if (self.fd_debugLogEnabled) {
38 | NSLog(@"** FDTemplateLayoutCell ** %@", message);
39 | }
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASConstraint+Private.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASConstraint+Private.h
3 | // Masonry
4 | //
5 | // Created by Nick Tymchenko on 29/04/14.
6 | // Copyright (c) 2014 cloudling. All rights reserved.
7 | //
8 |
9 | #import "MASConstraint.h"
10 |
11 | @protocol MASConstraintDelegate;
12 |
13 |
14 | @interface MASConstraint ()
15 |
16 | /**
17 | * Whether or not to check for an existing constraint instead of adding constraint
18 | */
19 | @property (nonatomic, assign) BOOL updateExisting;
20 |
21 | /**
22 | * Usually MASConstraintMaker but could be a parent MASConstraint
23 | */
24 | @property (nonatomic, weak) id delegate;
25 |
26 | /**
27 | * Based on a provided value type, is equal to calling:
28 | * NSNumber - setOffset:
29 | * NSValue with CGPoint - setPointOffset:
30 | * NSValue with CGSize - setSizeOffset:
31 | * NSValue with MASEdgeInsets - setInsets:
32 | */
33 | - (void)setLayoutConstantWithValue:(NSValue *)value;
34 |
35 | @end
36 |
37 |
38 | @interface MASConstraint (Abstract)
39 |
40 | /**
41 | * Sets the constraint relation to given NSLayoutRelation
42 | * returns a block which accepts one of the following:
43 | * MASViewAttribute, UIView, NSValue, NSArray
44 | * see readme for more details.
45 | */
46 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation;
47 |
48 | /**
49 | * Override to set a custom chaining behaviour
50 | */
51 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute;
52 |
53 | @end
54 |
55 |
56 | @protocol MASConstraintDelegate
57 |
58 | /**
59 | * Notifies the delegate when the constraint needs to be replaced with another constraint. For example
60 | * A MASViewConstraint may turn into a MASCompositeConstraint when an array is passed to one of the equality blocks
61 | */
62 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint;
63 |
64 | - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute;
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/NSObject+MJCoding.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+MJCoding.m
3 | // MJExtension
4 | //
5 | // Created by mj on 14-1-15.
6 | // Copyright (c) 2014年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "NSObject+MJCoding.h"
10 | #import "NSObject+MJClass.h"
11 | #import "NSObject+MJProperty.h"
12 | #import "MJProperty.h"
13 |
14 | @implementation NSObject (MJCoding)
15 |
16 | - (void)mj_encode:(NSCoder *)encoder
17 | {
18 | Class clazz = [self class];
19 |
20 | NSArray *allowedCodingPropertyNames = [clazz mj_totalAllowedCodingPropertyNames];
21 | NSArray *ignoredCodingPropertyNames = [clazz mj_totalIgnoredCodingPropertyNames];
22 |
23 | [clazz mj_enumerateProperties:^(MJProperty *property, BOOL *stop) {
24 | // 检测是否被忽略
25 | if (allowedCodingPropertyNames.count && ![allowedCodingPropertyNames containsObject:property.name]) return;
26 | if ([ignoredCodingPropertyNames containsObject:property.name]) return;
27 |
28 | id value = [property valueForObject:self];
29 | if (value == nil) return;
30 | [encoder encodeObject:value forKey:property.name];
31 | }];
32 | }
33 |
34 | - (void)mj_decode:(NSCoder *)decoder
35 | {
36 | Class clazz = [self class];
37 |
38 | NSArray *allowedCodingPropertyNames = [clazz mj_totalAllowedCodingPropertyNames];
39 | NSArray *ignoredCodingPropertyNames = [clazz mj_totalIgnoredCodingPropertyNames];
40 |
41 | [clazz mj_enumerateProperties:^(MJProperty *property, BOOL *stop) {
42 | // 检测是否被忽略
43 | if (allowedCodingPropertyNames.count && ![allowedCodingPropertyNames containsObject:property.name]) return;
44 | if ([ignoredCodingPropertyNames containsObject:property.name]) return;
45 |
46 | id value = [decoder decodeObjectForKey:property.name];
47 | if (value == nil) { // 兼容以前的MJExtension版本
48 | value = [decoder decodeObjectForKey:[@"_" stringByAppendingString:property.name]];
49 | }
50 | if (value == nil) return;
51 | [property setValue:value forObject:self];
52 | }];
53 | }
54 | @end
55 |
--------------------------------------------------------------------------------
/CCTimeLine/AppDelegate/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // CCTimeLine
4 | //
5 | // Created by ZhangCc on 2018/8/6.
6 | // Copyright © 2018年 ZhangCc. 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 |
24 | - (void)applicationWillResignActive:(UIApplication *)application {
25 | // 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.
26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
27 | }
28 |
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application {
31 | // 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.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 |
36 | - (void)applicationWillEnterForeground:(UIApplication *)application {
37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
38 | }
39 |
40 |
41 | - (void)applicationDidBecomeActive:(UIApplication *)application {
42 | // 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.
43 | }
44 |
45 |
46 | - (void)applicationWillTerminate:(UIApplication *)application {
47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
48 | }
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDIndexPathHeightCache.h:
--------------------------------------------------------------------------------
1 | // The MIT License (MIT)
2 | //
3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
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 | #import
24 |
25 | @interface FDIndexPathHeightCache : NSObject
26 |
27 | // Enable automatically if you're using index path driven height cache
28 | @property (nonatomic, assign) BOOL automaticallyInvalidateEnabled;
29 |
30 | // Height cache
31 | - (BOOL)existsHeightAtIndexPath:(NSIndexPath *)indexPath;
32 | - (void)cacheHeight:(CGFloat)height byIndexPath:(NSIndexPath *)indexPath;
33 | - (CGFloat)heightForIndexPath:(NSIndexPath *)indexPath;
34 | - (void)invalidateHeightAtIndexPath:(NSIndexPath *)indexPath;
35 | - (void)invalidateAllHeightCache;
36 |
37 | @end
38 |
39 | @interface UITableView (FDIndexPathHeightCache)
40 | /// Height cache by index path. Generally, you don't need to use it directly.
41 | @property (nonatomic, strong, readonly) FDIndexPathHeightCache *fd_indexPathHeightCache;
42 | @end
43 |
44 | @interface UITableView (FDIndexPathHeightCacheInvalidation)
45 | /// Call this method when you want to reload data but don't want to invalidate
46 | /// all height cache by index path, for example, load more data at the bottom of
47 | /// table view.
48 | - (void)fd_reloadDataWithoutInvalidateIndexPathHeightCache;
49 | @end
50 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJPropertyType.m:
--------------------------------------------------------------------------------
1 | //
2 | // MJPropertyType.m
3 | // MJExtension
4 | //
5 | // Created by mj on 14-1-15.
6 | // Copyright (c) 2014年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJPropertyType.h"
10 | #import "MJExtension.h"
11 | #import "MJFoundation.h"
12 | #import "MJExtensionConst.h"
13 |
14 | @implementation MJPropertyType
15 |
16 | + (instancetype)cachedTypeWithCode:(NSString *)code
17 | {
18 | MJExtensionAssertParamNotNil2(code, nil);
19 |
20 | static NSMutableDictionary *types;
21 | static dispatch_once_t onceToken;
22 | dispatch_once(&onceToken, ^{
23 | types = [NSMutableDictionary dictionary];
24 | });
25 |
26 | MJExtensionSemaphoreCreate
27 | MJExtensionSemaphoreWait
28 | MJPropertyType *type = types[code];
29 | if (type == nil) {
30 | type = [[self alloc] init];
31 | type.code = code;
32 | types[code] = type;
33 | }
34 | MJExtensionSemaphoreSignal
35 | return type;
36 | }
37 |
38 | #pragma mark - 公共方法
39 | - (void)setCode:(NSString *)code
40 | {
41 | _code = code;
42 |
43 | MJExtensionAssertParamNotNil(code);
44 |
45 | if ([code isEqualToString:MJPropertyTypeId]) {
46 | _idType = YES;
47 | } else if (code.length == 0) {
48 | _KVCDisabled = YES;
49 | } else if (code.length > 3 && [code hasPrefix:@"@\""]) {
50 | // 去掉@"和",截取中间的类型名称
51 | _code = [code substringWithRange:NSMakeRange(2, code.length - 3)];
52 | _typeClass = NSClassFromString(_code);
53 | _fromFoundation = [MJFoundation isClassFromFoundation:_typeClass];
54 | _numberType = [_typeClass isSubclassOfClass:[NSNumber class]];
55 |
56 | } else if ([code isEqualToString:MJPropertyTypeSEL] ||
57 | [code isEqualToString:MJPropertyTypeIvar] ||
58 | [code isEqualToString:MJPropertyTypeMethod]) {
59 | _KVCDisabled = YES;
60 | }
61 |
62 | // 是否为数字类型
63 | NSString *lowerCode = _code.lowercaseString;
64 | NSArray *numberTypes = @[MJPropertyTypeInt, MJPropertyTypeShort, MJPropertyTypeBOOL1, MJPropertyTypeBOOL2, MJPropertyTypeFloat, MJPropertyTypeDouble, MJPropertyTypeLong, MJPropertyTypeLongLong, MJPropertyTypeChar];
65 | if ([numberTypes containsObject:lowerCode]) {
66 | _numberType = YES;
67 |
68 | if ([lowerCode isEqualToString:MJPropertyTypeBOOL1]
69 | || [lowerCode isEqualToString:MJPropertyTypeBOOL2]) {
70 | _boolType = YES;
71 | }
72 | }
73 | }
74 | @end
75 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/NSObject+MJClass.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+MJClass.h
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/8/11.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | /**
12 | * 遍历所有类的block(父类)
13 | */
14 | typedef void (^MJClassesEnumeration)(Class c, BOOL *stop);
15 |
16 | /** 这个数组中的属性名才会进行字典和模型的转换 */
17 | typedef NSArray * (^MJAllowedPropertyNames)(void);
18 | /** 这个数组中的属性名才会进行归档 */
19 | typedef NSArray * (^MJAllowedCodingPropertyNames)(void);
20 |
21 | /** 这个数组中的属性名将会被忽略:不进行字典和模型的转换 */
22 | typedef NSArray * (^MJIgnoredPropertyNames)(void);
23 | /** 这个数组中的属性名将会被忽略:不进行归档 */
24 | typedef NSArray * (^MJIgnoredCodingPropertyNames)(void);
25 |
26 | /**
27 | * 类相关的扩展
28 | */
29 | @interface NSObject (MJClass)
30 | /**
31 | * 遍历所有的类
32 | */
33 | + (void)mj_enumerateClasses:(MJClassesEnumeration)enumeration;
34 | + (void)mj_enumerateAllClasses:(MJClassesEnumeration)enumeration;
35 |
36 | #pragma mark - 属性白名单配置
37 | /**
38 | * 这个数组中的属性名才会进行字典和模型的转换
39 | *
40 | * @param allowedPropertyNames 这个数组中的属性名才会进行字典和模型的转换
41 | */
42 | + (void)mj_setupAllowedPropertyNames:(MJAllowedPropertyNames)allowedPropertyNames;
43 |
44 | /**
45 | * 这个数组中的属性名才会进行字典和模型的转换
46 | */
47 | + (NSMutableArray *)mj_totalAllowedPropertyNames;
48 |
49 | #pragma mark - 属性黑名单配置
50 | /**
51 | * 这个数组中的属性名将会被忽略:不进行字典和模型的转换
52 | *
53 | * @param ignoredPropertyNames 这个数组中的属性名将会被忽略:不进行字典和模型的转换
54 | */
55 | + (void)mj_setupIgnoredPropertyNames:(MJIgnoredPropertyNames)ignoredPropertyNames;
56 |
57 | /**
58 | * 这个数组中的属性名将会被忽略:不进行字典和模型的转换
59 | */
60 | + (NSMutableArray *)mj_totalIgnoredPropertyNames;
61 |
62 | #pragma mark - 归档属性白名单配置
63 | /**
64 | * 这个数组中的属性名才会进行归档
65 | *
66 | * @param allowedCodingPropertyNames 这个数组中的属性名才会进行归档
67 | */
68 | + (void)mj_setupAllowedCodingPropertyNames:(MJAllowedCodingPropertyNames)allowedCodingPropertyNames;
69 |
70 | /**
71 | * 这个数组中的属性名才会进行字典和模型的转换
72 | */
73 | + (NSMutableArray *)mj_totalAllowedCodingPropertyNames;
74 |
75 | #pragma mark - 归档属性黑名单配置
76 | /**
77 | * 这个数组中的属性名将会被忽略:不进行归档
78 | *
79 | * @param ignoredCodingPropertyNames 这个数组中的属性名将会被忽略:不进行归档
80 | */
81 | + (void)mj_setupIgnoredCodingPropertyNames:(MJIgnoredCodingPropertyNames)ignoredCodingPropertyNames;
82 |
83 | /**
84 | * 这个数组中的属性名将会被忽略:不进行归档
85 | */
86 | + (NSMutableArray *)mj_totalIgnoredCodingPropertyNames;
87 |
88 | #pragma mark - 内部使用
89 | + (void)mj_setupBlockReturnValue:(id (^)(void))block key:(const char *)key;
90 | @end
91 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJExtensionConst.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __MJExtensionConst__H__
3 | #define __MJExtensionConst__H__
4 |
5 | #import
6 |
7 | // 信号量
8 | #define MJExtensionSemaphoreCreate \
9 | static dispatch_semaphore_t signalSemaphore; \
10 | static dispatch_once_t onceTokenSemaphore; \
11 | dispatch_once(&onceTokenSemaphore, ^{ \
12 | signalSemaphore = dispatch_semaphore_create(1); \
13 | });
14 |
15 | #define MJExtensionSemaphoreWait \
16 | dispatch_semaphore_wait(signalSemaphore, DISPATCH_TIME_FOREVER);
17 |
18 | #define MJExtensionSemaphoreSignal \
19 | dispatch_semaphore_signal(signalSemaphore);
20 |
21 | // 过期
22 | #define MJExtensionDeprecated(instead) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, instead)
23 |
24 | // 构建错误
25 | #define MJExtensionBuildError(clazz, msg) \
26 | NSError *error = [NSError errorWithDomain:msg code:250 userInfo:nil]; \
27 | [clazz setMj_error:error];
28 |
29 | // 日志输出
30 | #ifdef DEBUG
31 | #define MJExtensionLog(...) NSLog(__VA_ARGS__)
32 | #else
33 | #define MJExtensionLog(...)
34 | #endif
35 |
36 | /**
37 | * 断言
38 | * @param condition 条件
39 | * @param returnValue 返回值
40 | */
41 | #define MJExtensionAssertError(condition, returnValue, clazz, msg) \
42 | [clazz setMj_error:nil]; \
43 | if ((condition) == NO) { \
44 | MJExtensionBuildError(clazz, msg); \
45 | return returnValue;\
46 | }
47 |
48 | #define MJExtensionAssert2(condition, returnValue) \
49 | if ((condition) == NO) return returnValue;
50 |
51 | /**
52 | * 断言
53 | * @param condition 条件
54 | */
55 | #define MJExtensionAssert(condition) MJExtensionAssert2(condition, )
56 |
57 | /**
58 | * 断言
59 | * @param param 参数
60 | * @param returnValue 返回值
61 | */
62 | #define MJExtensionAssertParamNotNil2(param, returnValue) \
63 | MJExtensionAssert2((param) != nil, returnValue)
64 |
65 | /**
66 | * 断言
67 | * @param param 参数
68 | */
69 | #define MJExtensionAssertParamNotNil(param) MJExtensionAssertParamNotNil2(param, )
70 |
71 | /**
72 | * 打印所有的属性
73 | */
74 | #define MJLogAllIvars \
75 | -(NSString *)description \
76 | { \
77 | return [self mj_keyValues].description; \
78 | }
79 | #define MJExtensionLogAllProperties MJLogAllIvars
80 |
81 | /**
82 | * 类型(属性类型)
83 | */
84 | extern NSString *const MJPropertyTypeInt;
85 | extern NSString *const MJPropertyTypeShort;
86 | extern NSString *const MJPropertyTypeFloat;
87 | extern NSString *const MJPropertyTypeDouble;
88 | extern NSString *const MJPropertyTypeLong;
89 | extern NSString *const MJPropertyTypeLongLong;
90 | extern NSString *const MJPropertyTypeChar;
91 | extern NSString *const MJPropertyTypeBOOL1;
92 | extern NSString *const MJPropertyTypeBOOL2;
93 | extern NSString *const MJPropertyTypePointer;
94 |
95 | extern NSString *const MJPropertyTypeIvar;
96 | extern NSString *const MJPropertyTypeMethod;
97 | extern NSString *const MJPropertyTypeBlock;
98 | extern NSString *const MJPropertyTypeClass;
99 | extern NSString *const MJPropertyTypeSEL;
100 | extern NSString *const MJPropertyTypeId;
101 |
102 | #endif
103 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/NSArray+MASAdditions.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+MASAdditions.h
3 | //
4 | //
5 | // Created by Daniel Hammond on 11/26/13.
6 | //
7 | //
8 |
9 | #import "MASUtilities.h"
10 | #import "MASConstraintMaker.h"
11 | #import "MASViewAttribute.h"
12 |
13 | typedef NS_ENUM(NSUInteger, MASAxisType) {
14 | MASAxisTypeHorizontal,
15 | MASAxisTypeVertical
16 | };
17 |
18 | @interface NSArray (MASAdditions)
19 |
20 | /**
21 | * Creates a MASConstraintMaker with each view in the callee.
22 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing on each view
23 | *
24 | * @param block scope within which you can build up the constraints which you wish to apply to each view.
25 | *
26 | * @return Array of created MASConstraints
27 | */
28 | - (NSArray *)mas_makeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block;
29 |
30 | /**
31 | * Creates a MASConstraintMaker with each view in the callee.
32 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view.
33 | * If an existing constraint exists then it will be updated instead.
34 | *
35 | * @param block scope within which you can build up the constraints which you wish to apply to each view.
36 | *
37 | * @return Array of created/updated MASConstraints
38 | */
39 | - (NSArray *)mas_updateConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block;
40 |
41 | /**
42 | * Creates a MASConstraintMaker with each view in the callee.
43 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view.
44 | * All constraints previously installed for the views will be removed.
45 | *
46 | * @param block scope within which you can build up the constraints which you wish to apply to each view.
47 | *
48 | * @return Array of created/updated MASConstraints
49 | */
50 | - (NSArray *)mas_remakeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block;
51 |
52 | /**
53 | * distribute with fixed spacing
54 | *
55 | * @param axisType which axis to distribute items along
56 | * @param fixedSpacing the spacing between each item
57 | * @param leadSpacing the spacing before the first item and the container
58 | * @param tailSpacing the spacing after the last item and the container
59 | */
60 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing;
61 |
62 | /**
63 | * distribute with fixed item size
64 | *
65 | * @param axisType which axis to distribute items along
66 | * @param fixedItemLength the fixed length of each item
67 | * @param leadSpacing the spacing before the first item and the container
68 | * @param tailSpacing the spacing after the last item and the container
69 | */
70 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing;
71 |
72 | @end
73 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/NSObject+MJProperty.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+MJProperty.h
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/4/17.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MJExtensionConst.h"
11 |
12 | @class MJProperty;
13 |
14 | /**
15 | * 遍历成员变量用的block
16 | *
17 | * @param property 成员的包装对象
18 | * @param stop YES代表停止遍历,NO代表继续遍历
19 | */
20 | typedef void (^MJPropertiesEnumeration)(MJProperty *property, BOOL *stop);
21 |
22 | /** 将属性名换为其他key去字典中取值 */
23 | typedef NSDictionary * (^MJReplacedKeyFromPropertyName)(void);
24 | typedef id (^MJReplacedKeyFromPropertyName121)(NSString *propertyName);
25 | /** 数组中需要转换的模型类 */
26 | typedef NSDictionary * (^MJObjectClassInArray)(void);
27 | /** 用于过滤字典中的值 */
28 | typedef id (^MJNewValueFromOldValue)(id object, id oldValue, MJProperty *property);
29 |
30 | /**
31 | * 成员属性相关的扩展
32 | */
33 | @interface NSObject (MJProperty)
34 | #pragma mark - 遍历
35 | /**
36 | * 遍历所有的成员
37 | */
38 | + (void)mj_enumerateProperties:(MJPropertiesEnumeration)enumeration;
39 |
40 | #pragma mark - 新值配置
41 | /**
42 | * 用于过滤字典中的值
43 | *
44 | * @param newValueFormOldValue 用于过滤字典中的值
45 | */
46 | + (void)mj_setupNewValueFromOldValue:(MJNewValueFromOldValue)newValueFormOldValue;
47 | + (id)mj_getNewValueFromObject:(__unsafe_unretained id)object oldValue:(__unsafe_unretained id)oldValue property:(__unsafe_unretained MJProperty *)property;
48 |
49 | #pragma mark - key配置
50 | /**
51 | * 将属性名换为其他key去字典中取值
52 | *
53 | * @param replacedKeyFromPropertyName 将属性名换为其他key去字典中取值
54 | */
55 | + (void)mj_setupReplacedKeyFromPropertyName:(MJReplacedKeyFromPropertyName)replacedKeyFromPropertyName;
56 | /**
57 | * 将属性名换为其他key去字典中取值
58 | *
59 | * @param replacedKeyFromPropertyName121 将属性名换为其他key去字典中取值
60 | */
61 | + (void)mj_setupReplacedKeyFromPropertyName121:(MJReplacedKeyFromPropertyName121)replacedKeyFromPropertyName121;
62 |
63 | #pragma mark - array model class配置
64 | /**
65 | * 数组中需要转换的模型类
66 | *
67 | * @param objectClassInArray 数组中需要转换的模型类
68 | */
69 | + (void)mj_setupObjectClassInArray:(MJObjectClassInArray)objectClassInArray;
70 | @end
71 |
72 | @interface NSObject (MJPropertyDeprecated_v_2_5_16)
73 | + (void)enumerateProperties:(MJPropertiesEnumeration)enumeration MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
74 | + (void)setupNewValueFromOldValue:(MJNewValueFromOldValue)newValueFormOldValue MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
75 | + (id)getNewValueFromObject:(__unsafe_unretained id)object oldValue:(__unsafe_unretained id)oldValue property:(__unsafe_unretained MJProperty *)property MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
76 | + (void)setupReplacedKeyFromPropertyName:(MJReplacedKeyFromPropertyName)replacedKeyFromPropertyName MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
77 | + (void)setupReplacedKeyFromPropertyName121:(MJReplacedKeyFromPropertyName121)replacedKeyFromPropertyName121 MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
78 | + (void)setupObjectClassInArray:(MJObjectClassInArray)objectClassInArray MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
79 | @end
80 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVProgressAnimatedView.m:
--------------------------------------------------------------------------------
1 | //
2 | // SVProgressAnimatedView.m
3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
4 | //
5 | // Copyright (c) 2017-2018 Tobias Tiemerding. All rights reserved.
6 | //
7 |
8 | #import "SVProgressAnimatedView.h"
9 |
10 | @interface SVProgressAnimatedView ()
11 |
12 | @property (nonatomic, strong) CAShapeLayer *ringAnimatedLayer;
13 |
14 | @end
15 |
16 | @implementation SVProgressAnimatedView
17 |
18 | - (void)willMoveToSuperview:(UIView*)newSuperview {
19 | if (newSuperview) {
20 | [self layoutAnimatedLayer];
21 | } else {
22 | [_ringAnimatedLayer removeFromSuperlayer];
23 | _ringAnimatedLayer = nil;
24 | }
25 | }
26 |
27 | - (void)layoutAnimatedLayer {
28 | CALayer *layer = self.ringAnimatedLayer;
29 | [self.layer addSublayer:layer];
30 |
31 | CGFloat widthDiff = CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds);
32 | CGFloat heightDiff = CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds);
33 | layer.position = CGPointMake(CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds) / 2 - widthDiff / 2, CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds) / 2 - heightDiff / 2);
34 | }
35 |
36 | - (CAShapeLayer*)ringAnimatedLayer {
37 | if(!_ringAnimatedLayer) {
38 | CGPoint arcCenter = CGPointMake(self.radius+self.strokeThickness/2+5, self.radius+self.strokeThickness/2+5);
39 | UIBezierPath* smoothedPath = [UIBezierPath bezierPathWithArcCenter:arcCenter radius:self.radius startAngle:(CGFloat)-M_PI_2 endAngle:(CGFloat) (M_PI + M_PI_2) clockwise:YES];
40 |
41 | _ringAnimatedLayer = [CAShapeLayer layer];
42 | _ringAnimatedLayer.contentsScale = [[UIScreen mainScreen] scale];
43 | _ringAnimatedLayer.frame = CGRectMake(0.0f, 0.0f, arcCenter.x*2, arcCenter.y*2);
44 | _ringAnimatedLayer.fillColor = [UIColor clearColor].CGColor;
45 | _ringAnimatedLayer.strokeColor = self.strokeColor.CGColor;
46 | _ringAnimatedLayer.lineWidth = self.strokeThickness;
47 | _ringAnimatedLayer.lineCap = kCALineCapRound;
48 | _ringAnimatedLayer.lineJoin = kCALineJoinBevel;
49 | _ringAnimatedLayer.path = smoothedPath.CGPath;
50 | }
51 | return _ringAnimatedLayer;
52 | }
53 |
54 | - (void)setFrame:(CGRect)frame {
55 | if(!CGRectEqualToRect(frame, super.frame)) {
56 | [super setFrame:frame];
57 |
58 | if(self.superview) {
59 | [self layoutAnimatedLayer];
60 | }
61 | }
62 | }
63 |
64 | - (void)setRadius:(CGFloat)radius {
65 | if(radius != _radius) {
66 | _radius = radius;
67 |
68 | [_ringAnimatedLayer removeFromSuperlayer];
69 | _ringAnimatedLayer = nil;
70 |
71 | if(self.superview) {
72 | [self layoutAnimatedLayer];
73 | }
74 | }
75 | }
76 |
77 | - (void)setStrokeColor:(UIColor*)strokeColor {
78 | _strokeColor = strokeColor;
79 | _ringAnimatedLayer.strokeColor = strokeColor.CGColor;
80 | }
81 |
82 | - (void)setStrokeThickness:(CGFloat)strokeThickness {
83 | _strokeThickness = strokeThickness;
84 | _ringAnimatedLayer.lineWidth = _strokeThickness;
85 | }
86 |
87 | - (void)setStrokeEnd:(CGFloat)strokeEnd {
88 | _strokeEnd = strokeEnd;
89 | _ringAnimatedLayer.strokeEnd = _strokeEnd;
90 | }
91 |
92 | - (CGSize)sizeThatFits:(CGSize)size {
93 | return CGSizeMake((self.radius+self.strokeThickness/2+5)*2, (self.radius+self.strokeThickness/2+5)*2);
94 | }
95 |
96 | @end
97 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDKeyedHeightCache.m:
--------------------------------------------------------------------------------
1 | // The MIT License (MIT)
2 | //
3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
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 | #import "UITableView+FDKeyedHeightCache.h"
24 | #import
25 |
26 | @interface FDKeyedHeightCache ()
27 | @property (nonatomic, strong) NSMutableDictionary, NSNumber *> *mutableHeightsByKeyForPortrait;
28 | @property (nonatomic, strong) NSMutableDictionary, NSNumber *> *mutableHeightsByKeyForLandscape;
29 | @end
30 |
31 | @implementation FDKeyedHeightCache
32 |
33 | - (instancetype)init {
34 | self = [super init];
35 | if (self) {
36 | _mutableHeightsByKeyForPortrait = [NSMutableDictionary dictionary];
37 | _mutableHeightsByKeyForLandscape = [NSMutableDictionary dictionary];
38 | }
39 | return self;
40 | }
41 |
42 | - (NSMutableDictionary, NSNumber *> *)mutableHeightsByKeyForCurrentOrientation {
43 | return UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation) ? self.mutableHeightsByKeyForPortrait: self.mutableHeightsByKeyForLandscape;
44 | }
45 |
46 | - (BOOL)existsHeightForKey:(id)key {
47 | NSNumber *number = self.mutableHeightsByKeyForCurrentOrientation[key];
48 | return number && ![number isEqualToNumber:@-1];
49 | }
50 |
51 | - (void)cacheHeight:(CGFloat)height byKey:(id)key {
52 | self.mutableHeightsByKeyForCurrentOrientation[key] = @(height);
53 | }
54 |
55 | - (CGFloat)heightForKey:(id)key {
56 | #if CGFLOAT_IS_DOUBLE
57 | return [self.mutableHeightsByKeyForCurrentOrientation[key] doubleValue];
58 | #else
59 | return [self.mutableHeightsByKeyForCurrentOrientation[key] floatValue];
60 | #endif
61 | }
62 |
63 | - (void)invalidateHeightForKey:(id)key {
64 | [self.mutableHeightsByKeyForPortrait removeObjectForKey:key];
65 | [self.mutableHeightsByKeyForLandscape removeObjectForKey:key];
66 | }
67 |
68 | - (void)invalidateAllHeightCache {
69 | [self.mutableHeightsByKeyForPortrait removeAllObjects];
70 | [self.mutableHeightsByKeyForLandscape removeAllObjects];
71 | }
72 |
73 | @end
74 |
75 | @implementation UITableView (FDKeyedHeightCache)
76 |
77 | - (FDKeyedHeightCache *)fd_keyedHeightCache {
78 | FDKeyedHeightCache *cache = objc_getAssociatedObject(self, _cmd);
79 | if (!cache) {
80 | cache = [FDKeyedHeightCache new];
81 | objc_setAssociatedObject(self, _cmd, cache, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
82 | }
83 | return cache;
84 | }
85 |
86 | @end
87 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/NSString+MJExtension.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+MJExtension.m
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/6/7.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "NSString+MJExtension.h"
10 |
11 | @implementation NSString (MJExtension)
12 | - (NSString *)mj_underlineFromCamel
13 | {
14 | if (self.length == 0) return self;
15 | NSMutableString *string = [NSMutableString string];
16 | for (NSUInteger i = 0; i= 2) [string appendString:[cmp substringFromIndex:1]];
40 | } else {
41 | [string appendString:cmp];
42 | }
43 | }
44 | return string;
45 | }
46 |
47 | - (NSString *)mj_firstCharLower
48 | {
49 | if (self.length == 0) return self;
50 | NSMutableString *string = [NSMutableString string];
51 | [string appendString:[NSString stringWithFormat:@"%c", [self characterAtIndex:0]].lowercaseString];
52 | if (self.length >= 2) [string appendString:[self substringFromIndex:1]];
53 | return string;
54 | }
55 |
56 | - (NSString *)mj_firstCharUpper
57 | {
58 | if (self.length == 0) return self;
59 | NSMutableString *string = [NSMutableString string];
60 | [string appendString:[NSString stringWithFormat:@"%c", [self characterAtIndex:0]].uppercaseString];
61 | if (self.length >= 2) [string appendString:[self substringFromIndex:1]];
62 | return string;
63 | }
64 |
65 | - (BOOL)mj_isPureInt
66 | {
67 | NSScanner *scan = [NSScanner scannerWithString:self];
68 | int val;
69 | return [scan scanInt:&val] && [scan isAtEnd];
70 | }
71 |
72 | - (NSURL *)mj_url
73 | {
74 | // [self stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"!$&'()*+,-./:;=?@_~%#[]"]];
75 | #pragma clang diagnostic push
76 | #pragma clang diagnostic ignored"-Wdeprecated-declarations"
77 | return [NSURL URLWithString:(NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)self, (CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]", NULL,kCFStringEncodingUTF8))];
78 | #pragma clang diagnostic pop
79 | }
80 | @end
81 |
82 | @implementation NSString (MJExtensionDeprecated_v_2_5_16)
83 | - (NSString *)underlineFromCamel
84 | {
85 | return self.mj_underlineFromCamel;
86 | }
87 |
88 | - (NSString *)camelFromUnderline
89 | {
90 | return self.mj_camelFromUnderline;
91 | }
92 |
93 | - (NSString *)firstCharLower
94 | {
95 | return self.mj_firstCharLower;
96 | }
97 |
98 | - (NSString *)firstCharUpper
99 | {
100 | return self.mj_firstCharUpper;
101 | }
102 |
103 | - (BOOL)isPureInt
104 | {
105 | return self.mj_isPureInt;
106 | }
107 |
108 | - (NSURL *)url
109 | {
110 | return self.mj_url;
111 | }
112 | @end
113 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/View+MASAdditions.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+MASAdditions.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 20/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import "MASUtilities.h"
10 | #import "MASConstraintMaker.h"
11 | #import "MASViewAttribute.h"
12 |
13 | /**
14 | * Provides constraint maker block
15 | * and convience methods for creating MASViewAttribute which are view + NSLayoutAttribute pairs
16 | */
17 | @interface MAS_VIEW (MASAdditions)
18 |
19 | /**
20 | * following properties return a new MASViewAttribute with current view and appropriate NSLayoutAttribute
21 | */
22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_left;
23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_top;
24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_right;
25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottom;
26 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leading;
27 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailing;
28 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_width;
29 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_height;
30 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerX;
31 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerY;
32 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline;
33 | @property (nonatomic, strong, readonly) MASViewAttribute *(^mas_attribute)(NSLayoutAttribute attr);
34 |
35 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
36 |
37 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_firstBaseline;
38 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_lastBaseline;
39 |
40 | #endif
41 |
42 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
43 |
44 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leftMargin;
45 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_rightMargin;
46 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topMargin;
47 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomMargin;
48 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leadingMargin;
49 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailingMargin;
50 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerXWithinMargins;
51 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerYWithinMargins;
52 |
53 | #endif
54 |
55 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000)
56 |
57 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide API_AVAILABLE(ios(11.0),tvos(11.0));
58 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop API_AVAILABLE(ios(11.0),tvos(11.0));
59 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom API_AVAILABLE(ios(11.0),tvos(11.0));
60 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft API_AVAILABLE(ios(11.0),tvos(11.0));
61 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight API_AVAILABLE(ios(11.0),tvos(11.0));
62 |
63 | #endif
64 |
65 | /**
66 | * a key to associate with this view
67 | */
68 | @property (nonatomic, strong) id mas_key;
69 |
70 | /**
71 | * Finds the closest common superview between this view and another view
72 | *
73 | * @param view other view
74 | *
75 | * @return returns nil if common superview could not be found
76 | */
77 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view;
78 |
79 | /**
80 | * Creates a MASConstraintMaker with the callee view.
81 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing
82 | *
83 | * @param block scope within which you can build up the constraints which you wish to apply to the view.
84 | *
85 | * @return Array of created MASConstraints
86 | */
87 | - (NSArray *)mas_makeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *make))block;
88 |
89 | /**
90 | * Creates a MASConstraintMaker with the callee view.
91 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing.
92 | * If an existing constraint exists then it will be updated instead.
93 | *
94 | * @param block scope within which you can build up the constraints which you wish to apply to the view.
95 | *
96 | * @return Array of created/updated MASConstraints
97 | */
98 | - (NSArray *)mas_updateConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *make))block;
99 |
100 | /**
101 | * Creates a MASConstraintMaker with the callee view.
102 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing.
103 | * All constraints previously installed for the view will be removed.
104 | *
105 | * @param block scope within which you can build up the constraints which you wish to apply to the view.
106 | *
107 | * @return Array of created/updated MASConstraints
108 | */
109 | - (NSArray *)mas_remakeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *make))block;
110 |
111 | @end
112 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/View+MASShorthandAdditions.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+MASShorthandAdditions.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 22/07/13.
6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved.
7 | //
8 |
9 | #import "View+MASAdditions.h"
10 |
11 | #ifdef MAS_SHORTHAND
12 |
13 | /**
14 | * Shorthand view additions without the 'mas_' prefixes,
15 | * only enabled if MAS_SHORTHAND is defined
16 | */
17 | @interface MAS_VIEW (MASShorthandAdditions)
18 |
19 | @property (nonatomic, strong, readonly) MASViewAttribute *left;
20 | @property (nonatomic, strong, readonly) MASViewAttribute *top;
21 | @property (nonatomic, strong, readonly) MASViewAttribute *right;
22 | @property (nonatomic, strong, readonly) MASViewAttribute *bottom;
23 | @property (nonatomic, strong, readonly) MASViewAttribute *leading;
24 | @property (nonatomic, strong, readonly) MASViewAttribute *trailing;
25 | @property (nonatomic, strong, readonly) MASViewAttribute *width;
26 | @property (nonatomic, strong, readonly) MASViewAttribute *height;
27 | @property (nonatomic, strong, readonly) MASViewAttribute *centerX;
28 | @property (nonatomic, strong, readonly) MASViewAttribute *centerY;
29 | @property (nonatomic, strong, readonly) MASViewAttribute *baseline;
30 | @property (nonatomic, strong, readonly) MASViewAttribute *(^attribute)(NSLayoutAttribute attr);
31 |
32 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
33 |
34 | @property (nonatomic, strong, readonly) MASViewAttribute *firstBaseline;
35 | @property (nonatomic, strong, readonly) MASViewAttribute *lastBaseline;
36 |
37 | #endif
38 |
39 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
40 |
41 | @property (nonatomic, strong, readonly) MASViewAttribute *leftMargin;
42 | @property (nonatomic, strong, readonly) MASViewAttribute *rightMargin;
43 | @property (nonatomic, strong, readonly) MASViewAttribute *topMargin;
44 | @property (nonatomic, strong, readonly) MASViewAttribute *bottomMargin;
45 | @property (nonatomic, strong, readonly) MASViewAttribute *leadingMargin;
46 | @property (nonatomic, strong, readonly) MASViewAttribute *trailingMargin;
47 | @property (nonatomic, strong, readonly) MASViewAttribute *centerXWithinMargins;
48 | @property (nonatomic, strong, readonly) MASViewAttribute *centerYWithinMargins;
49 |
50 | #endif
51 |
52 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000)
53 |
54 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideTop API_AVAILABLE(ios(11.0),tvos(11.0));
55 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideBottom API_AVAILABLE(ios(11.0),tvos(11.0));
56 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideLeft API_AVAILABLE(ios(11.0),tvos(11.0));
57 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideRight API_AVAILABLE(ios(11.0),tvos(11.0));
58 |
59 | #endif
60 |
61 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block;
62 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block;
63 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block;
64 |
65 | @end
66 |
67 | #define MAS_ATTR_FORWARD(attr) \
68 | - (MASViewAttribute *)attr { \
69 | return [self mas_##attr]; \
70 | }
71 |
72 | @implementation MAS_VIEW (MASShorthandAdditions)
73 |
74 | MAS_ATTR_FORWARD(top);
75 | MAS_ATTR_FORWARD(left);
76 | MAS_ATTR_FORWARD(bottom);
77 | MAS_ATTR_FORWARD(right);
78 | MAS_ATTR_FORWARD(leading);
79 | MAS_ATTR_FORWARD(trailing);
80 | MAS_ATTR_FORWARD(width);
81 | MAS_ATTR_FORWARD(height);
82 | MAS_ATTR_FORWARD(centerX);
83 | MAS_ATTR_FORWARD(centerY);
84 | MAS_ATTR_FORWARD(baseline);
85 |
86 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
87 |
88 | MAS_ATTR_FORWARD(firstBaseline);
89 | MAS_ATTR_FORWARD(lastBaseline);
90 |
91 | #endif
92 |
93 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
94 |
95 | MAS_ATTR_FORWARD(leftMargin);
96 | MAS_ATTR_FORWARD(rightMargin);
97 | MAS_ATTR_FORWARD(topMargin);
98 | MAS_ATTR_FORWARD(bottomMargin);
99 | MAS_ATTR_FORWARD(leadingMargin);
100 | MAS_ATTR_FORWARD(trailingMargin);
101 | MAS_ATTR_FORWARD(centerXWithinMargins);
102 | MAS_ATTR_FORWARD(centerYWithinMargins);
103 |
104 | #endif
105 |
106 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000)
107 |
108 | MAS_ATTR_FORWARD(safeAreaLayoutGuideTop);
109 | MAS_ATTR_FORWARD(safeAreaLayoutGuideBottom);
110 | MAS_ATTR_FORWARD(safeAreaLayoutGuideLeft);
111 | MAS_ATTR_FORWARD(safeAreaLayoutGuideRight);
112 |
113 | #endif
114 |
115 | - (MASViewAttribute *(^)(NSLayoutAttribute))attribute {
116 | return [self mas_attribute];
117 | }
118 |
119 | - (NSArray *)makeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block {
120 | return [self mas_makeConstraints:block];
121 | }
122 |
123 | - (NSArray *)updateConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block {
124 | return [self mas_updateConstraints:block];
125 | }
126 |
127 | - (NSArray *)remakeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block {
128 | return [self mas_remakeConstraints:block];
129 | }
130 |
131 | @end
132 |
133 | #endif
134 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASCompositeConstraint.m:
--------------------------------------------------------------------------------
1 | //
2 | // MASCompositeConstraint.m
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 21/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import "MASCompositeConstraint.h"
10 | #import "MASConstraint+Private.h"
11 |
12 | @interface MASCompositeConstraint ()
13 |
14 | @property (nonatomic, strong) id mas_key;
15 | @property (nonatomic, strong) NSMutableArray *childConstraints;
16 |
17 | @end
18 |
19 | @implementation MASCompositeConstraint
20 |
21 | - (id)initWithChildren:(NSArray *)children {
22 | self = [super init];
23 | if (!self) return nil;
24 |
25 | _childConstraints = [children mutableCopy];
26 | for (MASConstraint *constraint in _childConstraints) {
27 | constraint.delegate = self;
28 | }
29 |
30 | return self;
31 | }
32 |
33 | #pragma mark - MASConstraintDelegate
34 |
35 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint {
36 | NSUInteger index = [self.childConstraints indexOfObject:constraint];
37 | NSAssert(index != NSNotFound, @"Could not find constraint %@", constraint);
38 | [self.childConstraints replaceObjectAtIndex:index withObject:replacementConstraint];
39 | }
40 |
41 | - (MASConstraint *)constraint:(MASConstraint __unused *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
42 | id strongDelegate = self.delegate;
43 | MASConstraint *newConstraint = [strongDelegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute];
44 | newConstraint.delegate = self;
45 | [self.childConstraints addObject:newConstraint];
46 | return newConstraint;
47 | }
48 |
49 | #pragma mark - NSLayoutConstraint multiplier proxies
50 |
51 | - (MASConstraint * (^)(CGFloat))multipliedBy {
52 | return ^id(CGFloat multiplier) {
53 | for (MASConstraint *constraint in self.childConstraints) {
54 | constraint.multipliedBy(multiplier);
55 | }
56 | return self;
57 | };
58 | }
59 |
60 | - (MASConstraint * (^)(CGFloat))dividedBy {
61 | return ^id(CGFloat divider) {
62 | for (MASConstraint *constraint in self.childConstraints) {
63 | constraint.dividedBy(divider);
64 | }
65 | return self;
66 | };
67 | }
68 |
69 | #pragma mark - MASLayoutPriority proxy
70 |
71 | - (MASConstraint * (^)(MASLayoutPriority))priority {
72 | return ^id(MASLayoutPriority priority) {
73 | for (MASConstraint *constraint in self.childConstraints) {
74 | constraint.priority(priority);
75 | }
76 | return self;
77 | };
78 | }
79 |
80 | #pragma mark - NSLayoutRelation proxy
81 |
82 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation {
83 | return ^id(id attr, NSLayoutRelation relation) {
84 | for (MASConstraint *constraint in self.childConstraints.copy) {
85 | constraint.equalToWithRelation(attr, relation);
86 | }
87 | return self;
88 | };
89 | }
90 |
91 | #pragma mark - attribute chaining
92 |
93 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
94 | [self constraint:self addConstraintWithLayoutAttribute:layoutAttribute];
95 | return self;
96 | }
97 |
98 | #pragma mark - Animator proxy
99 |
100 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
101 |
102 | - (MASConstraint *)animator {
103 | for (MASConstraint *constraint in self.childConstraints) {
104 | [constraint animator];
105 | }
106 | return self;
107 | }
108 |
109 | #endif
110 |
111 | #pragma mark - debug helpers
112 |
113 | - (MASConstraint * (^)(id))key {
114 | return ^id(id key) {
115 | self.mas_key = key;
116 | int i = 0;
117 | for (MASConstraint *constraint in self.childConstraints) {
118 | constraint.key([NSString stringWithFormat:@"%@[%d]", key, i++]);
119 | }
120 | return self;
121 | };
122 | }
123 |
124 | #pragma mark - NSLayoutConstraint constant setters
125 |
126 | - (void)setInsets:(MASEdgeInsets)insets {
127 | for (MASConstraint *constraint in self.childConstraints) {
128 | constraint.insets = insets;
129 | }
130 | }
131 |
132 | - (void)setInset:(CGFloat)inset {
133 | for (MASConstraint *constraint in self.childConstraints) {
134 | constraint.inset = inset;
135 | }
136 | }
137 |
138 | - (void)setOffset:(CGFloat)offset {
139 | for (MASConstraint *constraint in self.childConstraints) {
140 | constraint.offset = offset;
141 | }
142 | }
143 |
144 | - (void)setSizeOffset:(CGSize)sizeOffset {
145 | for (MASConstraint *constraint in self.childConstraints) {
146 | constraint.sizeOffset = sizeOffset;
147 | }
148 | }
149 |
150 | - (void)setCenterOffset:(CGPoint)centerOffset {
151 | for (MASConstraint *constraint in self.childConstraints) {
152 | constraint.centerOffset = centerOffset;
153 | }
154 | }
155 |
156 | #pragma mark - MASConstraint
157 |
158 | - (void)activate {
159 | for (MASConstraint *constraint in self.childConstraints) {
160 | [constraint activate];
161 | }
162 | }
163 |
164 | - (void)deactivate {
165 | for (MASConstraint *constraint in self.childConstraints) {
166 | [constraint deactivate];
167 | }
168 | }
169 |
170 | - (void)install {
171 | for (MASConstraint *constraint in self.childConstraints) {
172 | constraint.updateExisting = self.updateExisting;
173 | [constraint install];
174 | }
175 | }
176 |
177 | - (void)uninstall {
178 | for (MASConstraint *constraint in self.childConstraints) {
179 | [constraint uninstall];
180 | }
181 | }
182 |
183 | @end
184 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCell.h:
--------------------------------------------------------------------------------
1 | // The MIT License (MIT)
2 | //
3 | // Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )
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 | #import
24 | #import "UITableView+FDKeyedHeightCache.h"
25 | #import "UITableView+FDIndexPathHeightCache.h"
26 | #import "UITableView+FDTemplateLayoutCellDebug.h"
27 |
28 | @interface UITableView (FDTemplateLayoutCell)
29 |
30 | /// Access to internal template layout cell for given reuse identifier.
31 | /// Generally, you don't need to know these template layout cells.
32 | ///
33 | /// @param identifier Reuse identifier for cell which must be registered.
34 | ///
35 | - (__kindof UITableViewCell *)fd_templateCellForReuseIdentifier:(NSString *)identifier;
36 |
37 | /// Returns height of cell of type specifed by a reuse identifier and configured
38 | /// by the configuration block.
39 | ///
40 | /// The cell would be layed out on a fixed-width, vertically expanding basis with
41 | /// respect to its dynamic content, using auto layout. Thus, it is imperative that
42 | /// the cell was set up to be self-satisfied, i.e. its content always determines
43 | /// its height given the width is equal to the tableview's.
44 | ///
45 | /// @param identifier A string identifier for retrieving and maintaining template
46 | /// cells with system's "-dequeueReusableCellWithIdentifier:" call.
47 | /// @param configuration An optional block for configuring and providing content
48 | /// to the template cell. The configuration should be minimal for scrolling
49 | /// performance yet sufficient for calculating cell's height.
50 | ///
51 | - (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier configuration:(void (^)(id cell))configuration;
52 |
53 | /// This method does what "-fd_heightForCellWithIdentifier:configuration" does, and
54 | /// calculated height will be cached by its index path, returns a cached height
55 | /// when needed. Therefore lots of extra height calculations could be saved.
56 | ///
57 | /// No need to worry about invalidating cached heights when data source changes, it
58 | /// will be done automatically when you call "-reloadData" or any method that triggers
59 | /// UITableView's reloading.
60 | ///
61 | /// @param indexPath where this cell's height cache belongs.
62 | ///
63 | - (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier cacheByIndexPath:(NSIndexPath *)indexPath configuration:(void (^)(id cell))configuration;
64 |
65 | /// This method caches height by your model entity's identifier.
66 | /// If your model's changed, call "-invalidateHeightForKey:(id )key" to
67 | /// invalidate cache and re-calculate, it's much cheaper and effective than "cacheByIndexPath".
68 | ///
69 | /// @param key model entity's identifier whose data configures a cell.
70 | ///
71 | - (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier cacheByKey:(id)key configuration:(void (^)(id cell))configuration;
72 |
73 | @end
74 |
75 | @interface UITableView (FDTemplateLayoutHeaderFooterView)
76 |
77 | /// Returns header or footer view's height that registered in table view with reuse identifier.
78 | ///
79 | /// Use it after calling "-[UITableView registerNib/Class:forHeaderFooterViewReuseIdentifier]",
80 | /// same with "-fd_heightForCellWithIdentifier:configuration:", it will call "-sizeThatFits:" for
81 | /// subclass of UITableViewHeaderFooterView which is not using Auto Layout.
82 | ///
83 | - (CGFloat)fd_heightForHeaderFooterViewWithIdentifier:(NSString *)identifier configuration:(void (^)(id headerFooterView))configuration;
84 |
85 | @end
86 |
87 | @interface UITableViewCell (FDTemplateLayoutCell)
88 |
89 | /// Indicate this is a template layout cell for calculation only.
90 | /// You may need this when there are non-UI side effects when configure a cell.
91 | /// Like:
92 | /// - (void)configureCell:(FooCell *)cell atIndexPath:(NSIndexPath *)indexPath {
93 | /// cell.entity = [self entityAtIndexPath:indexPath];
94 | /// if (!cell.fd_isTemplateLayoutCell) {
95 | /// [self notifySomething]; // non-UI side effects
96 | /// }
97 | /// }
98 | ///
99 | @property (nonatomic, assign) BOOL fd_isTemplateLayoutCell;
100 |
101 | /// Enable to enforce this template layout cell to use "frame layout" rather than "auto layout",
102 | /// and will ask cell's height by calling "-sizeThatFits:", so you must override this method.
103 | /// Use this property only when you want to manually control this template layout cell's height
104 | /// calculation mode, default to NO.
105 | ///
106 | @property (nonatomic, assign) BOOL fd_enforceFrameLayout;
107 |
108 | @end
109 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/SVProgressHUD/SVIndefiniteAnimatedView.m:
--------------------------------------------------------------------------------
1 | //
2 | // SVIndefiniteAnimatedView.m
3 | // SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
4 | //
5 | // Copyright (c) 2014-2018 Guillaume Campagna. All rights reserved.
6 | //
7 |
8 | #import "SVIndefiniteAnimatedView.h"
9 | #import "SVProgressHUD.h"
10 |
11 | @interface SVIndefiniteAnimatedView ()
12 |
13 | @property (nonatomic, strong) CAShapeLayer *indefiniteAnimatedLayer;
14 |
15 | @end
16 |
17 | @implementation SVIndefiniteAnimatedView
18 |
19 | - (void)willMoveToSuperview:(UIView*)newSuperview {
20 | if (newSuperview) {
21 | [self layoutAnimatedLayer];
22 | } else {
23 | [_indefiniteAnimatedLayer removeFromSuperlayer];
24 | _indefiniteAnimatedLayer = nil;
25 | }
26 | }
27 |
28 | - (void)layoutAnimatedLayer {
29 | CALayer *layer = self.indefiniteAnimatedLayer;
30 | [self.layer addSublayer:layer];
31 |
32 | CGFloat widthDiff = CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds);
33 | CGFloat heightDiff = CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds);
34 | layer.position = CGPointMake(CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds) / 2 - widthDiff / 2, CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds) / 2 - heightDiff / 2);
35 | }
36 |
37 | - (CAShapeLayer*)indefiniteAnimatedLayer {
38 | if(!_indefiniteAnimatedLayer) {
39 | CGPoint arcCenter = CGPointMake(self.radius+self.strokeThickness/2+5, self.radius+self.strokeThickness/2+5);
40 | UIBezierPath* smoothedPath = [UIBezierPath bezierPathWithArcCenter:arcCenter radius:self.radius startAngle:(CGFloat) (M_PI*3/2) endAngle:(CGFloat) (M_PI/2+M_PI*5) clockwise:YES];
41 |
42 | _indefiniteAnimatedLayer = [CAShapeLayer layer];
43 | _indefiniteAnimatedLayer.contentsScale = [[UIScreen mainScreen] scale];
44 | _indefiniteAnimatedLayer.frame = CGRectMake(0.0f, 0.0f, arcCenter.x*2, arcCenter.y*2);
45 | _indefiniteAnimatedLayer.fillColor = [UIColor clearColor].CGColor;
46 | _indefiniteAnimatedLayer.strokeColor = self.strokeColor.CGColor;
47 | _indefiniteAnimatedLayer.lineWidth = self.strokeThickness;
48 | _indefiniteAnimatedLayer.lineCap = kCALineCapRound;
49 | _indefiniteAnimatedLayer.lineJoin = kCALineJoinBevel;
50 | _indefiniteAnimatedLayer.path = smoothedPath.CGPath;
51 |
52 | CALayer *maskLayer = [CALayer layer];
53 |
54 | NSBundle *bundle = [NSBundle bundleForClass:[SVProgressHUD class]];
55 | NSURL *url = [bundle URLForResource:@"SVProgressHUD" withExtension:@"bundle"];
56 | NSBundle *imageBundle = [NSBundle bundleWithURL:url];
57 |
58 | NSString *path = [imageBundle pathForResource:@"angle-mask" ofType:@"png"];
59 |
60 | maskLayer.contents = (__bridge id)[[UIImage imageWithContentsOfFile:path] CGImage];
61 | maskLayer.frame = _indefiniteAnimatedLayer.bounds;
62 | _indefiniteAnimatedLayer.mask = maskLayer;
63 |
64 | NSTimeInterval animationDuration = 1;
65 | CAMediaTimingFunction *linearCurve = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
66 |
67 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
68 | animation.fromValue = (id) 0;
69 | animation.toValue = @(M_PI*2);
70 | animation.duration = animationDuration;
71 | animation.timingFunction = linearCurve;
72 | animation.removedOnCompletion = NO;
73 | animation.repeatCount = INFINITY;
74 | animation.fillMode = kCAFillModeForwards;
75 | animation.autoreverses = NO;
76 | [_indefiniteAnimatedLayer.mask addAnimation:animation forKey:@"rotate"];
77 |
78 | CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
79 | animationGroup.duration = animationDuration;
80 | animationGroup.repeatCount = INFINITY;
81 | animationGroup.removedOnCompletion = NO;
82 | animationGroup.timingFunction = linearCurve;
83 |
84 | CABasicAnimation *strokeStartAnimation = [CABasicAnimation animationWithKeyPath:@"strokeStart"];
85 | strokeStartAnimation.fromValue = @0.015;
86 | strokeStartAnimation.toValue = @0.515;
87 |
88 | CABasicAnimation *strokeEndAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
89 | strokeEndAnimation.fromValue = @0.485;
90 | strokeEndAnimation.toValue = @0.985;
91 |
92 | animationGroup.animations = @[strokeStartAnimation, strokeEndAnimation];
93 | [_indefiniteAnimatedLayer addAnimation:animationGroup forKey:@"progress"];
94 |
95 | }
96 | return _indefiniteAnimatedLayer;
97 | }
98 |
99 | - (void)setFrame:(CGRect)frame {
100 | if(!CGRectEqualToRect(frame, super.frame)) {
101 | [super setFrame:frame];
102 |
103 | if(self.superview) {
104 | [self layoutAnimatedLayer];
105 | }
106 | }
107 |
108 | }
109 |
110 | - (void)setRadius:(CGFloat)radius {
111 | if(radius != _radius) {
112 | _radius = radius;
113 |
114 | [_indefiniteAnimatedLayer removeFromSuperlayer];
115 | _indefiniteAnimatedLayer = nil;
116 |
117 | if(self.superview) {
118 | [self layoutAnimatedLayer];
119 | }
120 | }
121 | }
122 |
123 | - (void)setStrokeColor:(UIColor*)strokeColor {
124 | _strokeColor = strokeColor;
125 | _indefiniteAnimatedLayer.strokeColor = strokeColor.CGColor;
126 | }
127 |
128 | - (void)setStrokeThickness:(CGFloat)strokeThickness {
129 | _strokeThickness = strokeThickness;
130 | _indefiniteAnimatedLayer.lineWidth = _strokeThickness;
131 | }
132 |
133 | - (CGSize)sizeThatFits:(CGSize)size {
134 | return CGSizeMake((self.radius+self.strokeThickness/2+5)*2, (self.radius+self.strokeThickness/2+5)*2);
135 | }
136 |
137 | @end
138 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/NSObject+MJClass.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+MJClass.m
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/8/11.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "NSObject+MJClass.h"
10 | #import "NSObject+MJCoding.h"
11 | #import "NSObject+MJKeyValue.h"
12 | #import "MJFoundation.h"
13 | #import
14 |
15 | static const char MJAllowedPropertyNamesKey = '\0';
16 | static const char MJIgnoredPropertyNamesKey = '\0';
17 | static const char MJAllowedCodingPropertyNamesKey = '\0';
18 | static const char MJIgnoredCodingPropertyNamesKey = '\0';
19 |
20 | @implementation NSObject (MJClass)
21 |
22 | + (NSMutableDictionary *)classDictForKey:(const void *)key
23 | {
24 | static NSMutableDictionary *allowedPropertyNamesDict;
25 | static NSMutableDictionary *ignoredPropertyNamesDict;
26 | static NSMutableDictionary *allowedCodingPropertyNamesDict;
27 | static NSMutableDictionary *ignoredCodingPropertyNamesDict;
28 |
29 | static dispatch_once_t onceToken;
30 | dispatch_once(&onceToken, ^{
31 | allowedPropertyNamesDict = [NSMutableDictionary dictionary];
32 | ignoredPropertyNamesDict = [NSMutableDictionary dictionary];
33 | allowedCodingPropertyNamesDict = [NSMutableDictionary dictionary];
34 | ignoredCodingPropertyNamesDict = [NSMutableDictionary dictionary];
35 | });
36 |
37 | if (key == &MJAllowedPropertyNamesKey) return allowedPropertyNamesDict;
38 | if (key == &MJIgnoredPropertyNamesKey) return ignoredPropertyNamesDict;
39 | if (key == &MJAllowedCodingPropertyNamesKey) return allowedCodingPropertyNamesDict;
40 | if (key == &MJIgnoredCodingPropertyNamesKey) return ignoredCodingPropertyNamesDict;
41 | return nil;
42 | }
43 |
44 | + (void)mj_enumerateClasses:(MJClassesEnumeration)enumeration
45 | {
46 | // 1.没有block就直接返回
47 | if (enumeration == nil) return;
48 |
49 | // 2.停止遍历的标记
50 | BOOL stop = NO;
51 |
52 | // 3.当前正在遍历的类
53 | Class c = self;
54 |
55 | // 4.开始遍历每一个类
56 | while (c && !stop) {
57 | // 4.1.执行操作
58 | enumeration(c, &stop);
59 |
60 | // 4.2.获得父类
61 | c = class_getSuperclass(c);
62 |
63 | if ([MJFoundation isClassFromFoundation:c]) break;
64 | }
65 | }
66 |
67 | + (void)mj_enumerateAllClasses:(MJClassesEnumeration)enumeration
68 | {
69 | // 1.没有block就直接返回
70 | if (enumeration == nil) return;
71 |
72 | // 2.停止遍历的标记
73 | BOOL stop = NO;
74 |
75 | // 3.当前正在遍历的类
76 | Class c = self;
77 |
78 | // 4.开始遍历每一个类
79 | while (c && !stop) {
80 | // 4.1.执行操作
81 | enumeration(c, &stop);
82 |
83 | // 4.2.获得父类
84 | c = class_getSuperclass(c);
85 | }
86 | }
87 |
88 | #pragma mark - 属性黑名单配置
89 | + (void)mj_setupIgnoredPropertyNames:(MJIgnoredPropertyNames)ignoredPropertyNames
90 | {
91 | [self mj_setupBlockReturnValue:ignoredPropertyNames key:&MJIgnoredPropertyNamesKey];
92 | }
93 |
94 | + (NSMutableArray *)mj_totalIgnoredPropertyNames
95 | {
96 | return [self mj_totalObjectsWithSelector:@selector(mj_ignoredPropertyNames) key:&MJIgnoredPropertyNamesKey];
97 | }
98 |
99 | #pragma mark - 归档属性黑名单配置
100 | + (void)mj_setupIgnoredCodingPropertyNames:(MJIgnoredCodingPropertyNames)ignoredCodingPropertyNames
101 | {
102 | [self mj_setupBlockReturnValue:ignoredCodingPropertyNames key:&MJIgnoredCodingPropertyNamesKey];
103 | }
104 |
105 | + (NSMutableArray *)mj_totalIgnoredCodingPropertyNames
106 | {
107 | return [self mj_totalObjectsWithSelector:@selector(mj_ignoredCodingPropertyNames) key:&MJIgnoredCodingPropertyNamesKey];
108 | }
109 |
110 | #pragma mark - 属性白名单配置
111 | + (void)mj_setupAllowedPropertyNames:(MJAllowedPropertyNames)allowedPropertyNames;
112 | {
113 | [self mj_setupBlockReturnValue:allowedPropertyNames key:&MJAllowedPropertyNamesKey];
114 | }
115 |
116 | + (NSMutableArray *)mj_totalAllowedPropertyNames
117 | {
118 | return [self mj_totalObjectsWithSelector:@selector(mj_allowedPropertyNames) key:&MJAllowedPropertyNamesKey];
119 | }
120 |
121 | #pragma mark - 归档属性白名单配置
122 | + (void)mj_setupAllowedCodingPropertyNames:(MJAllowedCodingPropertyNames)allowedCodingPropertyNames
123 | {
124 | [self mj_setupBlockReturnValue:allowedCodingPropertyNames key:&MJAllowedCodingPropertyNamesKey];
125 | }
126 |
127 | + (NSMutableArray *)mj_totalAllowedCodingPropertyNames
128 | {
129 | return [self mj_totalObjectsWithSelector:@selector(mj_allowedCodingPropertyNames) key:&MJAllowedCodingPropertyNamesKey];
130 | }
131 |
132 | #pragma mark - block和方法处理:存储block的返回值
133 | + (void)mj_setupBlockReturnValue:(id (^)(void))block key:(const char *)key
134 | {
135 | if (block) {
136 | objc_setAssociatedObject(self, key, block(), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
137 | } else {
138 | objc_setAssociatedObject(self, key, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
139 | }
140 |
141 | // 清空数据
142 | MJExtensionSemaphoreCreate
143 | MJExtensionSemaphoreWait
144 | [[self classDictForKey:key] removeAllObjects];
145 | MJExtensionSemaphoreSignal
146 | }
147 |
148 | + (NSMutableArray *)mj_totalObjectsWithSelector:(SEL)selector key:(const char *)key
149 | {
150 | MJExtensionSemaphoreCreate
151 | MJExtensionSemaphoreWait
152 |
153 | NSMutableArray *array = [self classDictForKey:key][NSStringFromClass(self)];
154 | if (array == nil) {
155 | // 创建、存储
156 | [self classDictForKey:key][NSStringFromClass(self)] = array = [NSMutableArray array];
157 |
158 | if ([self respondsToSelector:selector]) {
159 | #pragma clang diagnostic push
160 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
161 | NSArray *subArray = [self performSelector:selector];
162 | #pragma clang diagnostic pop
163 | if (subArray) {
164 | [array addObjectsFromArray:subArray];
165 | }
166 | }
167 |
168 | [self mj_enumerateAllClasses:^(__unsafe_unretained Class c, BOOL *stop) {
169 | NSArray *subArray = objc_getAssociatedObject(c, key);
170 | [array addObjectsFromArray:subArray];
171 | }];
172 | }
173 |
174 | MJExtensionSemaphoreSignal
175 |
176 | return array;
177 | }
178 | @end
179 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASConstraintMaker.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASConstraintMaker.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 20/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import "MASConstraint.h"
10 | #import "MASUtilities.h"
11 |
12 | typedef NS_OPTIONS(NSInteger, MASAttribute) {
13 | MASAttributeLeft = 1 << NSLayoutAttributeLeft,
14 | MASAttributeRight = 1 << NSLayoutAttributeRight,
15 | MASAttributeTop = 1 << NSLayoutAttributeTop,
16 | MASAttributeBottom = 1 << NSLayoutAttributeBottom,
17 | MASAttributeLeading = 1 << NSLayoutAttributeLeading,
18 | MASAttributeTrailing = 1 << NSLayoutAttributeTrailing,
19 | MASAttributeWidth = 1 << NSLayoutAttributeWidth,
20 | MASAttributeHeight = 1 << NSLayoutAttributeHeight,
21 | MASAttributeCenterX = 1 << NSLayoutAttributeCenterX,
22 | MASAttributeCenterY = 1 << NSLayoutAttributeCenterY,
23 | MASAttributeBaseline = 1 << NSLayoutAttributeBaseline,
24 |
25 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
26 |
27 | MASAttributeFirstBaseline = 1 << NSLayoutAttributeFirstBaseline,
28 | MASAttributeLastBaseline = 1 << NSLayoutAttributeLastBaseline,
29 |
30 | #endif
31 |
32 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
33 |
34 | MASAttributeLeftMargin = 1 << NSLayoutAttributeLeftMargin,
35 | MASAttributeRightMargin = 1 << NSLayoutAttributeRightMargin,
36 | MASAttributeTopMargin = 1 << NSLayoutAttributeTopMargin,
37 | MASAttributeBottomMargin = 1 << NSLayoutAttributeBottomMargin,
38 | MASAttributeLeadingMargin = 1 << NSLayoutAttributeLeadingMargin,
39 | MASAttributeTrailingMargin = 1 << NSLayoutAttributeTrailingMargin,
40 | MASAttributeCenterXWithinMargins = 1 << NSLayoutAttributeCenterXWithinMargins,
41 | MASAttributeCenterYWithinMargins = 1 << NSLayoutAttributeCenterYWithinMargins,
42 |
43 | #endif
44 |
45 | };
46 |
47 | /**
48 | * Provides factory methods for creating MASConstraints.
49 | * Constraints are collected until they are ready to be installed
50 | *
51 | */
52 | @interface MASConstraintMaker : NSObject
53 |
54 | /**
55 | * The following properties return a new MASViewConstraint
56 | * with the first item set to the makers associated view and the appropriate MASViewAttribute
57 | */
58 | @property (nonatomic, strong, readonly) MASConstraint *left;
59 | @property (nonatomic, strong, readonly) MASConstraint *top;
60 | @property (nonatomic, strong, readonly) MASConstraint *right;
61 | @property (nonatomic, strong, readonly) MASConstraint *bottom;
62 | @property (nonatomic, strong, readonly) MASConstraint *leading;
63 | @property (nonatomic, strong, readonly) MASConstraint *trailing;
64 | @property (nonatomic, strong, readonly) MASConstraint *width;
65 | @property (nonatomic, strong, readonly) MASConstraint *height;
66 | @property (nonatomic, strong, readonly) MASConstraint *centerX;
67 | @property (nonatomic, strong, readonly) MASConstraint *centerY;
68 | @property (nonatomic, strong, readonly) MASConstraint *baseline;
69 |
70 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
71 |
72 | @property (nonatomic, strong, readonly) MASConstraint *firstBaseline;
73 | @property (nonatomic, strong, readonly) MASConstraint *lastBaseline;
74 |
75 | #endif
76 |
77 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
78 |
79 | @property (nonatomic, strong, readonly) MASConstraint *leftMargin;
80 | @property (nonatomic, strong, readonly) MASConstraint *rightMargin;
81 | @property (nonatomic, strong, readonly) MASConstraint *topMargin;
82 | @property (nonatomic, strong, readonly) MASConstraint *bottomMargin;
83 | @property (nonatomic, strong, readonly) MASConstraint *leadingMargin;
84 | @property (nonatomic, strong, readonly) MASConstraint *trailingMargin;
85 | @property (nonatomic, strong, readonly) MASConstraint *centerXWithinMargins;
86 | @property (nonatomic, strong, readonly) MASConstraint *centerYWithinMargins;
87 |
88 | #endif
89 |
90 | /**
91 | * Returns a block which creates a new MASCompositeConstraint with the first item set
92 | * to the makers associated view and children corresponding to the set bits in the
93 | * MASAttribute parameter. Combine multiple attributes via binary-or.
94 | */
95 | @property (nonatomic, strong, readonly) MASConstraint *(^attributes)(MASAttribute attrs);
96 |
97 | /**
98 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeEdges
99 | * which generates the appropriate MASViewConstraint children (top, left, bottom, right)
100 | * with the first item set to the makers associated view
101 | */
102 | @property (nonatomic, strong, readonly) MASConstraint *edges;
103 |
104 | /**
105 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeSize
106 | * which generates the appropriate MASViewConstraint children (width, height)
107 | * with the first item set to the makers associated view
108 | */
109 | @property (nonatomic, strong, readonly) MASConstraint *size;
110 |
111 | /**
112 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeCenter
113 | * which generates the appropriate MASViewConstraint children (centerX, centerY)
114 | * with the first item set to the makers associated view
115 | */
116 | @property (nonatomic, strong, readonly) MASConstraint *center;
117 |
118 | /**
119 | * Whether or not to check for an existing constraint instead of adding constraint
120 | */
121 | @property (nonatomic, assign) BOOL updateExisting;
122 |
123 | /**
124 | * Whether or not to remove existing constraints prior to installing
125 | */
126 | @property (nonatomic, assign) BOOL removeExisting;
127 |
128 | /**
129 | * initialises the maker with a default view
130 | *
131 | * @param view any MASConstraint are created with this view as the first item
132 | *
133 | * @return a new MASConstraintMaker
134 | */
135 | - (id)initWithView:(MAS_VIEW *)view;
136 |
137 | /**
138 | * Calls install method on any MASConstraints which have been created by this maker
139 | *
140 | * @return an array of all the installed MASConstraints
141 | */
142 | - (NSArray *)install;
143 |
144 | - (MASConstraint * (^)(dispatch_block_t))group;
145 |
146 | @end
147 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/NSLayoutConstraint+MASDebugAdditions.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSLayoutConstraint+MASDebugAdditions.m
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 3/08/13.
6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved.
7 | //
8 |
9 | #import "NSLayoutConstraint+MASDebugAdditions.h"
10 | #import "MASConstraint.h"
11 | #import "MASLayoutConstraint.h"
12 |
13 | @implementation NSLayoutConstraint (MASDebugAdditions)
14 |
15 | #pragma mark - description maps
16 |
17 | + (NSDictionary *)layoutRelationDescriptionsByValue {
18 | static dispatch_once_t once;
19 | static NSDictionary *descriptionMap;
20 | dispatch_once(&once, ^{
21 | descriptionMap = @{
22 | @(NSLayoutRelationEqual) : @"==",
23 | @(NSLayoutRelationGreaterThanOrEqual) : @">=",
24 | @(NSLayoutRelationLessThanOrEqual) : @"<=",
25 | };
26 | });
27 | return descriptionMap;
28 | }
29 |
30 | + (NSDictionary *)layoutAttributeDescriptionsByValue {
31 | static dispatch_once_t once;
32 | static NSDictionary *descriptionMap;
33 | dispatch_once(&once, ^{
34 | descriptionMap = @{
35 | @(NSLayoutAttributeTop) : @"top",
36 | @(NSLayoutAttributeLeft) : @"left",
37 | @(NSLayoutAttributeBottom) : @"bottom",
38 | @(NSLayoutAttributeRight) : @"right",
39 | @(NSLayoutAttributeLeading) : @"leading",
40 | @(NSLayoutAttributeTrailing) : @"trailing",
41 | @(NSLayoutAttributeWidth) : @"width",
42 | @(NSLayoutAttributeHeight) : @"height",
43 | @(NSLayoutAttributeCenterX) : @"centerX",
44 | @(NSLayoutAttributeCenterY) : @"centerY",
45 | @(NSLayoutAttributeBaseline) : @"baseline",
46 |
47 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
48 | @(NSLayoutAttributeFirstBaseline) : @"firstBaseline",
49 | @(NSLayoutAttributeLastBaseline) : @"lastBaseline",
50 | #endif
51 |
52 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
53 | @(NSLayoutAttributeLeftMargin) : @"leftMargin",
54 | @(NSLayoutAttributeRightMargin) : @"rightMargin",
55 | @(NSLayoutAttributeTopMargin) : @"topMargin",
56 | @(NSLayoutAttributeBottomMargin) : @"bottomMargin",
57 | @(NSLayoutAttributeLeadingMargin) : @"leadingMargin",
58 | @(NSLayoutAttributeTrailingMargin) : @"trailingMargin",
59 | @(NSLayoutAttributeCenterXWithinMargins) : @"centerXWithinMargins",
60 | @(NSLayoutAttributeCenterYWithinMargins) : @"centerYWithinMargins",
61 | #endif
62 |
63 | };
64 |
65 | });
66 | return descriptionMap;
67 | }
68 |
69 |
70 | + (NSDictionary *)layoutPriorityDescriptionsByValue {
71 | static dispatch_once_t once;
72 | static NSDictionary *descriptionMap;
73 | dispatch_once(&once, ^{
74 | #if TARGET_OS_IPHONE || TARGET_OS_TV
75 | descriptionMap = @{
76 | @(MASLayoutPriorityDefaultHigh) : @"high",
77 | @(MASLayoutPriorityDefaultLow) : @"low",
78 | @(MASLayoutPriorityDefaultMedium) : @"medium",
79 | @(MASLayoutPriorityRequired) : @"required",
80 | @(MASLayoutPriorityFittingSizeLevel) : @"fitting size",
81 | };
82 | #elif TARGET_OS_MAC
83 | descriptionMap = @{
84 | @(MASLayoutPriorityDefaultHigh) : @"high",
85 | @(MASLayoutPriorityDragThatCanResizeWindow) : @"drag can resize window",
86 | @(MASLayoutPriorityDefaultMedium) : @"medium",
87 | @(MASLayoutPriorityWindowSizeStayPut) : @"window size stay put",
88 | @(MASLayoutPriorityDragThatCannotResizeWindow) : @"drag cannot resize window",
89 | @(MASLayoutPriorityDefaultLow) : @"low",
90 | @(MASLayoutPriorityFittingSizeCompression) : @"fitting size",
91 | @(MASLayoutPriorityRequired) : @"required",
92 | };
93 | #endif
94 | });
95 | return descriptionMap;
96 | }
97 |
98 | #pragma mark - description override
99 |
100 | + (NSString *)descriptionForObject:(id)obj {
101 | if ([obj respondsToSelector:@selector(mas_key)] && [obj mas_key]) {
102 | return [NSString stringWithFormat:@"%@:%@", [obj class], [obj mas_key]];
103 | }
104 | return [NSString stringWithFormat:@"%@:%p", [obj class], obj];
105 | }
106 |
107 | - (NSString *)description {
108 | NSMutableString *description = [[NSMutableString alloc] initWithString:@"<"];
109 |
110 | [description appendString:[self.class descriptionForObject:self]];
111 |
112 | [description appendFormat:@" %@", [self.class descriptionForObject:self.firstItem]];
113 | if (self.firstAttribute != NSLayoutAttributeNotAnAttribute) {
114 | [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.firstAttribute)]];
115 | }
116 |
117 | [description appendFormat:@" %@", self.class.layoutRelationDescriptionsByValue[@(self.relation)]];
118 |
119 | if (self.secondItem) {
120 | [description appendFormat:@" %@", [self.class descriptionForObject:self.secondItem]];
121 | }
122 | if (self.secondAttribute != NSLayoutAttributeNotAnAttribute) {
123 | [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.secondAttribute)]];
124 | }
125 |
126 | if (self.multiplier != 1) {
127 | [description appendFormat:@" * %g", self.multiplier];
128 | }
129 |
130 | if (self.secondAttribute == NSLayoutAttributeNotAnAttribute) {
131 | [description appendFormat:@" %g", self.constant];
132 | } else {
133 | if (self.constant) {
134 | [description appendFormat:@" %@ %g", (self.constant < 0 ? @"-" : @"+"), ABS(self.constant)];
135 | }
136 | }
137 |
138 | if (self.priority != MASLayoutPriorityRequired) {
139 | [description appendFormat:@" ^%@", self.class.layoutPriorityDescriptionsByValue[@(self.priority)] ?: [NSNumber numberWithDouble:self.priority]];
140 | }
141 |
142 | [description appendString:@">"];
143 | return description;
144 | }
145 |
146 | @end
147 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/MJProperty.m:
--------------------------------------------------------------------------------
1 | //
2 | // MJProperty.m
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/4/17.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJProperty.h"
10 | #import "MJFoundation.h"
11 | #import "MJExtensionConst.h"
12 | #import
13 |
14 | @interface MJProperty()
15 | @property (strong, nonatomic) NSMutableDictionary *propertyKeysDict;
16 | @property (strong, nonatomic) NSMutableDictionary *objectClassInArrayDict;
17 | @end
18 |
19 | @implementation MJProperty
20 |
21 | #pragma mark - 初始化
22 | - (instancetype)init
23 | {
24 | if (self = [super init]) {
25 | _propertyKeysDict = [NSMutableDictionary dictionary];
26 | _objectClassInArrayDict = [NSMutableDictionary dictionary];
27 | }
28 | return self;
29 | }
30 |
31 | #pragma mark - 缓存
32 | + (instancetype)cachedPropertyWithProperty:(objc_property_t)property
33 | {
34 | MJExtensionSemaphoreCreate
35 | MJExtensionSemaphoreWait
36 | MJProperty *propertyObj = objc_getAssociatedObject(self, property);
37 | if (propertyObj == nil) {
38 | propertyObj = [[self alloc] init];
39 | propertyObj.property = property;
40 | objc_setAssociatedObject(self, property, propertyObj, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
41 | }
42 | MJExtensionSemaphoreSignal
43 | return propertyObj;
44 | }
45 |
46 | #pragma mark - 公共方法
47 | - (void)setProperty:(objc_property_t)property
48 | {
49 | _property = property;
50 |
51 | MJExtensionAssertParamNotNil(property);
52 |
53 | // 1.属性名
54 | _name = @(property_getName(property));
55 |
56 | // 2.成员类型
57 | NSString *attrs = @(property_getAttributes(property));
58 | NSUInteger dotLoc = [attrs rangeOfString:@","].location;
59 | NSString *code = nil;
60 | NSUInteger loc = 1;
61 | if (dotLoc == NSNotFound) { // 没有,
62 | code = [attrs substringFromIndex:loc];
63 | } else {
64 | code = [attrs substringWithRange:NSMakeRange(loc, dotLoc - loc)];
65 | }
66 | _type = [MJPropertyType cachedTypeWithCode:code];
67 | }
68 |
69 | /**
70 | * 获得成员变量的值
71 | */
72 | - (id)valueForObject:(id)object
73 | {
74 | if (self.type.KVCDisabled) return [NSNull null];
75 | return [object valueForKey:self.name];
76 | }
77 |
78 | /**
79 | * 设置成员变量的值
80 | */
81 | - (void)setValue:(id)value forObject:(id)object
82 | {
83 | if (self.type.KVCDisabled || value == nil) return;
84 | [object setValue:value forKey:self.name];
85 | }
86 |
87 | /**
88 | * 通过字符串key创建对应的keys
89 | */
90 | - (NSArray *)propertyKeysWithStringKey:(NSString *)stringKey
91 | {
92 | if (stringKey.length == 0) return nil;
93 |
94 | NSMutableArray *propertyKeys = [NSMutableArray array];
95 | // 如果有多级映射
96 | NSArray *oldKeys = [stringKey componentsSeparatedByString:@"."];
97 |
98 | for (NSString *oldKey in oldKeys) {
99 | NSUInteger start = [oldKey rangeOfString:@"["].location;
100 | if (start != NSNotFound) { // 有索引的key
101 | NSString *prefixKey = [oldKey substringToIndex:start];
102 | NSString *indexKey = prefixKey;
103 | if (prefixKey.length) {
104 | MJPropertyKey *propertyKey = [[MJPropertyKey alloc] init];
105 | propertyKey.name = prefixKey;
106 | [propertyKeys addObject:propertyKey];
107 |
108 | indexKey = [oldKey stringByReplacingOccurrencesOfString:prefixKey withString:@""];
109 | }
110 |
111 | /** 解析索引 **/
112 | // 元素
113 | NSArray *cmps = [[indexKey stringByReplacingOccurrencesOfString:@"[" withString:@""] componentsSeparatedByString:@"]"];
114 | for (NSInteger i = 0; i
10 |
11 |
12 |
13 | #if TARGET_OS_IPHONE || TARGET_OS_TV
14 |
15 | #import
16 | #define MAS_VIEW UIView
17 | #define MAS_VIEW_CONTROLLER UIViewController
18 | #define MASEdgeInsets UIEdgeInsets
19 |
20 | typedef UILayoutPriority MASLayoutPriority;
21 | static const MASLayoutPriority MASLayoutPriorityRequired = UILayoutPriorityRequired;
22 | static const MASLayoutPriority MASLayoutPriorityDefaultHigh = UILayoutPriorityDefaultHigh;
23 | static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 500;
24 | static const MASLayoutPriority MASLayoutPriorityDefaultLow = UILayoutPriorityDefaultLow;
25 | static const MASLayoutPriority MASLayoutPriorityFittingSizeLevel = UILayoutPriorityFittingSizeLevel;
26 |
27 | #elif TARGET_OS_MAC
28 |
29 | #import
30 | #define MAS_VIEW NSView
31 | #define MASEdgeInsets NSEdgeInsets
32 |
33 | typedef NSLayoutPriority MASLayoutPriority;
34 | static const MASLayoutPriority MASLayoutPriorityRequired = NSLayoutPriorityRequired;
35 | static const MASLayoutPriority MASLayoutPriorityDefaultHigh = NSLayoutPriorityDefaultHigh;
36 | static const MASLayoutPriority MASLayoutPriorityDragThatCanResizeWindow = NSLayoutPriorityDragThatCanResizeWindow;
37 | static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 501;
38 | static const MASLayoutPriority MASLayoutPriorityWindowSizeStayPut = NSLayoutPriorityWindowSizeStayPut;
39 | static const MASLayoutPriority MASLayoutPriorityDragThatCannotResizeWindow = NSLayoutPriorityDragThatCannotResizeWindow;
40 | static const MASLayoutPriority MASLayoutPriorityDefaultLow = NSLayoutPriorityDefaultLow;
41 | static const MASLayoutPriority MASLayoutPriorityFittingSizeCompression = NSLayoutPriorityFittingSizeCompression;
42 |
43 | #endif
44 |
45 | /**
46 | * Allows you to attach keys to objects matching the variable names passed.
47 | *
48 | * view1.mas_key = @"view1", view2.mas_key = @"view2";
49 | *
50 | * is equivalent to:
51 | *
52 | * MASAttachKeys(view1, view2);
53 | */
54 | #define MASAttachKeys(...) \
55 | { \
56 | NSDictionary *keyPairs = NSDictionaryOfVariableBindings(__VA_ARGS__); \
57 | for (id key in keyPairs.allKeys) { \
58 | id obj = keyPairs[key]; \
59 | NSAssert([obj respondsToSelector:@selector(setMas_key:)], \
60 | @"Cannot attach mas_key to %@", obj); \
61 | [obj setMas_key:key]; \
62 | } \
63 | }
64 |
65 | /**
66 | * Used to create object hashes
67 | * Based on http://www.mikeash.com/pyblog/friday-qa-2010-06-18-implementing-equality-and-hashing.html
68 | */
69 | #define MAS_NSUINT_BIT (CHAR_BIT * sizeof(NSUInteger))
70 | #define MAS_NSUINTROTATE(val, howmuch) ((((NSUInteger)val) << howmuch) | (((NSUInteger)val) >> (MAS_NSUINT_BIT - howmuch)))
71 |
72 | /**
73 | * Given a scalar or struct value, wraps it in NSValue
74 | * Based on EXPObjectify: https://github.com/specta/expecta
75 | */
76 | static inline id _MASBoxValue(const char *type, ...) {
77 | va_list v;
78 | va_start(v, type);
79 | id obj = nil;
80 | if (strcmp(type, @encode(id)) == 0) {
81 | id actual = va_arg(v, id);
82 | obj = actual;
83 | } else if (strcmp(type, @encode(CGPoint)) == 0) {
84 | CGPoint actual = (CGPoint)va_arg(v, CGPoint);
85 | obj = [NSValue value:&actual withObjCType:type];
86 | } else if (strcmp(type, @encode(CGSize)) == 0) {
87 | CGSize actual = (CGSize)va_arg(v, CGSize);
88 | obj = [NSValue value:&actual withObjCType:type];
89 | } else if (strcmp(type, @encode(MASEdgeInsets)) == 0) {
90 | MASEdgeInsets actual = (MASEdgeInsets)va_arg(v, MASEdgeInsets);
91 | obj = [NSValue value:&actual withObjCType:type];
92 | } else if (strcmp(type, @encode(double)) == 0) {
93 | double actual = (double)va_arg(v, double);
94 | obj = [NSNumber numberWithDouble:actual];
95 | } else if (strcmp(type, @encode(float)) == 0) {
96 | float actual = (float)va_arg(v, double);
97 | obj = [NSNumber numberWithFloat:actual];
98 | } else if (strcmp(type, @encode(int)) == 0) {
99 | int actual = (int)va_arg(v, int);
100 | obj = [NSNumber numberWithInt:actual];
101 | } else if (strcmp(type, @encode(long)) == 0) {
102 | long actual = (long)va_arg(v, long);
103 | obj = [NSNumber numberWithLong:actual];
104 | } else if (strcmp(type, @encode(long long)) == 0) {
105 | long long actual = (long long)va_arg(v, long long);
106 | obj = [NSNumber numberWithLongLong:actual];
107 | } else if (strcmp(type, @encode(short)) == 0) {
108 | short actual = (short)va_arg(v, int);
109 | obj = [NSNumber numberWithShort:actual];
110 | } else if (strcmp(type, @encode(char)) == 0) {
111 | char actual = (char)va_arg(v, int);
112 | obj = [NSNumber numberWithChar:actual];
113 | } else if (strcmp(type, @encode(bool)) == 0) {
114 | bool actual = (bool)va_arg(v, int);
115 | obj = [NSNumber numberWithBool:actual];
116 | } else if (strcmp(type, @encode(unsigned char)) == 0) {
117 | unsigned char actual = (unsigned char)va_arg(v, unsigned int);
118 | obj = [NSNumber numberWithUnsignedChar:actual];
119 | } else if (strcmp(type, @encode(unsigned int)) == 0) {
120 | unsigned int actual = (unsigned int)va_arg(v, unsigned int);
121 | obj = [NSNumber numberWithUnsignedInt:actual];
122 | } else if (strcmp(type, @encode(unsigned long)) == 0) {
123 | unsigned long actual = (unsigned long)va_arg(v, unsigned long);
124 | obj = [NSNumber numberWithUnsignedLong:actual];
125 | } else if (strcmp(type, @encode(unsigned long long)) == 0) {
126 | unsigned long long actual = (unsigned long long)va_arg(v, unsigned long long);
127 | obj = [NSNumber numberWithUnsignedLongLong:actual];
128 | } else if (strcmp(type, @encode(unsigned short)) == 0) {
129 | unsigned short actual = (unsigned short)va_arg(v, unsigned int);
130 | obj = [NSNumber numberWithUnsignedShort:actual];
131 | }
132 | va_end(v);
133 | return obj;
134 | }
135 |
136 | #define MASBoxValue(value) _MASBoxValue(@encode(__typeof__((value))), (value))
137 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/NSArray+MASAdditions.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+MASAdditions.m
3 | //
4 | //
5 | // Created by Daniel Hammond on 11/26/13.
6 | //
7 | //
8 |
9 | #import "NSArray+MASAdditions.h"
10 | #import "View+MASAdditions.h"
11 |
12 | @implementation NSArray (MASAdditions)
13 |
14 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block {
15 | NSMutableArray *constraints = [NSMutableArray array];
16 | for (MAS_VIEW *view in self) {
17 | NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views");
18 | [constraints addObjectsFromArray:[view mas_makeConstraints:block]];
19 | }
20 | return constraints;
21 | }
22 |
23 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block {
24 | NSMutableArray *constraints = [NSMutableArray array];
25 | for (MAS_VIEW *view in self) {
26 | NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views");
27 | [constraints addObjectsFromArray:[view mas_updateConstraints:block]];
28 | }
29 | return constraints;
30 | }
31 |
32 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block {
33 | NSMutableArray *constraints = [NSMutableArray array];
34 | for (MAS_VIEW *view in self) {
35 | NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views");
36 | [constraints addObjectsFromArray:[view mas_remakeConstraints:block]];
37 | }
38 | return constraints;
39 | }
40 |
41 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing {
42 | if (self.count < 2) {
43 | NSAssert(self.count>1,@"views to distribute need to bigger than one");
44 | return;
45 | }
46 |
47 | MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews];
48 | if (axisType == MASAxisTypeHorizontal) {
49 | MAS_VIEW *prev;
50 | for (int i = 0; i < self.count; i++) {
51 | MAS_VIEW *v = self[i];
52 | [v mas_makeConstraints:^(MASConstraintMaker *make) {
53 | if (prev) {
54 | make.width.equalTo(prev);
55 | make.left.equalTo(prev.mas_right).offset(fixedSpacing);
56 | if (i == self.count - 1) {//last one
57 | make.right.equalTo(tempSuperView).offset(-tailSpacing);
58 | }
59 | }
60 | else {//first one
61 | make.left.equalTo(tempSuperView).offset(leadSpacing);
62 | }
63 |
64 | }];
65 | prev = v;
66 | }
67 | }
68 | else {
69 | MAS_VIEW *prev;
70 | for (int i = 0; i < self.count; i++) {
71 | MAS_VIEW *v = self[i];
72 | [v mas_makeConstraints:^(MASConstraintMaker *make) {
73 | if (prev) {
74 | make.height.equalTo(prev);
75 | make.top.equalTo(prev.mas_bottom).offset(fixedSpacing);
76 | if (i == self.count - 1) {//last one
77 | make.bottom.equalTo(tempSuperView).offset(-tailSpacing);
78 | }
79 | }
80 | else {//first one
81 | make.top.equalTo(tempSuperView).offset(leadSpacing);
82 | }
83 |
84 | }];
85 | prev = v;
86 | }
87 | }
88 | }
89 |
90 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing {
91 | if (self.count < 2) {
92 | NSAssert(self.count>1,@"views to distribute need to bigger than one");
93 | return;
94 | }
95 |
96 | MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews];
97 | if (axisType == MASAxisTypeHorizontal) {
98 | MAS_VIEW *prev;
99 | for (int i = 0; i < self.count; i++) {
100 | MAS_VIEW *v = self[i];
101 | [v mas_makeConstraints:^(MASConstraintMaker *make) {
102 | make.width.equalTo(@(fixedItemLength));
103 | if (prev) {
104 | if (i == self.count - 1) {//last one
105 | make.right.equalTo(tempSuperView).offset(-tailSpacing);
106 | }
107 | else {
108 | CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1));
109 | make.right.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset);
110 | }
111 | }
112 | else {//first one
113 | make.left.equalTo(tempSuperView).offset(leadSpacing);
114 | }
115 | }];
116 | prev = v;
117 | }
118 | }
119 | else {
120 | MAS_VIEW *prev;
121 | for (int i = 0; i < self.count; i++) {
122 | MAS_VIEW *v = self[i];
123 | [v mas_makeConstraints:^(MASConstraintMaker *make) {
124 | make.height.equalTo(@(fixedItemLength));
125 | if (prev) {
126 | if (i == self.count - 1) {//last one
127 | make.bottom.equalTo(tempSuperView).offset(-tailSpacing);
128 | }
129 | else {
130 | CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1));
131 | make.bottom.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset);
132 | }
133 | }
134 | else {//first one
135 | make.top.equalTo(tempSuperView).offset(leadSpacing);
136 | }
137 | }];
138 | prev = v;
139 | }
140 | }
141 | }
142 |
143 | - (MAS_VIEW *)mas_commonSuperviewOfViews
144 | {
145 | MAS_VIEW *commonSuperview = nil;
146 | MAS_VIEW *previousView = nil;
147 | for (id object in self) {
148 | if ([object isKindOfClass:[MAS_VIEW class]]) {
149 | MAS_VIEW *view = (MAS_VIEW *)object;
150 | if (previousView) {
151 | commonSuperview = [view mas_closestCommonSuperview:commonSuperview];
152 | } else {
153 | commonSuperview = view;
154 | }
155 | previousView = view;
156 | }
157 | }
158 | NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy.");
159 | return commonSuperview;
160 | }
161 |
162 | @end
163 |
--------------------------------------------------------------------------------
/CCTimeLine/Demo/ViewController/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // CCTimeLine
4 | //
5 | // Created by ZhangCc on 2018/8/6.
6 | // Copyright © 2018年 ZhangCc. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "MJExtension.h"
11 | #import "CCModel.h"
12 | #import "CCContentCell.h"
13 | #import "Masonry.h"
14 | #import "UITableView+FDTemplateLayoutCell.h"
15 |
16 | #define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
17 |
18 | @interface ViewController ()
19 |
20 | @property (nonatomic, strong) NSArray *dataArray;
21 | @property (nonatomic, strong) UITableView *tableView;
22 |
23 | @end
24 |
25 | @implementation ViewController
26 |
27 | - (void)viewDidLoad {
28 | [super viewDidLoad];
29 |
30 | [self setStatusBarBackgroundColor:[UIColor whiteColor]];
31 | [self loadData];
32 | [self.view addSubview:self.tableView];
33 | [self.tableView registerClass:[CCContentCell class] forCellReuseIdentifier:CCContentCellID];
34 | }
35 |
36 | - (void)setStatusBarBackgroundColor:(UIColor *)color {
37 | UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
38 | if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
39 | statusBar.backgroundColor = color;
40 | }
41 | }
42 |
43 | - (void)loadData {
44 | NSString *path = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"json"];
45 | NSData *data = [[NSData alloc] initWithContentsOfFile:path];
46 | CCModel *model = [CCModel mj_objectWithKeyValues:data];
47 |
48 | NSMutableArray *array = [NSMutableArray array];
49 | for (NSDictionary *dict in model.articleList) {
50 | Article *model = [Article mj_objectWithKeyValues:dict];
51 | [array addObject:model];
52 | }
53 | self.dataArray = array;
54 | }
55 |
56 | - (UITableView *)tableView {
57 | if (!_tableView) {
58 | _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
59 | _tableView.contentInset = UIEdgeInsetsMake(-0.1, 0, 0, 0);
60 | _tableView.dataSource = self;
61 | _tableView.delegate = self;
62 | _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
63 | }
64 | return _tableView;
65 | }
66 |
67 | #pragma mark - UITableViewDelegate && UITableViewDataSource
68 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
69 | return self.dataArray.count;
70 | }
71 |
72 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
73 | return [tableView fd_heightForCellWithIdentifier:CCContentCellID cacheByIndexPath:indexPath configuration:^(id cell) {
74 | [self configureCell:cell atIndexPath:indexPath];
75 | }];
76 | }
77 |
78 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
79 | CCContentCell *cell = [CCContentCell cellWithTableView:tableView];
80 | cell.delegate = self;
81 | if (indexPath.row == 0) {
82 | [cell.lineView mas_remakeConstraints:^(MASConstraintMaker *make) {
83 | make.top.equalTo(cell.pointView.mas_bottom);
84 | make.bottom.equalTo(cell);
85 | make.width.mas_offset(0.5);
86 | make.centerX.equalTo(cell.pointView);
87 | }];
88 | }else {
89 | [cell.lineView mas_remakeConstraints:^(MASConstraintMaker *make) {
90 | make.top.equalTo(cell);
91 | make.bottom.equalTo(cell);
92 | make.width.mas_offset(0.5);
93 | make.centerX.equalTo(cell.pointView);
94 | }];
95 | }
96 | [self configureCell:cell atIndexPath:indexPath];
97 |
98 | return cell;
99 | }
100 |
101 | - (void)configureCell:(CCContentCell *)cell atIndexPath:(NSIndexPath *)indexPath {
102 | //使用Masonry进行布局的话,这里要设置为NO
103 | cell.fd_enforceFrameLayout = NO;
104 | cell.model = self.dataArray[indexPath.row];
105 | }
106 |
107 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
108 | return 44;
109 | }
110 |
111 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
112 | UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44)];
113 | headerView.backgroundColor = [UIColor whiteColor];
114 |
115 | UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(14, 0, SCREEN_WIDTH - 30, 44)];
116 | timeLabel.font = [UIFont systemFontOfSize:15.0f];
117 | timeLabel.textColor = [UIColor blackColor];
118 |
119 | timeLabel.text = [self dateShow];
120 |
121 | [headerView addSubview:timeLabel];
122 | return headerView;
123 | }
124 |
125 | #pragma mark - Event respons
126 | - (void)foldingCell:(CCContentCell *)cell {
127 | NSIndexPath *indexPath = [_tableView indexPathForCell:cell];
128 | Article *model = self.dataArray[indexPath.row];
129 | model.isFolding = !model.isFolding;
130 |
131 | NSIndexPath *index = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
132 | [UIView performWithoutAnimation:^{
133 | [self.tableView reloadRowsAtIndexPaths:@[index] withRowAnimation:UITableViewRowAnimationNone];
134 | }];
135 | }
136 |
137 | - (void)opinionWithCell:(CCContentCell *)cell bullOrBear:(NSInteger)value {
138 | NSIndexPath *indexPath = [_tableView indexPathForCell:cell];
139 | Article *model = self.dataArray[indexPath.row];
140 | model.bullOrBear = value;
141 | if (value == OpinionTypeBear) {
142 | model.bearNum++;
143 | } else if (value == OpinionTypeBull) {
144 | model.bullNum++;
145 | }
146 | [self configureCell:cell atIndexPath:indexPath];
147 | }
148 |
149 | #pragma mark - Private methods
150 | // 日期 + 星期
151 | - (NSString *)dateShow {
152 | NSDate *today = [[NSDate alloc] init];
153 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
154 | [dateFormatter setDateFormat:@"MM月dd日"];
155 | NSString *dateStr = [dateFormatter stringFromDate:today];
156 | NSString *newDateStr = [NSString stringWithFormat:@"今天 %@",dateStr];;
157 | NSString *weekDay = [self weekWithdate:today];
158 | //当天显示格式 今天 + MM月dd日 + 星期
159 | return [NSString stringWithFormat:@"%@ %@", newDateStr, weekDay];
160 | }
161 |
162 | // 星期
163 | - (NSString *)weekWithdate:(NSDate *)date {
164 | //返回星期几
165 | NSArray *weekdays = [NSArray arrayWithObjects: [NSNull null], @"星期日", @"星期一", @"星期二", @"星期三", @"星期四", @"星期五", @"星期六", nil];
166 | NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
167 | NSCalendarUnit calendarUnit = NSCalendarUnitWeekday;
168 | NSDateComponents *theComponents = [calendar components:calendarUnit fromDate:date];
169 | NSString *weekday = [weekdays objectAtIndex:theComponents.weekday];
170 | return weekday;
171 | }
172 |
173 | @end
174 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/View+MASAdditions.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+MASAdditions.m
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 20/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import "View+MASAdditions.h"
10 | #import
11 |
12 | @implementation MAS_VIEW (MASAdditions)
13 |
14 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *))block {
15 | self.translatesAutoresizingMaskIntoConstraints = NO;
16 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self];
17 | block(constraintMaker);
18 | return [constraintMaker install];
19 | }
20 |
21 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *))block {
22 | self.translatesAutoresizingMaskIntoConstraints = NO;
23 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self];
24 | constraintMaker.updateExisting = YES;
25 | block(constraintMaker);
26 | return [constraintMaker install];
27 | }
28 |
29 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block {
30 | self.translatesAutoresizingMaskIntoConstraints = NO;
31 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self];
32 | constraintMaker.removeExisting = YES;
33 | block(constraintMaker);
34 | return [constraintMaker install];
35 | }
36 |
37 | #pragma mark - NSLayoutAttribute properties
38 |
39 | - (MASViewAttribute *)mas_left {
40 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeft];
41 | }
42 |
43 | - (MASViewAttribute *)mas_top {
44 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTop];
45 | }
46 |
47 | - (MASViewAttribute *)mas_right {
48 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRight];
49 | }
50 |
51 | - (MASViewAttribute *)mas_bottom {
52 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottom];
53 | }
54 |
55 | - (MASViewAttribute *)mas_leading {
56 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeading];
57 | }
58 |
59 | - (MASViewAttribute *)mas_trailing {
60 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailing];
61 | }
62 |
63 | - (MASViewAttribute *)mas_width {
64 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeWidth];
65 | }
66 |
67 | - (MASViewAttribute *)mas_height {
68 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeHeight];
69 | }
70 |
71 | - (MASViewAttribute *)mas_centerX {
72 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterX];
73 | }
74 |
75 | - (MASViewAttribute *)mas_centerY {
76 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterY];
77 | }
78 |
79 | - (MASViewAttribute *)mas_baseline {
80 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline];
81 | }
82 |
83 | - (MASViewAttribute *(^)(NSLayoutAttribute))mas_attribute
84 | {
85 | return ^(NSLayoutAttribute attr) {
86 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:attr];
87 | };
88 | }
89 |
90 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
91 |
92 | - (MASViewAttribute *)mas_firstBaseline {
93 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeFirstBaseline];
94 | }
95 | - (MASViewAttribute *)mas_lastBaseline {
96 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLastBaseline];
97 | }
98 |
99 | #endif
100 |
101 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
102 |
103 | - (MASViewAttribute *)mas_leftMargin {
104 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeftMargin];
105 | }
106 |
107 | - (MASViewAttribute *)mas_rightMargin {
108 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRightMargin];
109 | }
110 |
111 | - (MASViewAttribute *)mas_topMargin {
112 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTopMargin];
113 | }
114 |
115 | - (MASViewAttribute *)mas_bottomMargin {
116 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottomMargin];
117 | }
118 |
119 | - (MASViewAttribute *)mas_leadingMargin {
120 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeadingMargin];
121 | }
122 |
123 | - (MASViewAttribute *)mas_trailingMargin {
124 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailingMargin];
125 | }
126 |
127 | - (MASViewAttribute *)mas_centerXWithinMargins {
128 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterXWithinMargins];
129 | }
130 |
131 | - (MASViewAttribute *)mas_centerYWithinMargins {
132 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterYWithinMargins];
133 | }
134 |
135 | #endif
136 |
137 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000)
138 |
139 | - (MASViewAttribute *)mas_safeAreaLayoutGuide {
140 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
141 | }
142 | - (MASViewAttribute *)mas_safeAreaLayoutGuideTop {
143 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop];
144 | }
145 | - (MASViewAttribute *)mas_safeAreaLayoutGuideBottom {
146 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom];
147 | }
148 | - (MASViewAttribute *)mas_safeAreaLayoutGuideLeft {
149 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft];
150 | }
151 | - (MASViewAttribute *)mas_safeAreaLayoutGuideRight {
152 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight];
153 | }
154 |
155 | #endif
156 |
157 | #pragma mark - associated properties
158 |
159 | - (id)mas_key {
160 | return objc_getAssociatedObject(self, @selector(mas_key));
161 | }
162 |
163 | - (void)setMas_key:(id)key {
164 | objc_setAssociatedObject(self, @selector(mas_key), key, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
165 | }
166 |
167 | #pragma mark - heirachy
168 |
169 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view {
170 | MAS_VIEW *closestCommonSuperview = nil;
171 |
172 | MAS_VIEW *secondViewSuperview = view;
173 | while (!closestCommonSuperview && secondViewSuperview) {
174 | MAS_VIEW *firstViewSuperview = self;
175 | while (!closestCommonSuperview && firstViewSuperview) {
176 | if (secondViewSuperview == firstViewSuperview) {
177 | closestCommonSuperview = secondViewSuperview;
178 | }
179 | firstViewSuperview = firstViewSuperview.superview;
180 | }
181 | secondViewSuperview = secondViewSuperview.superview;
182 | }
183 | return closestCommonSuperview;
184 | }
185 |
186 | @end
187 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASConstraint.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASConstraint.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 22/07/13.
6 | // Copyright (c) 2013 cloudling. All rights reserved.
7 | //
8 |
9 | #import "MASUtilities.h"
10 |
11 | /**
12 | * Enables Constraints to be created with chainable syntax
13 | * Constraint can represent single NSLayoutConstraint (MASViewConstraint)
14 | * or a group of NSLayoutConstraints (MASComposisteConstraint)
15 | */
16 | @interface MASConstraint : NSObject
17 |
18 | // Chaining Support
19 |
20 | /**
21 | * Modifies the NSLayoutConstraint constant,
22 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
23 | * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight
24 | */
25 | - (MASConstraint * (^)(MASEdgeInsets insets))insets;
26 |
27 | /**
28 | * Modifies the NSLayoutConstraint constant,
29 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
30 | * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight
31 | */
32 | - (MASConstraint * (^)(CGFloat inset))inset;
33 |
34 | /**
35 | * Modifies the NSLayoutConstraint constant,
36 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
37 | * NSLayoutAttributeWidth, NSLayoutAttributeHeight
38 | */
39 | - (MASConstraint * (^)(CGSize offset))sizeOffset;
40 |
41 | /**
42 | * Modifies the NSLayoutConstraint constant,
43 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
44 | * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY
45 | */
46 | - (MASConstraint * (^)(CGPoint offset))centerOffset;
47 |
48 | /**
49 | * Modifies the NSLayoutConstraint constant
50 | */
51 | - (MASConstraint * (^)(CGFloat offset))offset;
52 |
53 | /**
54 | * Modifies the NSLayoutConstraint constant based on a value type
55 | */
56 | - (MASConstraint * (^)(NSValue *value))valueOffset;
57 |
58 | /**
59 | * Sets the NSLayoutConstraint multiplier property
60 | */
61 | - (MASConstraint * (^)(CGFloat multiplier))multipliedBy;
62 |
63 | /**
64 | * Sets the NSLayoutConstraint multiplier to 1.0/dividedBy
65 | */
66 | - (MASConstraint * (^)(CGFloat divider))dividedBy;
67 |
68 | /**
69 | * Sets the NSLayoutConstraint priority to a float or MASLayoutPriority
70 | */
71 | - (MASConstraint * (^)(MASLayoutPriority priority))priority;
72 |
73 | /**
74 | * Sets the NSLayoutConstraint priority to MASLayoutPriorityLow
75 | */
76 | - (MASConstraint * (^)(void))priorityLow;
77 |
78 | /**
79 | * Sets the NSLayoutConstraint priority to MASLayoutPriorityMedium
80 | */
81 | - (MASConstraint * (^)(void))priorityMedium;
82 |
83 | /**
84 | * Sets the NSLayoutConstraint priority to MASLayoutPriorityHigh
85 | */
86 | - (MASConstraint * (^)(void))priorityHigh;
87 |
88 | /**
89 | * Sets the constraint relation to NSLayoutRelationEqual
90 | * returns a block which accepts one of the following:
91 | * MASViewAttribute, UIView, NSValue, NSArray
92 | * see readme for more details.
93 | */
94 | - (MASConstraint * (^)(id attr))equalTo;
95 |
96 | /**
97 | * Sets the constraint relation to NSLayoutRelationGreaterThanOrEqual
98 | * returns a block which accepts one of the following:
99 | * MASViewAttribute, UIView, NSValue, NSArray
100 | * see readme for more details.
101 | */
102 | - (MASConstraint * (^)(id attr))greaterThanOrEqualTo;
103 |
104 | /**
105 | * Sets the constraint relation to NSLayoutRelationLessThanOrEqual
106 | * returns a block which accepts one of the following:
107 | * MASViewAttribute, UIView, NSValue, NSArray
108 | * see readme for more details.
109 | */
110 | - (MASConstraint * (^)(id attr))lessThanOrEqualTo;
111 |
112 | /**
113 | * Optional semantic property which has no effect but improves the readability of constraint
114 | */
115 | - (MASConstraint *)with;
116 |
117 | /**
118 | * Optional semantic property which has no effect but improves the readability of constraint
119 | */
120 | - (MASConstraint *)and;
121 |
122 | /**
123 | * Creates a new MASCompositeConstraint with the called attribute and reciever
124 | */
125 | - (MASConstraint *)left;
126 | - (MASConstraint *)top;
127 | - (MASConstraint *)right;
128 | - (MASConstraint *)bottom;
129 | - (MASConstraint *)leading;
130 | - (MASConstraint *)trailing;
131 | - (MASConstraint *)width;
132 | - (MASConstraint *)height;
133 | - (MASConstraint *)centerX;
134 | - (MASConstraint *)centerY;
135 | - (MASConstraint *)baseline;
136 |
137 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
138 |
139 | - (MASConstraint *)firstBaseline;
140 | - (MASConstraint *)lastBaseline;
141 |
142 | #endif
143 |
144 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
145 |
146 | - (MASConstraint *)leftMargin;
147 | - (MASConstraint *)rightMargin;
148 | - (MASConstraint *)topMargin;
149 | - (MASConstraint *)bottomMargin;
150 | - (MASConstraint *)leadingMargin;
151 | - (MASConstraint *)trailingMargin;
152 | - (MASConstraint *)centerXWithinMargins;
153 | - (MASConstraint *)centerYWithinMargins;
154 |
155 | #endif
156 |
157 |
158 | /**
159 | * Sets the constraint debug name
160 | */
161 | - (MASConstraint * (^)(id key))key;
162 |
163 | // NSLayoutConstraint constant Setters
164 | // for use outside of mas_updateConstraints/mas_makeConstraints blocks
165 |
166 | /**
167 | * Modifies the NSLayoutConstraint constant,
168 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
169 | * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight
170 | */
171 | - (void)setInsets:(MASEdgeInsets)insets;
172 |
173 | /**
174 | * Modifies the NSLayoutConstraint constant,
175 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
176 | * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight
177 | */
178 | - (void)setInset:(CGFloat)inset;
179 |
180 | /**
181 | * Modifies the NSLayoutConstraint constant,
182 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
183 | * NSLayoutAttributeWidth, NSLayoutAttributeHeight
184 | */
185 | - (void)setSizeOffset:(CGSize)sizeOffset;
186 |
187 | /**
188 | * Modifies the NSLayoutConstraint constant,
189 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
190 | * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY
191 | */
192 | - (void)setCenterOffset:(CGPoint)centerOffset;
193 |
194 | /**
195 | * Modifies the NSLayoutConstraint constant
196 | */
197 | - (void)setOffset:(CGFloat)offset;
198 |
199 |
200 | // NSLayoutConstraint Installation support
201 |
202 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
203 | /**
204 | * Whether or not to go through the animator proxy when modifying the constraint
205 | */
206 | @property (nonatomic, copy, readonly) MASConstraint *animator;
207 | #endif
208 |
209 | /**
210 | * Activates an NSLayoutConstraint if it's supported by an OS.
211 | * Invokes install otherwise.
212 | */
213 | - (void)activate;
214 |
215 | /**
216 | * Deactivates previously installed/activated NSLayoutConstraint.
217 | */
218 | - (void)deactivate;
219 |
220 | /**
221 | * Creates a NSLayoutConstraint and adds it to the appropriate view.
222 | */
223 | - (void)install;
224 |
225 | /**
226 | * Removes previously installed NSLayoutConstraint
227 | */
228 | - (void)uninstall;
229 |
230 | @end
231 |
232 |
233 | /**
234 | * Convenience auto-boxing macros for MASConstraint methods.
235 | *
236 | * Defining MAS_SHORTHAND_GLOBALS will turn on auto-boxing for default syntax.
237 | * A potential drawback of this is that the unprefixed macros will appear in global scope.
238 | */
239 | #define mas_equalTo(...) equalTo(MASBoxValue((__VA_ARGS__)))
240 | #define mas_greaterThanOrEqualTo(...) greaterThanOrEqualTo(MASBoxValue((__VA_ARGS__)))
241 | #define mas_lessThanOrEqualTo(...) lessThanOrEqualTo(MASBoxValue((__VA_ARGS__)))
242 |
243 | #define mas_offset(...) valueOffset(MASBoxValue((__VA_ARGS__)))
244 |
245 |
246 | #ifdef MAS_SHORTHAND_GLOBALS
247 |
248 | #define equalTo(...) mas_equalTo(__VA_ARGS__)
249 | #define greaterThanOrEqualTo(...) mas_greaterThanOrEqualTo(__VA_ARGS__)
250 | #define lessThanOrEqualTo(...) mas_lessThanOrEqualTo(__VA_ARGS__)
251 |
252 | #define offset(...) mas_offset(__VA_ARGS__)
253 |
254 | #endif
255 |
256 |
257 | @interface MASConstraint (AutoboxingSupport)
258 |
259 | /**
260 | * Aliases to corresponding relation methods (for shorthand macros)
261 | * Also needed to aid autocompletion
262 | */
263 | - (MASConstraint * (^)(id attr))mas_equalTo;
264 | - (MASConstraint * (^)(id attr))mas_greaterThanOrEqualTo;
265 | - (MASConstraint * (^)(id attr))mas_lessThanOrEqualTo;
266 |
267 | /**
268 | * A dummy method to aid autocompletion
269 | */
270 | - (MASConstraint * (^)(id offset))mas_offset;
271 |
272 | @end
273 |
--------------------------------------------------------------------------------
/CCTimeLine/Resources/data.json:
--------------------------------------------------------------------------------
1 | {"articleList": [{
2 | "publishTime": 1533540176000,
3 | "bullOrBear": 0,
4 | "bearNum": 0,
5 | "id": 2997462,
6 | "title": "【快讯】动态 | 挖时科技、云游社区、云链科技和Diychain等八家单位组建成战略联盟",
7 | "content": "今日获悉,挖时科技与云游社区、云链科技、Diychain、币巴克、中西部区块链俱乐部、上车时刻、由米科技达成战略联盟关系。八家单位表示:“将发挥各自优势,携手在区块链领域展开多项合作,还将共同推进净化市场·赋能产业,为区块链正能量发声。”",
8 | "bullNum": 0
9 | }, {
10 | "publishTime": 1533539934000,
11 | "bullOrBear": 1,
12 | "bearNum": 0,
13 | "id": 2997409,
14 | "title": "【快讯】专家反驳三星关于智能手机最适合储存数字货币的观点",
15 | "content": "三星方面的作者Joel Snyder曾表示智能手机可信执行环境(TEE)使得“智能手机的数字货币钱包具有安全性优势。” 但比特币开发商Jameson Lopp表示,同意TEE在安全方面有好处,但是恶意软件会在创建交易时影响钱包操作的其他关键组件,从而导致资金被发送到攻击者的地址。约翰斯·霍普金斯大学密码学教授马修·格林也同意TEE可以让黑客更难入侵,但是复杂的恶意软件可能会危及应用程序。 F-Secure安全专家MikkoHyppönen认为,智能手机对于交易来说是实用的,可是要存储大量的加密货币,还是建议人们使用专门的加密货币硬件钱包。",
16 | "bullNum": 1
17 | }, {
18 | "publishTime": 1533539754000,
19 | "bullOrBear": 0,
20 | "bearNum": 0,
21 | "id": 2997359,
22 | "title": "A股收盘,区块链指数下跌1.75%",
23 | "content": "A股收盘,区块链指数下跌1.75%,安妮股份(+3.28%)、信息发展(2.31%)等涨幅居前。",
24 | "bullNum": 0
25 | }, {
26 | "publishTime": 1533539215000,
27 | "bullOrBear": 0,
28 | "bearNum": 0,
29 | "id": 2997187,
30 | "title": "【快讯】重庆举办科技成果转化大赛,区块链被列入参赛范围",
31 | "content": "重庆日报消息,日前由重庆市人力资源社会保障局和市科学技术研究院联合主办的“渝创渝新 数字未来”数字时代重庆科技成果转化大赛启动。比赛的参赛范围为信息与自动化、先进制造、大数据、人工智能等领域,包括信息与通信技术、云计算、物联网、区块链、共享经济、5G、数字化转型等技术创新与产业发展类相关项目。",
32 | "bullNum": 0
33 | }, {
34 | "publishTime": 1533539154000,
35 | "bullOrBear": 0,
36 | "bearNum": 0,
37 | "id": 2997163,
38 | "title": "比特币小幅回落至7100美元下方交投",
39 | "content": "小葱APP行情显示,比特币小幅回落至7100美元下方交投,主流币普遍上涨,市值前50分币种6个下跌。",
40 | "bullNum": 0
41 | }, {
42 | "publishTime": 1533538974000,
43 | "bullOrBear": 0,
44 | "bearNum": 0,
45 | "id": 2997123,
46 | "title": "【快讯】分析 | 比特币在谷歌的搜索量上升",
47 | "content": "金色盘面分析师根据Google Trends数据分析得出,比特币(Bitcoin)搜索热度自7月以来稳步上升,并在此次反弹高点时达到峰值,热门搜索地区第一和第二分别为尼日利亚和加纳,搜索热词主要是bitcoin、bitcoin price,说明非洲地区对比特币的投资关注度越来越高,或将成为数字资产的另一个投资热土。",
48 | "bullNum": 0
49 | }, {
50 | "publishTime": 1533538974000,
51 | "bullOrBear": 0,
52 | "bearNum": 0,
53 | "id": 2997124,
54 | "title": "【快讯】成都链安科技与DALICHAIN签署战略合作框架协议",
55 | "content": "双方将在区块链安全、审计、智能合约开发、虚拟机研究等领域展开深入合作。成都链安科技研发出了全球第一个高度自动化的区块链形式化验证平台VaaS(Verification as a Service),VaaS平台上线后累积审计智能合约超过500份,并入选Etherscan智能合约安全审计推荐名单。DALICHAIN作为一条商用公链,以提供行业落地能力为目的,意在解决行业实际问题。目前已在版权、公益、物流、供应链金融等领域提供落地解决方案。DALI作为DALICHAIN的通证,现已在LBANK、Allcoin开放交易。",
56 | "bullNum": 0
57 | }, {
58 | "publishTime": 1533538855000,
59 | "bullOrBear": 0,
60 | "bearNum": 0,
61 | "id": 2997100,
62 | "title": "【快讯】动态 | StocksExchange宣布完成波场主网更新",
63 | "content": "刚刚,StocksExchange在官方Twitter发布公告,TRON主网切换已经完成,现已更换为TRX主网地址,并开启主网TRX的充提服务。当前已经有包括Gate.io、RightBTC、Upbit、OKEx、Cobo钱包、Huobipro、币安Binance、Bitfinex、Coinnest、Bit-Z、Cryptopia、HitBTC、Koinex 、MAX等在内的近二十家交易所和钱包完成了代币迁移工作,重新开放充提服务。",
64 | "bullNum": 0
65 | }, {
66 | "publishTime": 1533538854000,
67 | "bullOrBear": 0,
68 | "bearNum": 0,
69 | "id": 2997098,
70 | "title": "【快讯】韩国Macrogen与大数据公司合作,创建区块链医疗大数据平台",
71 | "content": "据koreaherald消息,韩国领先的基因测序服务提供商Macrogen周一表示,它将与当地大数据公司Bigster合作,创建一个基于区块链的医疗大数据平台,基因数据等信息可以安全地存储和交换。两家公司计划在明年6月之前完成该平台。Macrogen首席执行官Yang Kap-seok在声明中表示:“我们希望我们即将推出的基于区块链的平台能够自由传播医疗保健基因和医疗大数据。”",
72 | "bullNum": 0
73 | }, {
74 | "publishTime": 1533538555000,
75 | "bullOrBear": 0,
76 | "bearNum": 0,
77 | "id": 2996997,
78 | "title": "韩国基因测序服务提供商与大数据公司合作,创建区块链医疗大数据平台",
79 | "content": "据koreaherald消息,韩国领先的基因测序服务提供商Macrogen周一表示,它将与当地大数据公司Bigster合作,创建一个基于区块链的医疗大数据平台,基因数据等信息可以安全地存储和交换。两家公司计划在明年6月之前完成该平台,加入其他一些同样致力于在这里推出基于区块链的医疗数据交易平台的公司。Macrogen首席执行官Yang Kap-seok在声明中表示:“尽管它具有广泛的实用性,但由于隐私保护问题和技术障碍,基因数据难以移动。我们希望我们即将推出的基于区块链的平台能够自由传播医疗保健基因和医疗大数据。”",
80 | "bullNum": 0
81 | }, {
82 | "publishTime": 1533534954000,
83 | "bullOrBear": 0,
84 | "bearNum": 0,
85 | "id": 2996571,
86 | "title": "瑞星2018年上半年中国网络安全报告:挖矿与勒索病毒成企业最大威胁",
87 | "content": "由于虚拟化货币钱包地址的隐蔽性,致使其依然是犯罪分子获利的首选,这也就导致大量加密货币挖矿病毒和勒索病毒的爆发。据瑞星《2018年上半年中国网络安全报告》显示,瑞星“云安全”系统共截获勒索软件样本31.44万个,感染共计456万次,其中广东省感染116万次,位列全国第一,其次为上海市62万次,北京市34万次及江苏省22万次。",
88 | "bullNum": 2
89 | }, {
90 | "publishTime": 1533534954000,
91 | "bullOrBear": 0,
92 | "bearNum": 0,
93 | "id": 2996572,
94 | "title": "台湾地区多家银行正积极探索区块链应用技术",
95 | "content": "台湾地区多家银行正积极探索发展区块链的应用技术。其中,第一银行正进行应用区块链技术的内部小规模创新实验;彰化银行成立了内部区块链研发小组,旨在培育区块链技术研发人才;台湾中小企业银行已加入了由台湾财金公司(FSIC)推出的金融区块链服务平台。(中时电子报)",
96 | "bullNum": 0
97 | }, {
98 | "publishTime": 1533534954000,
99 | "bullOrBear": 0,
100 | "bearNum": 0,
101 | "id": 2996573,
102 | "title": "苏格兰政府考虑在公共服务领域采用区块链",
103 | "content": "据 Cryptovest 消息,苏格兰政府发布的一份报告详细介绍了如何在公共服务中使用区块链。政府将区块链描述为在「本土数字化」服务上创造机会,并提出了一些可能性的建议。",
104 | "bullNum": 0
105 | }, {
106 | "publishTime": 1533534354000,
107 | "bullOrBear": 0,
108 | "bearNum": 0,
109 | "id": 2996514,
110 | "title": "Binance支持Hcash (HSR) 主网切换HyperCash (HC)",
111 | "content": "Binance今日发布公告,将支持Hcash (HSR) 主网切换HyperCash (HC),具体计划如下: 1.2018年08月06日16:00(UTC+8)暂停HSR充值提现,进行主网切换。 注意:此后充值的HSR代币将无法入账。 2.2018年08月08日中午12:00(UTC+8)暂停所有HSR交易对交易,并根据2018年08月08日中午12:00(UTC+8)的用户持仓快照,按照 1 HSR= 1 HC发放HC。 3.HC具体交易时间将另行通知。 注意:HC交易对上线交易后,原有HSR交易对将下架。",
112 | "bullNum": 0
113 | }, {
114 | "publishTime": 1533533934000,
115 | "bullOrBear": 0,
116 | "bearNum": 0,
117 | "id": 2996460,
118 | "title": "【快讯】区块链技术先驱John Milburn宣布加入ONO主网团队",
119 | "content": "8月5日,著名区块链技术先驱John Milburn宣布正式以技术合伙人身份加入ONO主网团队,将带领Matias Romeo等11位ONO主网核心成员队一起建设主网,预计2019年上线。2011年,John Milburn专注区块链技术,并与成立BlockOne的风险资本家Brock Pierce成为合伙人,加入EOS担任技术专家。ONO创始团队曾表示,ONO将为用户提供安全可信的身份认证服务。ONO架构分为应用层、系统层、智能合约层和核心层。ONO主网秉承共荣共治的理念,基于EOS对共识机制和智能合约进行修改。独创共识机制,通过KYC的用户投票选举产生人民节点(BP)。开发者不用购买RAM资源,支持百万级TPS,ONO主网将会完全开源。",
120 | "bullNum": 0
121 | }, {
122 | "publishTime": 1533533934000,
123 | "bullOrBear": 0,
124 | "bearNum": 0,
125 | "id": 2996461,
126 | "title": "【快讯】ETH未确认交易数量为27069笔",
127 | "content": "据etherscan.io数据,截至今日13:00,ETH未确认交易数量为27069笔,较昨日同比增加2.5%,市场活跃度有所增加。 截至目前,ETH最新报价为412美元,24小时内价格涨幅为0.86%。",
128 | "bullNum": 0
129 | }, {
130 | "publishTime": 1533533754000,
131 | "bullOrBear": 0,
132 | "bearNum": 0,
133 | "id": 2996434,
134 | "title": "今日恐慌指数23,较上周恐慌情绪增加",
135 | "content": "据Alternative.me数据,今日加密货币市场恐慌指数为23,市场处于极度恐慌状态,较上周恐慌情绪增强。",
136 | "bullNum": 0
137 | }, {
138 | "publishTime": 1533533155000,
139 | "bullOrBear": 0,
140 | "bearNum": 0,
141 | "id": 2996389,
142 | "title": "苏宁将与华夏银行加强区块链等金融科技方面合作",
143 | "content": "苏宁控股集团董事长张近东表示,苏宁与华夏的发展战略有众多契合点。双方将加强在金融科技方面的合作,包括区块链黑名单共享平台、反欺诈系统、智能客服等。(中国经济网)",
144 | "bullNum": 0
145 | }, {
146 | "publishTime": 1533533155000,
147 | "bullOrBear": 0,
148 | "bearNum": 0,
149 | "id": 2996391,
150 | "title": "清华x-lab、链塔智库等发起成立区块链3.0“青藤票改实验室”",
151 | "content": "据链塔智库官微,日前,链塔、清华x-lab、青藤链盟、中华全国工商业联合会、中国电子商会区块链专委会等中字头协会等共同发起成立区块链3.0“青藤票改实验室、青藤票改母基金”,旨在推动区块链3.0技术赋能实体经济。",
152 | "bullNum": 0
153 | }, {
154 | "publishTime": 1533532614000,
155 | "bullOrBear": 0,
156 | "bearNum": 0,
157 | "id": 2996360,
158 | "title": "【快讯】公告 | CoinEx调整交易挖矿规则 门槛降低",
159 | "content": "CoinEx更新交易挖矿规则,不论是否通过实名认证,是否开启“CET抵扣交易手续费”,用户均可参与“交易挖矿”。同时,CoinEx7月中旬发布锁仓挖矿规则。CoinEx官方表示,此次更新规则是为了降低普通用户的挖矿门槛,使更多用户参与。详情见原文链接。",
160 | "bullNum": 0
161 | }]
162 | }
163 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/NSObject+MJKeyValue.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+MJKeyValue.h
3 | // MJExtension
4 | //
5 | // Created by mj on 13-8-24.
6 | // Copyright (c) 2013年 小码哥. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "MJExtensionConst.h"
11 | #import
12 | #import "MJProperty.h"
13 |
14 | /**
15 | * KeyValue协议
16 | */
17 | @protocol MJKeyValue
18 | @optional
19 | /**
20 | * 只有这个数组中的属性名才允许进行字典和模型的转换
21 | */
22 | + (NSArray *)mj_allowedPropertyNames;
23 |
24 | /**
25 | * 这个数组中的属性名将会被忽略:不进行字典和模型的转换
26 | */
27 | + (NSArray *)mj_ignoredPropertyNames;
28 |
29 | /**
30 | * 将属性名换为其他key去字典中取值
31 | *
32 | * @return 字典中的key是属性名,value是从字典中取值用的key
33 | */
34 | + (NSDictionary *)mj_replacedKeyFromPropertyName;
35 |
36 | /**
37 | * 将属性名换为其他key去字典中取值
38 | *
39 | * @return 从字典中取值用的key
40 | */
41 | + (id)mj_replacedKeyFromPropertyName121:(NSString *)propertyName;
42 |
43 | /**
44 | * 数组中需要转换的模型类
45 | *
46 | * @return 字典中的key是数组属性名,value是数组中存放模型的Class(Class类型或者NSString类型)
47 | */
48 | + (NSDictionary *)mj_objectClassInArray;
49 |
50 | /**
51 | * 旧值换新值,用于过滤字典中的值
52 | *
53 | * @param oldValue 旧值
54 | *
55 | * @return 新值
56 | */
57 | - (id)mj_newValueFromOldValue:(id)oldValue property:(MJProperty *)property;
58 |
59 | /**
60 | * 当字典转模型完毕时调用
61 | */
62 | - (void)mj_keyValuesDidFinishConvertingToObject;
63 |
64 | /**
65 | * 当模型转字典完毕时调用
66 | */
67 | - (void)mj_objectDidFinishConvertingToKeyValues;
68 | @end
69 |
70 | @interface NSObject (MJKeyValue)
71 | #pragma mark - 类方法
72 | /**
73 | * 字典转模型过程中遇到的错误
74 | */
75 | + (NSError *)mj_error;
76 |
77 | /**
78 | * 模型转字典时,字典的key是否参考replacedKeyFromPropertyName等方法(父类设置了,子类也会继承下来)
79 | */
80 | + (void)mj_referenceReplacedKeyWhenCreatingKeyValues:(BOOL)reference;
81 |
82 | #pragma mark - 对象方法
83 | /**
84 | * 将字典的键值对转成模型属性
85 | * @param keyValues 字典(可以是NSDictionary、NSData、NSString)
86 | */
87 | - (instancetype)mj_setKeyValues:(id)keyValues;
88 |
89 | /**
90 | * 将字典的键值对转成模型属性
91 | * @param keyValues 字典(可以是NSDictionary、NSData、NSString)
92 | * @param context CoreData上下文
93 | */
94 | - (instancetype)mj_setKeyValues:(id)keyValues context:(NSManagedObjectContext *)context;
95 |
96 | /**
97 | * 将模型转成字典
98 | * @return 字典
99 | */
100 | - (NSMutableDictionary *)mj_keyValues;
101 | - (NSMutableDictionary *)mj_keyValuesWithKeys:(NSArray *)keys;
102 | - (NSMutableDictionary *)mj_keyValuesWithIgnoredKeys:(NSArray *)ignoredKeys;
103 |
104 | /**
105 | * 通过模型数组来创建一个字典数组
106 | * @param objectArray 模型数组
107 | * @return 字典数组
108 | */
109 | + (NSMutableArray *)mj_keyValuesArrayWithObjectArray:(NSArray *)objectArray;
110 | + (NSMutableArray *)mj_keyValuesArrayWithObjectArray:(NSArray *)objectArray keys:(NSArray *)keys;
111 | + (NSMutableArray *)mj_keyValuesArrayWithObjectArray:(NSArray *)objectArray ignoredKeys:(NSArray *)ignoredKeys;
112 |
113 | #pragma mark - 字典转模型
114 | /**
115 | * 通过字典来创建一个模型
116 | * @param keyValues 字典(可以是NSDictionary、NSData、NSString)
117 | * @return 新建的对象
118 | */
119 | + (instancetype)mj_objectWithKeyValues:(id)keyValues;
120 |
121 | /**
122 | * 通过字典来创建一个CoreData模型
123 | * @param keyValues 字典(可以是NSDictionary、NSData、NSString)
124 | * @param context CoreData上下文
125 | * @return 新建的对象
126 | */
127 | + (instancetype)mj_objectWithKeyValues:(id)keyValues context:(NSManagedObjectContext *)context;
128 |
129 | /**
130 | * 通过plist来创建一个模型
131 | * @param filename 文件名(仅限于mainBundle中的文件)
132 | * @return 新建的对象
133 | */
134 | + (instancetype)mj_objectWithFilename:(NSString *)filename;
135 |
136 | /**
137 | * 通过plist来创建一个模型
138 | * @param file 文件全路径
139 | * @return 新建的对象
140 | */
141 | + (instancetype)mj_objectWithFile:(NSString *)file;
142 |
143 | #pragma mark - 字典数组转模型数组
144 | /**
145 | * 通过字典数组来创建一个模型数组
146 | * @param keyValuesArray 字典数组(可以是NSDictionary、NSData、NSString)
147 | * @return 模型数组
148 | */
149 | + (NSMutableArray *)mj_objectArrayWithKeyValuesArray:(id)keyValuesArray;
150 |
151 | /**
152 | * 通过字典数组来创建一个模型数组
153 | * @param keyValuesArray 字典数组(可以是NSDictionary、NSData、NSString)
154 | * @param context CoreData上下文
155 | * @return 模型数组
156 | */
157 | + (NSMutableArray *)mj_objectArrayWithKeyValuesArray:(id)keyValuesArray context:(NSManagedObjectContext *)context;
158 |
159 | /**
160 | * 通过plist来创建一个模型数组
161 | * @param filename 文件名(仅限于mainBundle中的文件)
162 | * @return 模型数组
163 | */
164 | + (NSMutableArray *)mj_objectArrayWithFilename:(NSString *)filename;
165 |
166 | /**
167 | * 通过plist来创建一个模型数组
168 | * @param file 文件全路径
169 | * @return 模型数组
170 | */
171 | + (NSMutableArray *)mj_objectArrayWithFile:(NSString *)file;
172 |
173 | #pragma mark - 转换为JSON
174 | /**
175 | * 转换为JSON Data
176 | */
177 | - (NSData *)mj_JSONData;
178 | /**
179 | * 转换为字典或者数组
180 | */
181 | - (id)mj_JSONObject;
182 | /**
183 | * 转换为JSON 字符串
184 | */
185 | - (NSString *)mj_JSONString;
186 | @end
187 |
188 | @interface NSObject (MJKeyValueDeprecated_v_2_5_16)
189 | - (instancetype)setKeyValues:(id)keyValue MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
190 | - (instancetype)setKeyValues:(id)keyValues error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
191 | - (instancetype)setKeyValues:(id)keyValues context:(NSManagedObjectContext *)context MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
192 | - (instancetype)setKeyValues:(id)keyValues context:(NSManagedObjectContext *)context error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
193 | + (void)referenceReplacedKeyWhenCreatingKeyValues:(BOOL)reference MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
194 | - (NSMutableDictionary *)keyValues MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
195 | - (NSMutableDictionary *)keyValuesWithError:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
196 | - (NSMutableDictionary *)keyValuesWithKeys:(NSArray *)keys MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
197 | - (NSMutableDictionary *)keyValuesWithKeys:(NSArray *)keys error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
198 | - (NSMutableDictionary *)keyValuesWithIgnoredKeys:(NSArray *)ignoredKeys MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
199 | - (NSMutableDictionary *)keyValuesWithIgnoredKeys:(NSArray *)ignoredKeys error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
200 | + (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
201 | + (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
202 | + (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray keys:(NSArray *)keys MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
203 | + (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray keys:(NSArray *)keys error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
204 | + (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray ignoredKeys:(NSArray *)ignoredKeys MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
205 | + (NSMutableArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray ignoredKeys:(NSArray *)ignoredKeys error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
206 | + (instancetype)objectWithKeyValues:(id)keyValues MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
207 | + (instancetype)objectWithKeyValues:(id)keyValues error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
208 | + (instancetype)objectWithKeyValues:(id)keyValues context:(NSManagedObjectContext *)context MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
209 | + (instancetype)objectWithKeyValues:(id)keyValues context:(NSManagedObjectContext *)context error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
210 | + (instancetype)objectWithFilename:(NSString *)filename MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
211 | + (instancetype)objectWithFilename:(NSString *)filename error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
212 | + (instancetype)objectWithFile:(NSString *)file MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
213 | + (instancetype)objectWithFile:(NSString *)file error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
214 | + (NSMutableArray *)objectArrayWithKeyValuesArray:(id)keyValuesArray MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
215 | + (NSMutableArray *)objectArrayWithKeyValuesArray:(id)keyValuesArray error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
216 | + (NSMutableArray *)objectArrayWithKeyValuesArray:(id)keyValuesArray context:(NSManagedObjectContext *)context MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
217 | + (NSMutableArray *)objectArrayWithKeyValuesArray:(id)keyValuesArray context:(NSManagedObjectContext *)context error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
218 | + (NSMutableArray *)objectArrayWithFilename:(NSString *)filename MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
219 | + (NSMutableArray *)objectArrayWithFilename:(NSString *)filename error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
220 | + (NSMutableArray *)objectArrayWithFile:(NSString *)file MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
221 | + (NSMutableArray *)objectArrayWithFile:(NSString *)file error:(NSError **)error MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
222 | - (NSData *)JSONData MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
223 | - (id)JSONObject MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
224 | - (NSString *)JSONString MJExtensionDeprecated("请在方法名前面加上mj_前缀,使用mj_***");
225 | @end
226 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/Masonry/MASConstraint.m:
--------------------------------------------------------------------------------
1 | //
2 | // MASConstraint.m
3 | // Masonry
4 | //
5 | // Created by Nick Tymchenko on 1/20/14.
6 | //
7 |
8 | #import "MASConstraint.h"
9 | #import "MASConstraint+Private.h"
10 |
11 | #define MASMethodNotImplemented() \
12 | @throw [NSException exceptionWithName:NSInternalInconsistencyException \
13 | reason:[NSString stringWithFormat:@"You must override %@ in a subclass.", NSStringFromSelector(_cmd)] \
14 | userInfo:nil]
15 |
16 | @implementation MASConstraint
17 |
18 | #pragma mark - Init
19 |
20 | - (id)init {
21 | NSAssert(![self isMemberOfClass:[MASConstraint class]], @"MASConstraint is an abstract class, you should not instantiate it directly.");
22 | return [super init];
23 | }
24 |
25 | #pragma mark - NSLayoutRelation proxies
26 |
27 | - (MASConstraint * (^)(id))equalTo {
28 | return ^id(id attribute) {
29 | return self.equalToWithRelation(attribute, NSLayoutRelationEqual);
30 | };
31 | }
32 |
33 | - (MASConstraint * (^)(id))mas_equalTo {
34 | return ^id(id attribute) {
35 | return self.equalToWithRelation(attribute, NSLayoutRelationEqual);
36 | };
37 | }
38 |
39 | - (MASConstraint * (^)(id))greaterThanOrEqualTo {
40 | return ^id(id attribute) {
41 | return self.equalToWithRelation(attribute, NSLayoutRelationGreaterThanOrEqual);
42 | };
43 | }
44 |
45 | - (MASConstraint * (^)(id))mas_greaterThanOrEqualTo {
46 | return ^id(id attribute) {
47 | return self.equalToWithRelation(attribute, NSLayoutRelationGreaterThanOrEqual);
48 | };
49 | }
50 |
51 | - (MASConstraint * (^)(id))lessThanOrEqualTo {
52 | return ^id(id attribute) {
53 | return self.equalToWithRelation(attribute, NSLayoutRelationLessThanOrEqual);
54 | };
55 | }
56 |
57 | - (MASConstraint * (^)(id))mas_lessThanOrEqualTo {
58 | return ^id(id attribute) {
59 | return self.equalToWithRelation(attribute, NSLayoutRelationLessThanOrEqual);
60 | };
61 | }
62 |
63 | #pragma mark - MASLayoutPriority proxies
64 |
65 | - (MASConstraint * (^)(void))priorityLow {
66 | return ^id{
67 | self.priority(MASLayoutPriorityDefaultLow);
68 | return self;
69 | };
70 | }
71 |
72 | - (MASConstraint * (^)(void))priorityMedium {
73 | return ^id{
74 | self.priority(MASLayoutPriorityDefaultMedium);
75 | return self;
76 | };
77 | }
78 |
79 | - (MASConstraint * (^)(void))priorityHigh {
80 | return ^id{
81 | self.priority(MASLayoutPriorityDefaultHigh);
82 | return self;
83 | };
84 | }
85 |
86 | #pragma mark - NSLayoutConstraint constant proxies
87 |
88 | - (MASConstraint * (^)(MASEdgeInsets))insets {
89 | return ^id(MASEdgeInsets insets){
90 | self.insets = insets;
91 | return self;
92 | };
93 | }
94 |
95 | - (MASConstraint * (^)(CGFloat))inset {
96 | return ^id(CGFloat inset){
97 | self.inset = inset;
98 | return self;
99 | };
100 | }
101 |
102 | - (MASConstraint * (^)(CGSize))sizeOffset {
103 | return ^id(CGSize offset) {
104 | self.sizeOffset = offset;
105 | return self;
106 | };
107 | }
108 |
109 | - (MASConstraint * (^)(CGPoint))centerOffset {
110 | return ^id(CGPoint offset) {
111 | self.centerOffset = offset;
112 | return self;
113 | };
114 | }
115 |
116 | - (MASConstraint * (^)(CGFloat))offset {
117 | return ^id(CGFloat offset){
118 | self.offset = offset;
119 | return self;
120 | };
121 | }
122 |
123 | - (MASConstraint * (^)(NSValue *value))valueOffset {
124 | return ^id(NSValue *offset) {
125 | NSAssert([offset isKindOfClass:NSValue.class], @"expected an NSValue offset, got: %@", offset);
126 | [self setLayoutConstantWithValue:offset];
127 | return self;
128 | };
129 | }
130 |
131 | - (MASConstraint * (^)(id offset))mas_offset {
132 | // Will never be called due to macro
133 | return nil;
134 | }
135 |
136 | #pragma mark - NSLayoutConstraint constant setter
137 |
138 | - (void)setLayoutConstantWithValue:(NSValue *)value {
139 | if ([value isKindOfClass:NSNumber.class]) {
140 | self.offset = [(NSNumber *)value doubleValue];
141 | } else if (strcmp(value.objCType, @encode(CGPoint)) == 0) {
142 | CGPoint point;
143 | [value getValue:&point];
144 | self.centerOffset = point;
145 | } else if (strcmp(value.objCType, @encode(CGSize)) == 0) {
146 | CGSize size;
147 | [value getValue:&size];
148 | self.sizeOffset = size;
149 | } else if (strcmp(value.objCType, @encode(MASEdgeInsets)) == 0) {
150 | MASEdgeInsets insets;
151 | [value getValue:&insets];
152 | self.insets = insets;
153 | } else {
154 | NSAssert(NO, @"attempting to set layout constant with unsupported value: %@", value);
155 | }
156 | }
157 |
158 | #pragma mark - Semantic properties
159 |
160 | - (MASConstraint *)with {
161 | return self;
162 | }
163 |
164 | - (MASConstraint *)and {
165 | return self;
166 | }
167 |
168 | #pragma mark - Chaining
169 |
170 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute __unused)layoutAttribute {
171 | MASMethodNotImplemented();
172 | }
173 |
174 | - (MASConstraint *)left {
175 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeft];
176 | }
177 |
178 | - (MASConstraint *)top {
179 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTop];
180 | }
181 |
182 | - (MASConstraint *)right {
183 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRight];
184 | }
185 |
186 | - (MASConstraint *)bottom {
187 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottom];
188 | }
189 |
190 | - (MASConstraint *)leading {
191 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeading];
192 | }
193 |
194 | - (MASConstraint *)trailing {
195 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailing];
196 | }
197 |
198 | - (MASConstraint *)width {
199 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeWidth];
200 | }
201 |
202 | - (MASConstraint *)height {
203 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeHeight];
204 | }
205 |
206 | - (MASConstraint *)centerX {
207 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterX];
208 | }
209 |
210 | - (MASConstraint *)centerY {
211 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterY];
212 | }
213 |
214 | - (MASConstraint *)baseline {
215 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBaseline];
216 | }
217 |
218 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
219 |
220 | - (MASConstraint *)firstBaseline {
221 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeFirstBaseline];
222 | }
223 | - (MASConstraint *)lastBaseline {
224 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLastBaseline];
225 | }
226 |
227 | #endif
228 |
229 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000)
230 |
231 | - (MASConstraint *)leftMargin {
232 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeftMargin];
233 | }
234 |
235 | - (MASConstraint *)rightMargin {
236 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRightMargin];
237 | }
238 |
239 | - (MASConstraint *)topMargin {
240 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTopMargin];
241 | }
242 |
243 | - (MASConstraint *)bottomMargin {
244 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottomMargin];
245 | }
246 |
247 | - (MASConstraint *)leadingMargin {
248 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeadingMargin];
249 | }
250 |
251 | - (MASConstraint *)trailingMargin {
252 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailingMargin];
253 | }
254 |
255 | - (MASConstraint *)centerXWithinMargins {
256 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterXWithinMargins];
257 | }
258 |
259 | - (MASConstraint *)centerYWithinMargins {
260 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterYWithinMargins];
261 | }
262 |
263 | #endif
264 |
265 | #pragma mark - Abstract
266 |
267 | - (MASConstraint * (^)(CGFloat multiplier))multipliedBy { MASMethodNotImplemented(); }
268 |
269 | - (MASConstraint * (^)(CGFloat divider))dividedBy { MASMethodNotImplemented(); }
270 |
271 | - (MASConstraint * (^)(MASLayoutPriority priority))priority { MASMethodNotImplemented(); }
272 |
273 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { MASMethodNotImplemented(); }
274 |
275 | - (MASConstraint * (^)(id key))key { MASMethodNotImplemented(); }
276 |
277 | - (void)setInsets:(MASEdgeInsets __unused)insets { MASMethodNotImplemented(); }
278 |
279 | - (void)setInset:(CGFloat __unused)inset { MASMethodNotImplemented(); }
280 |
281 | - (void)setSizeOffset:(CGSize __unused)sizeOffset { MASMethodNotImplemented(); }
282 |
283 | - (void)setCenterOffset:(CGPoint __unused)centerOffset { MASMethodNotImplemented(); }
284 |
285 | - (void)setOffset:(CGFloat __unused)offset { MASMethodNotImplemented(); }
286 |
287 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
288 |
289 | - (MASConstraint *)animator { MASMethodNotImplemented(); }
290 |
291 | #endif
292 |
293 | - (void)activate { MASMethodNotImplemented(); }
294 |
295 | - (void)deactivate { MASMethodNotImplemented(); }
296 |
297 | - (void)install { MASMethodNotImplemented(); }
298 |
299 | - (void)uninstall { MASMethodNotImplemented(); }
300 |
301 | @end
302 |
--------------------------------------------------------------------------------
/CCTimeLine/Third/MJExtension/NSObject+MJProperty.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+MJProperty.m
3 | // MJExtensionExample
4 | //
5 | // Created by MJ Lee on 15/4/17.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "NSObject+MJProperty.h"
10 | #import "NSObject+MJKeyValue.h"
11 | #import "NSObject+MJCoding.h"
12 | #import "NSObject+MJClass.h"
13 | #import "MJProperty.h"
14 | #import "MJFoundation.h"
15 | #import
16 |
17 | #pragma clang diagnostic push
18 | #pragma clang diagnostic ignored "-Wundeclared-selector"
19 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
20 |
21 | static const char MJReplacedKeyFromPropertyNameKey = '\0';
22 | static const char MJReplacedKeyFromPropertyName121Key = '\0';
23 | static const char MJNewValueFromOldValueKey = '\0';
24 | static const char MJObjectClassInArrayKey = '\0';
25 |
26 | static const char MJCachedPropertiesKey = '\0';
27 |
28 | @implementation NSObject (Property)
29 |
30 | + (NSMutableDictionary *)propertyDictForKey:(const void *)key
31 | {
32 | static NSMutableDictionary *replacedKeyFromPropertyNameDict;
33 | static NSMutableDictionary *replacedKeyFromPropertyName121Dict;
34 | static NSMutableDictionary *newValueFromOldValueDict;
35 | static NSMutableDictionary *objectClassInArrayDict;
36 | static NSMutableDictionary *cachedPropertiesDict;
37 |
38 | static dispatch_once_t onceToken;
39 | dispatch_once(&onceToken, ^{
40 | replacedKeyFromPropertyNameDict = [NSMutableDictionary dictionary];
41 | replacedKeyFromPropertyName121Dict = [NSMutableDictionary dictionary];
42 | newValueFromOldValueDict = [NSMutableDictionary dictionary];
43 | objectClassInArrayDict = [NSMutableDictionary dictionary];
44 | cachedPropertiesDict = [NSMutableDictionary dictionary];
45 | });
46 |
47 | if (key == &MJReplacedKeyFromPropertyNameKey) return replacedKeyFromPropertyNameDict;
48 | if (key == &MJReplacedKeyFromPropertyName121Key) return replacedKeyFromPropertyName121Dict;
49 | if (key == &MJNewValueFromOldValueKey) return newValueFromOldValueDict;
50 | if (key == &MJObjectClassInArrayKey) return objectClassInArrayDict;
51 | if (key == &MJCachedPropertiesKey) return cachedPropertiesDict;
52 | return nil;
53 | }
54 |
55 | #pragma mark - --私有方法--
56 | + (id)propertyKey:(NSString *)propertyName
57 | {
58 | MJExtensionAssertParamNotNil2(propertyName, nil);
59 |
60 | __block id key = nil;
61 | // 查看有没有需要替换的key
62 | if ([self respondsToSelector:@selector(mj_replacedKeyFromPropertyName121:)]) {
63 | key = [self mj_replacedKeyFromPropertyName121:propertyName];
64 | }
65 | // 兼容旧版本
66 | if ([self respondsToSelector:@selector(replacedKeyFromPropertyName121:)]) {
67 | key = [self performSelector:@selector(replacedKeyFromPropertyName121) withObject:propertyName];
68 | }
69 |
70 | // 调用block
71 | if (!key) {
72 | [self mj_enumerateAllClasses:^(__unsafe_unretained Class c, BOOL *stop) {
73 | MJReplacedKeyFromPropertyName121 block = objc_getAssociatedObject(c, &MJReplacedKeyFromPropertyName121Key);
74 | if (block) {
75 | key = block(propertyName);
76 | }
77 | if (key) *stop = YES;
78 | }];
79 | }
80 |
81 | // 查看有没有需要替换的key
82 | if ((!key || [key isEqual:propertyName]) && [self respondsToSelector:@selector(mj_replacedKeyFromPropertyName)]) {
83 | key = [self mj_replacedKeyFromPropertyName][propertyName];
84 | }
85 | // 兼容旧版本
86 | if ((!key || [key isEqual:propertyName]) && [self respondsToSelector:@selector(replacedKeyFromPropertyName)]) {
87 | key = [self performSelector:@selector(replacedKeyFromPropertyName)][propertyName];
88 | }
89 |
90 | if (!key || [key isEqual:propertyName]) {
91 | [self mj_enumerateAllClasses:^(__unsafe_unretained Class c, BOOL *stop) {
92 | NSDictionary *dict = objc_getAssociatedObject(c, &MJReplacedKeyFromPropertyNameKey);
93 | if (dict) {
94 | key = dict[propertyName];
95 | }
96 | if (key && ![key isEqual:propertyName]) *stop = YES;
97 | }];
98 | }
99 |
100 | // 2.用属性名作为key
101 | if (!key) key = propertyName;
102 |
103 | return key;
104 | }
105 |
106 | + (Class)propertyObjectClassInArray:(NSString *)propertyName
107 | {
108 | __block id clazz = nil;
109 | if ([self respondsToSelector:@selector(mj_objectClassInArray)]) {
110 | clazz = [self mj_objectClassInArray][propertyName];
111 | }
112 | // 兼容旧版本
113 | if ([self respondsToSelector:@selector(objectClassInArray)]) {
114 | clazz = [self performSelector:@selector(objectClassInArray)][propertyName];
115 | }
116 |
117 | if (!clazz) {
118 | [self mj_enumerateAllClasses:^(__unsafe_unretained Class c, BOOL *stop) {
119 | NSDictionary *dict = objc_getAssociatedObject(c, &MJObjectClassInArrayKey);
120 | if (dict) {
121 | clazz = dict[propertyName];
122 | }
123 | if (clazz) *stop = YES;
124 | }];
125 | }
126 |
127 | // 如果是NSString类型
128 | if ([clazz isKindOfClass:[NSString class]]) {
129 | clazz = NSClassFromString(clazz);
130 | }
131 | return clazz;
132 | }
133 |
134 | #pragma mark - --公共方法--
135 | + (void)mj_enumerateProperties:(MJPropertiesEnumeration)enumeration
136 | {
137 | // 获得成员变量
138 | NSArray *cachedProperties = [self properties];
139 |
140 | // 遍历成员变量
141 | BOOL stop = NO;
142 | for (MJProperty *property in cachedProperties) {
143 | enumeration(property, &stop);
144 | if (stop) break;
145 | }
146 | }
147 |
148 | #pragma mark - 公共方法
149 | + (NSMutableArray *)properties
150 | {
151 | NSMutableArray *cachedProperties = [self propertyDictForKey:&MJCachedPropertiesKey][NSStringFromClass(self)];
152 |
153 | if (cachedProperties == nil) {
154 | MJExtensionSemaphoreCreate
155 | MJExtensionSemaphoreWait
156 |
157 | if (cachedProperties == nil) {
158 | cachedProperties = [NSMutableArray array];
159 |
160 | [self mj_enumerateClasses:^(__unsafe_unretained Class c, BOOL *stop) {
161 | // 1.获得所有的成员变量
162 | unsigned int outCount = 0;
163 | objc_property_t *properties = class_copyPropertyList(c, &outCount);
164 |
165 | // 2.遍历每一个成员变量
166 | for (unsigned int i = 0; i