├── TableViewsInTableView
├── sourceImage
│ └── 2.gif
├── TableViewsInTableView
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ ├── bueaty2.imageset
│ │ │ ├── bueaty2.jpg
│ │ │ └── Contents.json
│ │ ├── kylinLogo.imageset
│ │ │ ├── kylinLogo.png
│ │ │ └── Contents.json
│ │ ├── kylin_Apple.imageset
│ │ │ ├── kylin_Apple.png
│ │ │ └── Contents.json
│ │ ├── kylin_test4.imageset
│ │ │ ├── kylin_test4.jpg
│ │ │ └── Contents.json
│ │ ├── kylin_placeHolder.imageset
│ │ │ ├── kylin_placeHolder.png
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── KylinMainViewController.h
│ ├── Masonry
│ │ ├── MASLayoutConstraint.m
│ │ ├── NSLayoutConstraint+MASDebugAdditions.h
│ │ ├── MASLayoutConstraint.h
│ │ ├── MASCompositeConstraint.h
│ │ ├── Info.plist
│ │ ├── Masonry.h
│ │ ├── ViewController+MASAdditions.h
│ │ ├── NSArray+MASShorthandAdditions.h
│ │ ├── MASViewAttribute.m
│ │ ├── MASViewAttribute.h
│ │ ├── ViewController+MASAdditions.m
│ │ ├── MASViewConstraint.h
│ │ ├── MASConstraint+Private.h
│ │ ├── NSArray+MASAdditions.h
│ │ ├── View+MASShorthandAdditions.h
│ │ ├── View+MASAdditions.h
│ │ ├── MASCompositeConstraint.m
│ │ ├── MASConstraintMaker.h
│ │ ├── View+MASAdditions.m
│ │ ├── NSLayoutConstraint+MASDebugAdditions.m
│ │ ├── MASUtilities.h
│ │ ├── NSArray+MASAdditions.m
│ │ ├── MASConstraint.h
│ │ ├── MASConstraint.m
│ │ ├── MASConstraintMaker.m
│ │ └── MASViewConstraint.m
│ ├── KylinScrollView.h
│ ├── AppDelegate.h
│ ├── main.m
│ ├── KylinTwoViewController.h
│ ├── KylinOneViewController.h
│ ├── KylinFourViewController.h
│ ├── KylinThreeViewController.h
│ ├── UIView+Kylin.h
│ ├── KylinScrollView.m
│ ├── Info.plist
│ ├── UIView+Kylin.m
│ ├── KylinThreeViewController.m
│ ├── KylinTwoViewController.m
│ ├── KylinOneViewController.m
│ ├── AppDelegate.m
│ ├── KylinFourViewController.m
│ ├── Base.lproj
│ │ └── LaunchScreen.storyboard
│ └── KylinMainViewController.m
├── TableViewsInTableView.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── project.pbxproj
├── TableViewsInTableViewTests
│ ├── Info.plist
│ └── TableViewsInTableViewTests.m
└── TableViewsInTableViewUITests
│ ├── Info.plist
│ └── TableViewsInTableViewUITests.m
├── README.md
├── .gitignore
└── LICENSE
/TableViewsInTableView/sourceImage/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KylinSpace/TableViewsInTableView/HEAD/TableViewsInTableView/sourceImage/2.gif
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/bueaty2.imageset/bueaty2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KylinSpace/TableViewsInTableView/HEAD/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/bueaty2.imageset/bueaty2.jpg
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylinLogo.imageset/kylinLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KylinSpace/TableViewsInTableView/HEAD/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylinLogo.imageset/kylinLogo.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## 1:多个tableView嵌套tableView Plain 样式下的效果实现
2 |
3 | ## 2:scrollView中的tableView左滑删除
4 |
5 | ####如下图:
6 | 
7 |
8 | ###祥细内容请看源代码,分享是一种美德!
9 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylin_Apple.imageset/kylin_Apple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KylinSpace/TableViewsInTableView/HEAD/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylin_Apple.imageset/kylin_Apple.png
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylin_test4.imageset/kylin_test4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KylinSpace/TableViewsInTableView/HEAD/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylin_test4.imageset/kylin_test4.jpg
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylin_placeHolder.imageset/kylin_placeHolder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KylinSpace/TableViewsInTableView/HEAD/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylin_placeHolder.imageset/kylin_placeHolder.png
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinMainViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KylinMainViewController.h
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KylinMainViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinScrollView.h:
--------------------------------------------------------------------------------
1 | //
2 | // KylinScrollView.h
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KylinScrollView : UIScrollView
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. 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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. 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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/bueaty2.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "bueaty2.jpg",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylinLogo.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "kylinLogo.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylin_Apple.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "kylin_Apple.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylin_test4.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "kylin_test4.jpg",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/kylin_placeHolder.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "kylin_placeHolder.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinTwoViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KylinTwoViewController.h
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/9.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import
10 | @protocol KylinTwoViewControllerDelegate
11 | @optional
12 | - (void)KylinTwoViewTableViewDidScroll:(CGFloat)scrollY;
13 | @end
14 | @interface KylinTwoViewController : UITableViewController
15 | /**代理*/
16 | @property(nonatomic,weak)id delegate;
17 | @end
18 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinOneViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KylinOneViewController.h
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/9.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import
10 | @protocol KylinOneViewControllerDelegate
11 | @optional
12 | - (void)KylinOneViewTableViewDidScroll:(CGFloat)scrollY;
13 | @end
14 |
15 | @interface KylinOneViewController : UITableViewController
16 | /**代理*/
17 | @property(nonatomic,weak)id delegate;
18 | @end
19 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinFourViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KylinFourViewController.h
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/9.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import
10 | @protocol KylinFourViewControllerDelegate
11 | @optional
12 | - (void)KylinFourViewTableViewDidScroll:(CGFloat)scrollY;
13 | @end
14 | @interface KylinFourViewController : UITableViewController
15 | /**delegate*/
16 | @property(nonatomic,weak)id delegate;
17 | @end
18 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinThreeViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KylinThreeViewController.h
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/9.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import
10 | @protocol KylinThreeViewControllerDelegate
11 | @optional
12 | - (void)KylinThreeViewTableViewDidScroll:(CGFloat)scrollY;
13 | @end
14 | @interface KylinThreeViewController : UITableViewController
15 | /**delegate*/
16 | @property(nonatomic,weak)id delegate;
17 | @end
18 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/UIView+Kylin.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Kylin.h
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIView (Kylin)
12 | @property (nonatomic, assign) CGFloat KWidth;
13 | @property (nonatomic, assign) CGFloat KHeight;
14 | @property (nonatomic, assign) CGFloat Kx;
15 | @property (nonatomic, assign) CGFloat Ky;
16 | @property (nonatomic, assign) CGFloat KCenterX;
17 | @property (nonatomic, assign) CGFloat KCenterY;
18 | @end
19 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinScrollView.m:
--------------------------------------------------------------------------------
1 | //
2 | // KylinScrollView.m
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import "KylinScrollView.h"
10 |
11 | @implementation KylinScrollView
12 |
13 | // 该方法实现,如果一个手势没有被识别,那么多个手势可以被识别
14 | - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
15 | if (gestureRecognizer.state != 0) {
16 | return YES;
17 | }else{
18 | return NO;
19 | }
20 | }
21 | @end
22 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableViewTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableViewUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Masonry/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableViewTests/TableViewsInTableViewTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // TableViewsInTableViewTests.m
3 | // TableViewsInTableViewTests
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface TableViewsInTableViewTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation TableViewsInTableViewTests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | // Put setup code here. This method is called before the invocation of each test method in the class.
20 | }
21 |
22 | - (void)tearDown {
23 | // Put teardown code here. This method is called after the invocation of each test method in the class.
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample {
28 | // This is an example of a functional test case.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | - (void)testPerformanceExample {
33 | // This is an example of a performance test case.
34 | [self measureBlock:^{
35 | // Put the code you want to measure the time of here.
36 | }];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | TINT
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 |
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Masonry/MASViewAttribute.m:
--------------------------------------------------------------------------------
1 | //
2 | // MASAttribute.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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Masonry/MASViewAttribute.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASAttribute.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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableViewUITests/TableViewsInTableViewUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // TableViewsInTableViewUITests.m
3 | // TableViewsInTableViewUITests
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface TableViewsInTableViewUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation TableViewsInTableViewUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 | }
29 |
30 | - (void)tearDown {
31 | // Put teardown code here. This method is called after the invocation of each test method in the class.
32 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Masonry/MASViewConstraint.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASConstraint.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 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xcuserstate
23 |
24 | ## Obj-C/Swift specific
25 | *.hmap
26 | *.ipa
27 | *.dSYM.zip
28 | *.dSYM
29 |
30 | # CocoaPods
31 | #
32 | # We recommend against adding the Pods directory to your .gitignore. However
33 | # you should judge for yourself, the pros and cons are mentioned at:
34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
35 | #
36 | # Pods/
37 |
38 | # Carthage
39 | #
40 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
41 | # Carthage/Checkouts
42 |
43 | Carthage/Build
44 |
45 | # fastlane
46 | #
47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
48 | # screenshots whenever they are needed.
49 | # For more information about the recommended setup visit:
50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
51 |
52 | fastlane/report.xml
53 | fastlane/screenshots
54 |
55 | #Code Injection
56 | #
57 | # After new code Injection tools there's a generated folder /iOSInjectionProject
58 | # https://github.com/johnno1962/injectionforxcode
59 |
60 | iOSInjectionProject/
61 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/UIView+Kylin.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIView+Kylin.m
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import "UIView+Kylin.h"
10 |
11 | @implementation UIView (Kylin)
12 |
13 | - (void)setKWidth:(CGFloat)KWidth
14 | {
15 | CGRect frame = self.frame;
16 | frame.size.width = KWidth;
17 | self.frame = frame;
18 | }
19 |
20 |
21 | - (void)setKHeight:(CGFloat)KHeight
22 | {
23 | CGRect frame = self.frame;
24 | frame.size.height = KHeight;
25 | self.frame = frame;
26 | }
27 |
28 | - (void)setKx:(CGFloat)Kx
29 | {
30 | CGRect frame = self.frame;
31 | frame.origin.x = Kx;
32 | self.frame = frame;
33 | }
34 |
35 | - (void)setKy:(CGFloat)Ky
36 | {
37 | CGRect frame = self.frame;
38 | frame.origin.y = Ky;
39 | self.frame = frame;
40 | }
41 |
42 | - (CGFloat)KWidth
43 | {
44 | return self.frame.size.width;
45 | }
46 |
47 | - (CGFloat)KHeight
48 | {
49 | return self.frame.size.height;
50 | }
51 |
52 | - (CGFloat)Kx
53 | {
54 | return self.frame.origin.x;
55 | }
56 |
57 | - (CGFloat)Ky
58 | {
59 | return self.frame.origin.y;
60 | }
61 |
62 | -(void)setKCenterX:(CGFloat)KCenterX{
63 | CGPoint center = self.center;
64 | center.x = KCenterX;
65 | self.center = center;
66 | }
67 |
68 | - (CGFloat)KCenterX
69 | {
70 | return self.center.x;
71 | }
72 |
73 | - (void)setKCenterY:(CGFloat)KCenterY
74 | {
75 | CGPoint center = self.center;
76 | center.y = KCenterY;
77 | self.center = center;
78 | }
79 |
80 | - (CGFloat)KCenterY
81 | {
82 | return self.center.y;
83 | }
84 | @end
85 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinThreeViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KylinThreeViewController.m
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/9.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import "KylinThreeViewController.h"
10 | static CGFloat const OffsetY = 200;
11 | static NSString *const oneCell = @"oneCell";
12 |
13 | @implementation KylinThreeViewController
14 | - (void)viewDidLoad{
15 | [super viewDidLoad];
16 |
17 | [self setupConfigures];
18 | }
19 |
20 |
21 | - (void)setupConfigures{
22 | // 修改tableView的样式
23 | UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
24 | self.tableView = tableView;
25 | tableView.rowHeight = 74;
26 | self.tableView.contentInset = UIEdgeInsetsMake(OffsetY - 25, 0, -35, 0);
27 | self.tableView.scrollIndicatorInsets = self.tableView.contentInset;
28 | }
29 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
30 | return 30;
31 | }
32 |
33 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
34 |
35 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:oneCell];
36 |
37 | if (!cell) {
38 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:oneCell];
39 | }
40 | cell.imageView.image = [UIImage imageNamed:@"kylin_test4"];
41 | cell.textLabel.text = @"Yellow";
42 | return cell;
43 | }
44 | #pragma mark- scrollViewDelegate
45 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
46 | if ([self.delegate respondsToSelector:@selector(KylinThreeViewTableViewDidScroll:)]) {
47 | [self.delegate KylinThreeViewTableViewDidScroll:scrollView.contentOffset.y];
48 | }
49 | }
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinTwoViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KylinTwoViewController.m
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/9.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import "KylinTwoViewController.h"
10 |
11 | static CGFloat const OffsetY = 200;
12 | static NSString *const oneCell = @"oneCell";
13 |
14 | @implementation KylinTwoViewController
15 | - (void)viewDidLoad{
16 | [super viewDidLoad];
17 |
18 | [self setupConfigures];
19 | }
20 |
21 |
22 | - (void)setupConfigures{
23 | // 修改tableView的样式
24 | UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
25 | self.tableView = tableView;
26 | tableView.rowHeight = 100;
27 | self.tableView.contentInset = UIEdgeInsetsMake(OffsetY - 25, 0, -35, 0);
28 | self.tableView.scrollIndicatorInsets = self.tableView.contentInset;
29 | }
30 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
31 | return 30;
32 | }
33 |
34 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
35 |
36 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:oneCell];
37 |
38 | if (!cell) {
39 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:oneCell];
40 | }
41 | cell.imageView.image = [UIImage imageNamed:@"kylin_Apple"];
42 | cell.textLabel.text = @"Apple";
43 | return cell;
44 | }
45 |
46 | #pragma mark- scrollViewDelegate
47 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
48 | if ([self.delegate respondsToSelector:@selector(KylinTwoViewTableViewDidScroll:)]) {
49 | [self.delegate KylinTwoViewTableViewDidScroll:scrollView.contentOffset.y];
50 | }
51 | }
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinOneViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KylinOneViewController.m
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/9.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import "KylinOneViewController.h"
10 | static CGFloat const OffsetY = 200;
11 | static NSString *const oneCell = @"oneCell";
12 | @implementation KylinOneViewController
13 |
14 | - (void)viewDidLoad{
15 | [super viewDidLoad];
16 |
17 | [self setupConfigures];
18 | }
19 |
20 | - (void)setupConfigures{
21 | // 修改tableView的样式
22 | UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
23 | [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:oneCell];
24 | tableView.rowHeight = 100;
25 | self.tableView = tableView;
26 | self.tableView.contentInset = UIEdgeInsetsMake(OffsetY - 25, 0, -35, 0);
27 | self.tableView.scrollIndicatorInsets = self.tableView.contentInset;
28 | }
29 |
30 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
31 | return 30;
32 | }
33 |
34 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
35 |
36 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:oneCell];
37 |
38 | if (!cell) {
39 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:oneCell];
40 | }
41 | cell.imageView.image = [UIImage imageNamed:@"kylinLogo"];
42 | cell.textLabel.text = @"kylin";
43 | return cell;
44 | }
45 |
46 | #pragma mark- scrollViewDelegate
47 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
48 | if ([self.delegate respondsToSelector:@selector(KylinOneViewTableViewDidScroll:)]) {
49 | [self.delegate KylinOneViewTableViewDidScroll:scrollView.contentOffset.y];
50 | }
51 | }
52 | @end
53 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "KylinMainViewController.h"
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 |
20 | KylinMainViewController *mainView = [[KylinMainViewController alloc]init];
21 |
22 | UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:mainView];
23 |
24 | self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
25 |
26 | self.window.rootViewController = nav;
27 |
28 | [self.window makeKeyAndVisible];
29 |
30 | return YES;
31 | }
32 |
33 | - (void)applicationWillResignActive:(UIApplication *)application {
34 | // 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.
35 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
36 | }
37 |
38 | - (void)applicationDidEnterBackground:(UIApplication *)application {
39 | // 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.
40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
41 | }
42 |
43 | - (void)applicationWillEnterForeground:(UIApplication *)application {
44 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
45 | }
46 |
47 | - (void)applicationDidBecomeActive:(UIApplication *)application {
48 | // 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.
49 | }
50 |
51 | - (void)applicationWillTerminate:(UIApplication *)application {
52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinFourViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KylinFourViewController.m
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/9.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | //
8 |
9 | #import "KylinFourViewController.h"
10 | static CGFloat const OffsetY = 200;
11 | static NSString *const oneCell = @"oneCell";
12 | @implementation KylinFourViewController
13 |
14 | - (void)viewDidLoad{
15 | [super viewDidLoad];
16 |
17 | [self setupConfigures];
18 | }
19 |
20 | - (void)setupConfigures{
21 | // 修改tableView的样式
22 | UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
23 | self.tableView = tableView;
24 | tableView.rowHeight = 74;
25 | self.tableView.contentInset = UIEdgeInsetsMake(OffsetY - 25, 0, -35, 0);
26 | self.tableView.scrollIndicatorInsets = self.tableView.contentInset;
27 | }
28 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
29 | return 30;
30 | }
31 |
32 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
33 |
34 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:oneCell];
35 |
36 | if (!cell) {
37 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:oneCell];
38 | }
39 | cell.imageView.image = [UIImage imageNamed:@"kylin_placeHolder"];
40 | cell.textLabel.text = @"white";
41 | return cell;
42 | }
43 |
44 | #pragma mark- 左滑删除相关代理方法
45 |
46 | /**
47 | * 左滑cell时出现什么按钮
48 | */
49 | - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
50 | {
51 |
52 | UITableViewRowAction *action0 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"添加" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
53 |
54 | tableView.editing = NO;
55 | }];
56 |
57 | UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
58 |
59 | tableView.editing = NO;
60 | }];
61 | action0.backgroundColor = [UIColor colorWithRed:74/255.0 green:196/255.0 blue:189/255.0 alpha:1.0];
62 | return @[action1, action0];
63 |
64 |
65 | }
66 | #pragma mark- scrollViewDelegate
67 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
68 | if ([self.delegate respondsToSelector:@selector(KylinFourViewTableViewDidScroll:)]) {
69 | [self.delegate KylinFourViewTableViewDidScroll:scrollView.contentOffset.y];
70 | }
71 | }
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 (^)(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 (^)(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 (^)(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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 TARGET_OS_IPHONE || TARGET_OS_TV
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 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block;
53 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block;
54 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block;
55 |
56 | @end
57 |
58 | #define MAS_ATTR_FORWARD(attr) \
59 | - (MASViewAttribute *)attr { \
60 | return [self mas_##attr]; \
61 | }
62 |
63 | @implementation MAS_VIEW (MASShorthandAdditions)
64 |
65 | MAS_ATTR_FORWARD(top);
66 | MAS_ATTR_FORWARD(left);
67 | MAS_ATTR_FORWARD(bottom);
68 | MAS_ATTR_FORWARD(right);
69 | MAS_ATTR_FORWARD(leading);
70 | MAS_ATTR_FORWARD(trailing);
71 | MAS_ATTR_FORWARD(width);
72 | MAS_ATTR_FORWARD(height);
73 | MAS_ATTR_FORWARD(centerX);
74 | MAS_ATTR_FORWARD(centerY);
75 | MAS_ATTR_FORWARD(baseline);
76 |
77 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
78 |
79 | MAS_ATTR_FORWARD(firstBaseline);
80 | MAS_ATTR_FORWARD(lastBaseline);
81 |
82 | #endif
83 |
84 | #if TARGET_OS_IPHONE || TARGET_OS_TV
85 |
86 | MAS_ATTR_FORWARD(leftMargin);
87 | MAS_ATTR_FORWARD(rightMargin);
88 | MAS_ATTR_FORWARD(topMargin);
89 | MAS_ATTR_FORWARD(bottomMargin);
90 | MAS_ATTR_FORWARD(leadingMargin);
91 | MAS_ATTR_FORWARD(trailingMargin);
92 | MAS_ATTR_FORWARD(centerXWithinMargins);
93 | MAS_ATTR_FORWARD(centerYWithinMargins);
94 |
95 | #endif
96 |
97 | - (MASViewAttribute *(^)(NSLayoutAttribute))attribute {
98 | return [self mas_attribute];
99 | }
100 |
101 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block {
102 | return [self mas_makeConstraints:block];
103 | }
104 |
105 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block {
106 | return [self mas_updateConstraints:block];
107 | }
108 |
109 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block {
110 | return [self mas_remakeConstraints:block];
111 | }
112 |
113 | @end
114 |
115 | #endif
116 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 TARGET_OS_IPHONE || TARGET_OS_TV
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 | /**
56 | * a key to associate with this view
57 | */
58 | @property (nonatomic, strong) id mas_key;
59 |
60 | /**
61 | * Finds the closest common superview between this view and another view
62 | *
63 | * @param view other view
64 | *
65 | * @return returns nil if common superview could not be found
66 | */
67 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view;
68 |
69 | /**
70 | * Creates a MASConstraintMaker with the callee view.
71 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing
72 | *
73 | * @param block scope within which you can build up the constraints which you wish to apply to the view.
74 | *
75 | * @return Array of created MASConstraints
76 | */
77 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block;
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 | * If an existing constraint exists then it will be updated instead.
83 | *
84 | * @param block scope within which you can build up the constraints which you wish to apply to the view.
85 | *
86 | * @return Array of created/updated MASConstraints
87 | */
88 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block;
89 |
90 | /**
91 | * Creates a MASConstraintMaker with the callee view.
92 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing.
93 | * All constraints previously installed for the view will be removed.
94 | *
95 | * @param block scope within which you can build up the constraints which you wish to apply to the view.
96 | *
97 | * @return Array of created/updated MASConstraints
98 | */
99 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block;
100 |
101 | @end
102 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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)setOffset:(CGFloat)offset {
133 | for (MASConstraint *constraint in self.childConstraints) {
134 | constraint.offset = offset;
135 | }
136 | }
137 |
138 | - (void)setSizeOffset:(CGSize)sizeOffset {
139 | for (MASConstraint *constraint in self.childConstraints) {
140 | constraint.sizeOffset = sizeOffset;
141 | }
142 | }
143 |
144 | - (void)setCenterOffset:(CGPoint)centerOffset {
145 | for (MASConstraint *constraint in self.childConstraints) {
146 | constraint.centerOffset = centerOffset;
147 | }
148 | }
149 |
150 | #pragma mark - MASConstraint
151 |
152 | - (void)activate {
153 | for (MASConstraint *constraint in self.childConstraints) {
154 | [constraint activate];
155 | }
156 | }
157 |
158 | - (void)deactivate {
159 | for (MASConstraint *constraint in self.childConstraints) {
160 | [constraint deactivate];
161 | }
162 | }
163 |
164 | - (void)install {
165 | for (MASConstraint *constraint in self.childConstraints) {
166 | constraint.updateExisting = self.updateExisting;
167 | [constraint install];
168 | }
169 | }
170 |
171 | - (void)uninstall {
172 | for (MASConstraint *constraint in self.childConstraints) {
173 | [constraint uninstall];
174 | }
175 | }
176 |
177 | @end
178 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Masonry/MASConstraintMaker.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASConstraintBuilder.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 TARGET_OS_IPHONE || TARGET_OS_TV
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 TARGET_OS_IPHONE || TARGET_OS_TV
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 MASConstrait 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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 TARGET_OS_IPHONE || TARGET_OS_TV
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 | #pragma mark - associated properties
138 |
139 | - (id)mas_key {
140 | return objc_getAssociatedObject(self, @selector(mas_key));
141 | }
142 |
143 | - (void)setMas_key:(id)key {
144 | objc_setAssociatedObject(self, @selector(mas_key), key, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
145 | }
146 |
147 | #pragma mark - heirachy
148 |
149 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view {
150 | MAS_VIEW *closestCommonSuperview = nil;
151 |
152 | MAS_VIEW *secondViewSuperview = view;
153 | while (!closestCommonSuperview && secondViewSuperview) {
154 | MAS_VIEW *firstViewSuperview = self;
155 | while (!closestCommonSuperview && firstViewSuperview) {
156 | if (secondViewSuperview == firstViewSuperview) {
157 | closestCommonSuperview = secondViewSuperview;
158 | }
159 | firstViewSuperview = firstViewSuperview.superview;
160 | }
161 | secondViewSuperview = secondViewSuperview.superview;
162 | }
163 | return closestCommonSuperview;
164 | }
165 |
166 | @end
167 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 TARGET_OS_IPHONE || TARGET_OS_TV
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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Masonry/MASUtilities.h:
--------------------------------------------------------------------------------
1 | //
2 | // MASUtilities.h
3 | // Masonry
4 | //
5 | // Created by Jonas Budelmann on 19/08/13.
6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved.
7 | //
8 |
9 | #import
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 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 | if (prev) {
103 | CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1));
104 | make.width.equalTo(@(fixedItemLength));
105 | if (i == self.count - 1) {//last one
106 | make.right.equalTo(tempSuperView).offset(-tailSpacing);
107 | }
108 | else {
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 | make.width.equalTo(@(fixedItemLength));
115 | }
116 | }];
117 | prev = v;
118 | }
119 | }
120 | else {
121 | MAS_VIEW *prev;
122 | for (int i = 0; i < self.count; i++) {
123 | MAS_VIEW *v = self[i];
124 | [v mas_makeConstraints:^(MASConstraintMaker *make) {
125 | if (prev) {
126 | CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1));
127 | make.height.equalTo(@(fixedItemLength));
128 | if (i == self.count - 1) {//last one
129 | make.bottom.equalTo(tempSuperView).offset(-tailSpacing);
130 | }
131 | else {
132 | make.bottom.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset);
133 | }
134 | }
135 | else {//first one
136 | make.top.equalTo(tempSuperView).offset(leadSpacing);
137 | make.height.equalTo(@(fixedItemLength));
138 | }
139 | }];
140 | prev = v;
141 | }
142 | }
143 | }
144 |
145 | - (MAS_VIEW *)mas_commonSuperviewOfViews
146 | {
147 | MAS_VIEW *commonSuperview = nil;
148 | MAS_VIEW *previousView = nil;
149 | for (id object in self) {
150 | if ([object isKindOfClass:[MAS_VIEW class]]) {
151 | MAS_VIEW *view = (MAS_VIEW *)object;
152 | if (previousView) {
153 | commonSuperview = [view mas_closestCommonSuperview:commonSuperview];
154 | } else {
155 | commonSuperview = view;
156 | }
157 | previousView = view;
158 | }
159 | }
160 | 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.");
161 | return commonSuperview;
162 | }
163 |
164 | @end
165 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 | * NSLayoutAttributeWidth, NSLayoutAttributeHeight
31 | */
32 | - (MASConstraint * (^)(CGSize offset))sizeOffset;
33 |
34 | /**
35 | * Modifies the NSLayoutConstraint constant,
36 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
37 | * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY
38 | */
39 | - (MASConstraint * (^)(CGPoint offset))centerOffset;
40 |
41 | /**
42 | * Modifies the NSLayoutConstraint constant
43 | */
44 | - (MASConstraint * (^)(CGFloat offset))offset;
45 |
46 | /**
47 | * Modifies the NSLayoutConstraint constant based on a value type
48 | */
49 | - (MASConstraint * (^)(NSValue *value))valueOffset;
50 |
51 | /**
52 | * Sets the NSLayoutConstraint multiplier property
53 | */
54 | - (MASConstraint * (^)(CGFloat multiplier))multipliedBy;
55 |
56 | /**
57 | * Sets the NSLayoutConstraint multiplier to 1.0/dividedBy
58 | */
59 | - (MASConstraint * (^)(CGFloat divider))dividedBy;
60 |
61 | /**
62 | * Sets the NSLayoutConstraint priority to a float or MASLayoutPriority
63 | */
64 | - (MASConstraint * (^)(MASLayoutPriority priority))priority;
65 |
66 | /**
67 | * Sets the NSLayoutConstraint priority to MASLayoutPriorityLow
68 | */
69 | - (MASConstraint * (^)())priorityLow;
70 |
71 | /**
72 | * Sets the NSLayoutConstraint priority to MASLayoutPriorityMedium
73 | */
74 | - (MASConstraint * (^)())priorityMedium;
75 |
76 | /**
77 | * Sets the NSLayoutConstraint priority to MASLayoutPriorityHigh
78 | */
79 | - (MASConstraint * (^)())priorityHigh;
80 |
81 | /**
82 | * Sets the constraint relation to NSLayoutRelationEqual
83 | * returns a block which accepts one of the following:
84 | * MASViewAttribute, UIView, NSValue, NSArray
85 | * see readme for more details.
86 | */
87 | - (MASConstraint * (^)(id attr))equalTo;
88 |
89 | /**
90 | * Sets the constraint relation to NSLayoutRelationGreaterThanOrEqual
91 | * returns a block which accepts one of the following:
92 | * MASViewAttribute, UIView, NSValue, NSArray
93 | * see readme for more details.
94 | */
95 | - (MASConstraint * (^)(id attr))greaterThanOrEqualTo;
96 |
97 | /**
98 | * Sets the constraint relation to NSLayoutRelationLessThanOrEqual
99 | * returns a block which accepts one of the following:
100 | * MASViewAttribute, UIView, NSValue, NSArray
101 | * see readme for more details.
102 | */
103 | - (MASConstraint * (^)(id attr))lessThanOrEqualTo;
104 |
105 | /**
106 | * Optional semantic property which has no effect but improves the readability of constraint
107 | */
108 | - (MASConstraint *)with;
109 |
110 | /**
111 | * Optional semantic property which has no effect but improves the readability of constraint
112 | */
113 | - (MASConstraint *)and;
114 |
115 | /**
116 | * Creates a new MASCompositeConstraint with the called attribute and reciever
117 | */
118 | - (MASConstraint *)left;
119 | - (MASConstraint *)top;
120 | - (MASConstraint *)right;
121 | - (MASConstraint *)bottom;
122 | - (MASConstraint *)leading;
123 | - (MASConstraint *)trailing;
124 | - (MASConstraint *)width;
125 | - (MASConstraint *)height;
126 | - (MASConstraint *)centerX;
127 | - (MASConstraint *)centerY;
128 | - (MASConstraint *)baseline;
129 |
130 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
131 |
132 | - (MASConstraint *)firstBaseline;
133 | - (MASConstraint *)lastBaseline;
134 |
135 | #endif
136 |
137 | #if TARGET_OS_IPHONE || TARGET_OS_TV
138 |
139 | - (MASConstraint *)leftMargin;
140 | - (MASConstraint *)rightMargin;
141 | - (MASConstraint *)topMargin;
142 | - (MASConstraint *)bottomMargin;
143 | - (MASConstraint *)leadingMargin;
144 | - (MASConstraint *)trailingMargin;
145 | - (MASConstraint *)centerXWithinMargins;
146 | - (MASConstraint *)centerYWithinMargins;
147 |
148 | #endif
149 |
150 |
151 | /**
152 | * Sets the constraint debug name
153 | */
154 | - (MASConstraint * (^)(id key))key;
155 |
156 | // NSLayoutConstraint constant Setters
157 | // for use outside of mas_updateConstraints/mas_makeConstraints blocks
158 |
159 | /**
160 | * Modifies the NSLayoutConstraint constant,
161 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
162 | * NSLayoutAttributeTop, NSLayoutAttributeLeft, NSLayoutAttributeBottom, NSLayoutAttributeRight
163 | */
164 | - (void)setInsets:(MASEdgeInsets)insets;
165 |
166 | /**
167 | * Modifies the NSLayoutConstraint constant,
168 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
169 | * NSLayoutAttributeWidth, NSLayoutAttributeHeight
170 | */
171 | - (void)setSizeOffset:(CGSize)sizeOffset;
172 |
173 | /**
174 | * Modifies the NSLayoutConstraint constant,
175 | * only affects MASConstraints in which the first item's NSLayoutAttribute is one of the following
176 | * NSLayoutAttributeCenterX, NSLayoutAttributeCenterY
177 | */
178 | - (void)setCenterOffset:(CGPoint)centerOffset;
179 |
180 | /**
181 | * Modifies the NSLayoutConstraint constant
182 | */
183 | - (void)setOffset:(CGFloat)offset;
184 |
185 |
186 | // NSLayoutConstraint Installation support
187 |
188 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
189 | /**
190 | * Whether or not to go through the animator proxy when modifying the constraint
191 | */
192 | @property (nonatomic, copy, readonly) MASConstraint *animator;
193 | #endif
194 |
195 | /**
196 | * Activates an NSLayoutConstraint if it's supported by an OS.
197 | * Invokes install otherwise.
198 | */
199 | - (void)activate;
200 |
201 | /**
202 | * Deactivates previously installed/activated NSLayoutConstraint.
203 | */
204 | - (void)deactivate;
205 |
206 | /**
207 | * Creates a NSLayoutConstraint and adds it to the appropriate view.
208 | */
209 | - (void)install;
210 |
211 | /**
212 | * Removes previously installed NSLayoutConstraint
213 | */
214 | - (void)uninstall;
215 |
216 | @end
217 |
218 |
219 | /**
220 | * Convenience auto-boxing macros for MASConstraint methods.
221 | *
222 | * Defining MAS_SHORTHAND_GLOBALS will turn on auto-boxing for default syntax.
223 | * A potential drawback of this is that the unprefixed macros will appear in global scope.
224 | */
225 | #define mas_equalTo(...) equalTo(MASBoxValue((__VA_ARGS__)))
226 | #define mas_greaterThanOrEqualTo(...) greaterThanOrEqualTo(MASBoxValue((__VA_ARGS__)))
227 | #define mas_lessThanOrEqualTo(...) lessThanOrEqualTo(MASBoxValue((__VA_ARGS__)))
228 |
229 | #define mas_offset(...) valueOffset(MASBoxValue((__VA_ARGS__)))
230 |
231 |
232 | #ifdef MAS_SHORTHAND_GLOBALS
233 |
234 | #define equalTo(...) mas_equalTo(__VA_ARGS__)
235 | #define greaterThanOrEqualTo(...) mas_greaterThanOrEqualTo(__VA_ARGS__)
236 | #define lessThanOrEqualTo(...) mas_lessThanOrEqualTo(__VA_ARGS__)
237 |
238 | #define offset(...) mas_offset(__VA_ARGS__)
239 |
240 | #endif
241 |
242 |
243 | @interface MASConstraint (AutoboxingSupport)
244 |
245 | /**
246 | * Aliases to corresponding relation methods (for shorthand macros)
247 | * Also needed to aid autocompletion
248 | */
249 | - (MASConstraint * (^)(id attr))mas_equalTo;
250 | - (MASConstraint * (^)(id attr))mas_greaterThanOrEqualTo;
251 | - (MASConstraint * (^)(id attr))mas_lessThanOrEqualTo;
252 |
253 | /**
254 | * A dummy method to aid autocompletion
255 | */
256 | - (MASConstraint * (^)(id offset))mas_offset;
257 |
258 | @end
259 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/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 * (^)())priorityLow {
66 | return ^id{
67 | self.priority(MASLayoutPriorityDefaultLow);
68 | return self;
69 | };
70 | }
71 |
72 | - (MASConstraint * (^)())priorityMedium {
73 | return ^id{
74 | self.priority(MASLayoutPriorityDefaultMedium);
75 | return self;
76 | };
77 | }
78 |
79 | - (MASConstraint * (^)())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 * (^)(CGSize))sizeOffset {
96 | return ^id(CGSize offset) {
97 | self.sizeOffset = offset;
98 | return self;
99 | };
100 | }
101 |
102 | - (MASConstraint * (^)(CGPoint))centerOffset {
103 | return ^id(CGPoint offset) {
104 | self.centerOffset = offset;
105 | return self;
106 | };
107 | }
108 |
109 | - (MASConstraint * (^)(CGFloat))offset {
110 | return ^id(CGFloat offset){
111 | self.offset = offset;
112 | return self;
113 | };
114 | }
115 |
116 | - (MASConstraint * (^)(NSValue *value))valueOffset {
117 | return ^id(NSValue *offset) {
118 | NSAssert([offset isKindOfClass:NSValue.class], @"expected an NSValue offset, got: %@", offset);
119 | [self setLayoutConstantWithValue:offset];
120 | return self;
121 | };
122 | }
123 |
124 | - (MASConstraint * (^)(id offset))mas_offset {
125 | // Will never be called due to macro
126 | return nil;
127 | }
128 |
129 | #pragma mark - NSLayoutConstraint constant setter
130 |
131 | - (void)setLayoutConstantWithValue:(NSValue *)value {
132 | if ([value isKindOfClass:NSNumber.class]) {
133 | self.offset = [(NSNumber *)value doubleValue];
134 | } else if (strcmp(value.objCType, @encode(CGPoint)) == 0) {
135 | CGPoint point;
136 | [value getValue:&point];
137 | self.centerOffset = point;
138 | } else if (strcmp(value.objCType, @encode(CGSize)) == 0) {
139 | CGSize size;
140 | [value getValue:&size];
141 | self.sizeOffset = size;
142 | } else if (strcmp(value.objCType, @encode(MASEdgeInsets)) == 0) {
143 | MASEdgeInsets insets;
144 | [value getValue:&insets];
145 | self.insets = insets;
146 | } else {
147 | NSAssert(NO, @"attempting to set layout constant with unsupported value: %@", value);
148 | }
149 | }
150 |
151 | #pragma mark - Semantic properties
152 |
153 | - (MASConstraint *)with {
154 | return self;
155 | }
156 |
157 | - (MASConstraint *)and {
158 | return self;
159 | }
160 |
161 | #pragma mark - Chaining
162 |
163 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute __unused)layoutAttribute {
164 | MASMethodNotImplemented();
165 | }
166 |
167 | - (MASConstraint *)left {
168 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeft];
169 | }
170 |
171 | - (MASConstraint *)top {
172 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTop];
173 | }
174 |
175 | - (MASConstraint *)right {
176 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRight];
177 | }
178 |
179 | - (MASConstraint *)bottom {
180 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottom];
181 | }
182 |
183 | - (MASConstraint *)leading {
184 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeading];
185 | }
186 |
187 | - (MASConstraint *)trailing {
188 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailing];
189 | }
190 |
191 | - (MASConstraint *)width {
192 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeWidth];
193 | }
194 |
195 | - (MASConstraint *)height {
196 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeHeight];
197 | }
198 |
199 | - (MASConstraint *)centerX {
200 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterX];
201 | }
202 |
203 | - (MASConstraint *)centerY {
204 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterY];
205 | }
206 |
207 | - (MASConstraint *)baseline {
208 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBaseline];
209 | }
210 |
211 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
212 |
213 | - (MASConstraint *)firstBaseline {
214 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeFirstBaseline];
215 | }
216 | - (MASConstraint *)lastBaseline {
217 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLastBaseline];
218 | }
219 |
220 | #endif
221 |
222 | #if TARGET_OS_IPHONE || TARGET_OS_TV
223 |
224 | - (MASConstraint *)leftMargin {
225 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeftMargin];
226 | }
227 |
228 | - (MASConstraint *)rightMargin {
229 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRightMargin];
230 | }
231 |
232 | - (MASConstraint *)topMargin {
233 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTopMargin];
234 | }
235 |
236 | - (MASConstraint *)bottomMargin {
237 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottomMargin];
238 | }
239 |
240 | - (MASConstraint *)leadingMargin {
241 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeadingMargin];
242 | }
243 |
244 | - (MASConstraint *)trailingMargin {
245 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailingMargin];
246 | }
247 |
248 | - (MASConstraint *)centerXWithinMargins {
249 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterXWithinMargins];
250 | }
251 |
252 | - (MASConstraint *)centerYWithinMargins {
253 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterYWithinMargins];
254 | }
255 |
256 | #endif
257 |
258 | #pragma mark - Abstract
259 |
260 | - (MASConstraint * (^)(CGFloat multiplier))multipliedBy { MASMethodNotImplemented(); }
261 |
262 | - (MASConstraint * (^)(CGFloat divider))dividedBy { MASMethodNotImplemented(); }
263 |
264 | - (MASConstraint * (^)(MASLayoutPriority priority))priority { MASMethodNotImplemented(); }
265 |
266 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { MASMethodNotImplemented(); }
267 |
268 | - (MASConstraint * (^)(id key))key { MASMethodNotImplemented(); }
269 |
270 | - (void)setInsets:(MASEdgeInsets __unused)insets { MASMethodNotImplemented(); }
271 |
272 | - (void)setSizeOffset:(CGSize __unused)sizeOffset { MASMethodNotImplemented(); }
273 |
274 | - (void)setCenterOffset:(CGPoint __unused)centerOffset { MASMethodNotImplemented(); }
275 |
276 | - (void)setOffset:(CGFloat __unused)offset { MASMethodNotImplemented(); }
277 |
278 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
279 |
280 | - (MASConstraint *)animator { MASMethodNotImplemented(); }
281 |
282 | #endif
283 |
284 | - (void)activate { MASMethodNotImplemented(); }
285 |
286 | - (void)deactivate { MASMethodNotImplemented(); }
287 |
288 | - (void)install { MASMethodNotImplemented(); }
289 |
290 | - (void)uninstall { MASMethodNotImplemented(); }
291 |
292 | @end
293 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Masonry/MASConstraintMaker.m:
--------------------------------------------------------------------------------
1 | //
2 | // MASConstraintBuilder.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 "MASConstraintMaker.h"
10 | #import "MASViewConstraint.h"
11 | #import "MASCompositeConstraint.h"
12 | #import "MASConstraint+Private.h"
13 | #import "MASViewAttribute.h"
14 | #import "View+MASAdditions.h"
15 |
16 | @interface MASConstraintMaker ()
17 |
18 | @property (nonatomic, weak) MAS_VIEW *view;
19 | @property (nonatomic, strong) NSMutableArray *constraints;
20 |
21 | @end
22 |
23 | @implementation MASConstraintMaker
24 |
25 | - (id)initWithView:(MAS_VIEW *)view {
26 | self = [super init];
27 | if (!self) return nil;
28 |
29 | self.view = view;
30 | self.constraints = NSMutableArray.new;
31 |
32 | return self;
33 | }
34 |
35 | - (NSArray *)install {
36 | if (self.removeExisting) {
37 | NSArray *installedConstraints = [MASViewConstraint installedConstraintsForView:self.view];
38 | for (MASConstraint *constraint in installedConstraints) {
39 | [constraint uninstall];
40 | }
41 | }
42 | NSArray *constraints = self.constraints.copy;
43 | for (MASConstraint *constraint in constraints) {
44 | constraint.updateExisting = self.updateExisting;
45 | [constraint install];
46 | }
47 | [self.constraints removeAllObjects];
48 | return constraints;
49 | }
50 |
51 | #pragma mark - MASConstraintDelegate
52 |
53 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint {
54 | NSUInteger index = [self.constraints indexOfObject:constraint];
55 | NSAssert(index != NSNotFound, @"Could not find constraint %@", constraint);
56 | [self.constraints replaceObjectAtIndex:index withObject:replacementConstraint];
57 | }
58 |
59 | - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
60 | MASViewAttribute *viewAttribute = [[MASViewAttribute alloc] initWithView:self.view layoutAttribute:layoutAttribute];
61 | MASViewConstraint *newConstraint = [[MASViewConstraint alloc] initWithFirstViewAttribute:viewAttribute];
62 | if ([constraint isKindOfClass:MASViewConstraint.class]) {
63 | //replace with composite constraint
64 | NSArray *children = @[constraint, newConstraint];
65 | MASCompositeConstraint *compositeConstraint = [[MASCompositeConstraint alloc] initWithChildren:children];
66 | compositeConstraint.delegate = self;
67 | [self constraint:constraint shouldBeReplacedWithConstraint:compositeConstraint];
68 | return compositeConstraint;
69 | }
70 | if (!constraint) {
71 | newConstraint.delegate = self;
72 | [self.constraints addObject:newConstraint];
73 | }
74 | return newConstraint;
75 | }
76 |
77 | - (MASConstraint *)addConstraintWithAttributes:(MASAttribute)attrs {
78 | __unused MASAttribute anyAttribute = (MASAttributeLeft | MASAttributeRight | MASAttributeTop | MASAttributeBottom | MASAttributeLeading
79 | | MASAttributeTrailing | MASAttributeWidth | MASAttributeHeight | MASAttributeCenterX
80 | | MASAttributeCenterY | MASAttributeBaseline
81 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
82 | | MASAttributeFirstBaseline | MASAttributeLastBaseline
83 | #endif
84 | #if TARGET_OS_IPHONE || TARGET_OS_TV
85 | | MASAttributeLeftMargin | MASAttributeRightMargin | MASAttributeTopMargin | MASAttributeBottomMargin
86 | | MASAttributeLeadingMargin | MASAttributeTrailingMargin | MASAttributeCenterXWithinMargins
87 | | MASAttributeCenterYWithinMargins
88 | #endif
89 | );
90 |
91 | NSAssert((attrs & anyAttribute) != 0, @"You didn't pass any attribute to make.attributes(...)");
92 |
93 | NSMutableArray *attributes = [NSMutableArray array];
94 |
95 | if (attrs & MASAttributeLeft) [attributes addObject:self.view.mas_left];
96 | if (attrs & MASAttributeRight) [attributes addObject:self.view.mas_right];
97 | if (attrs & MASAttributeTop) [attributes addObject:self.view.mas_top];
98 | if (attrs & MASAttributeBottom) [attributes addObject:self.view.mas_bottom];
99 | if (attrs & MASAttributeLeading) [attributes addObject:self.view.mas_leading];
100 | if (attrs & MASAttributeTrailing) [attributes addObject:self.view.mas_trailing];
101 | if (attrs & MASAttributeWidth) [attributes addObject:self.view.mas_width];
102 | if (attrs & MASAttributeHeight) [attributes addObject:self.view.mas_height];
103 | if (attrs & MASAttributeCenterX) [attributes addObject:self.view.mas_centerX];
104 | if (attrs & MASAttributeCenterY) [attributes addObject:self.view.mas_centerY];
105 | if (attrs & MASAttributeBaseline) [attributes addObject:self.view.mas_baseline];
106 |
107 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
108 |
109 | if (attrs & MASAttributeFirstBaseline) [attributes addObject:self.view.mas_firstBaseline];
110 | if (attrs & MASAttributeLastBaseline) [attributes addObject:self.view.mas_lastBaseline];
111 |
112 | #endif
113 |
114 | #if TARGET_OS_IPHONE || TARGET_OS_TV
115 |
116 | if (attrs & MASAttributeLeftMargin) [attributes addObject:self.view.mas_leftMargin];
117 | if (attrs & MASAttributeRightMargin) [attributes addObject:self.view.mas_rightMargin];
118 | if (attrs & MASAttributeTopMargin) [attributes addObject:self.view.mas_topMargin];
119 | if (attrs & MASAttributeBottomMargin) [attributes addObject:self.view.mas_bottomMargin];
120 | if (attrs & MASAttributeLeadingMargin) [attributes addObject:self.view.mas_leadingMargin];
121 | if (attrs & MASAttributeTrailingMargin) [attributes addObject:self.view.mas_trailingMargin];
122 | if (attrs & MASAttributeCenterXWithinMargins) [attributes addObject:self.view.mas_centerXWithinMargins];
123 | if (attrs & MASAttributeCenterYWithinMargins) [attributes addObject:self.view.mas_centerYWithinMargins];
124 |
125 | #endif
126 |
127 | NSMutableArray *children = [NSMutableArray arrayWithCapacity:attributes.count];
128 |
129 | for (MASViewAttribute *a in attributes) {
130 | [children addObject:[[MASViewConstraint alloc] initWithFirstViewAttribute:a]];
131 | }
132 |
133 | MASCompositeConstraint *constraint = [[MASCompositeConstraint alloc] initWithChildren:children];
134 | constraint.delegate = self;
135 | [self.constraints addObject:constraint];
136 | return constraint;
137 | }
138 |
139 | #pragma mark - standard Attributes
140 |
141 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
142 | return [self constraint:nil addConstraintWithLayoutAttribute:layoutAttribute];
143 | }
144 |
145 | - (MASConstraint *)left {
146 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeft];
147 | }
148 |
149 | - (MASConstraint *)top {
150 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTop];
151 | }
152 |
153 | - (MASConstraint *)right {
154 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRight];
155 | }
156 |
157 | - (MASConstraint *)bottom {
158 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottom];
159 | }
160 |
161 | - (MASConstraint *)leading {
162 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeading];
163 | }
164 |
165 | - (MASConstraint *)trailing {
166 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailing];
167 | }
168 |
169 | - (MASConstraint *)width {
170 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeWidth];
171 | }
172 |
173 | - (MASConstraint *)height {
174 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeHeight];
175 | }
176 |
177 | - (MASConstraint *)centerX {
178 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterX];
179 | }
180 |
181 | - (MASConstraint *)centerY {
182 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterY];
183 | }
184 |
185 | - (MASConstraint *)baseline {
186 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBaseline];
187 | }
188 |
189 | - (MASConstraint *(^)(MASAttribute))attributes {
190 | return ^(MASAttribute attrs){
191 | return [self addConstraintWithAttributes:attrs];
192 | };
193 | }
194 |
195 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
196 |
197 | - (MASConstraint *)firstBaseline {
198 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeFirstBaseline];
199 | }
200 |
201 | - (MASConstraint *)lastBaseline {
202 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLastBaseline];
203 | }
204 |
205 | #endif
206 |
207 |
208 | #if TARGET_OS_IPHONE || TARGET_OS_TV
209 |
210 | - (MASConstraint *)leftMargin {
211 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeftMargin];
212 | }
213 |
214 | - (MASConstraint *)rightMargin {
215 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeRightMargin];
216 | }
217 |
218 | - (MASConstraint *)topMargin {
219 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTopMargin];
220 | }
221 |
222 | - (MASConstraint *)bottomMargin {
223 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeBottomMargin];
224 | }
225 |
226 | - (MASConstraint *)leadingMargin {
227 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeLeadingMargin];
228 | }
229 |
230 | - (MASConstraint *)trailingMargin {
231 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeTrailingMargin];
232 | }
233 |
234 | - (MASConstraint *)centerXWithinMargins {
235 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterXWithinMargins];
236 | }
237 |
238 | - (MASConstraint *)centerYWithinMargins {
239 | return [self addConstraintWithLayoutAttribute:NSLayoutAttributeCenterYWithinMargins];
240 | }
241 |
242 | #endif
243 |
244 |
245 | #pragma mark - composite Attributes
246 |
247 | - (MASConstraint *)edges {
248 | return [self addConstraintWithAttributes:MASAttributeTop | MASAttributeLeft | MASAttributeRight | MASAttributeBottom];
249 | }
250 |
251 | - (MASConstraint *)size {
252 | return [self addConstraintWithAttributes:MASAttributeWidth | MASAttributeHeight];
253 | }
254 |
255 | - (MASConstraint *)center {
256 | return [self addConstraintWithAttributes:MASAttributeCenterX | MASAttributeCenterY];
257 | }
258 |
259 | #pragma mark - grouping
260 |
261 | - (MASConstraint *(^)(dispatch_block_t group))group {
262 | return ^id(dispatch_block_t group) {
263 | NSInteger previousCount = self.constraints.count;
264 | group();
265 |
266 | NSArray *children = [self.constraints subarrayWithRange:NSMakeRange(previousCount, self.constraints.count - previousCount)];
267 | MASCompositeConstraint *constraint = [[MASCompositeConstraint alloc] initWithChildren:children];
268 | constraint.delegate = self;
269 | return constraint;
270 | };
271 | }
272 |
273 | @end
274 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/KylinMainViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KylinMainViewController.m
3 | // TableViewsInTableView
4 | //
5 | // Created by Kylin on 16/7/8.
6 | // Copyright © 2016年 Kylin. All rights reserved.
7 | // 主按制器
8 |
9 | #import "KylinMainViewController.h"
10 | #import "KylinScrollView.h"
11 | #import "Masonry.h"
12 | #import "UIView+Kylin.h"
13 | #import "KylinOneViewController.h"
14 | #import "KylinTwoViewController.h"
15 | #import "KylinThreeViewController.h"
16 | #import "KylinFourViewController.h"
17 |
18 | @interface KylinMainViewController ()
19 | /**标题数组*/
20 | @property(nonatomic,strong)NSArray *titleArray;
21 |
22 | /**头部视图*/
23 | @property(nonatomic,weak)UIView *headerView;
24 |
25 | /**标题view*/
26 | @property(nonatomic,weak)UIScrollView *titleView;
27 |
28 | /**内容的view*/
29 | @property(nonatomic,weak)KylinScrollView *contentView;
30 |
31 | /**选中的按钮*/
32 | @property(nonatomic,strong)UIButton *currentSelectedBtn;
33 | /**下划线*/
34 | @property(nonatomic,weak)UIView *selectedUnderLine;
35 |
36 | /**one*/
37 | @property(nonatomic,weak)KylinOneViewController *oneVc;
38 | /**two*/
39 | @property(nonatomic,weak)KylinTwoViewController *twoVc;
40 | /**three*/
41 | @property(nonatomic,weak)KylinThreeViewController *threeVc;
42 | /**four*/
43 | @property(nonatomic,weak)KylinFourViewController *fourVc;
44 |
45 | @end
46 | //屏幕宽度
47 | #define kScreenW [UIScreen mainScreen].bounds.size.width
48 |
49 | //屏幕高度
50 | #define kScreenH [UIScreen mainScreen].bounds.size.height
51 |
52 | static CGFloat const NavH = 64;
53 | static CGFloat const HeaderH = 150;
54 | static CGFloat const TitleViewH = 50;
55 | static CGFloat const UnderLineH = 3;
56 | static CGFloat const OffsetY = -200;
57 | @implementation KylinMainViewController
58 |
59 | #pragma mark- 懒加载属性
60 | - (NSArray *)titleArray{
61 | if (!_titleArray) {
62 | _titleArray = @[@"科技",@"热点",@"娱乐",@"体育"];
63 | }
64 | return _titleArray;
65 | }
66 | #pragma mark- viewDidLoad 初始化方法
67 | - (void)viewDidLoad {
68 | [super viewDidLoad];
69 |
70 | self.automaticallyAdjustsScrollViewInsets = NO;
71 | self.navigationItem.title = @"TINT";
72 | self.view.backgroundColor = [UIColor whiteColor];
73 | // 添加子控制器
74 | [self setupChildViewController];
75 | // 布局子控制排列样式
76 | [self setupChildViews];
77 |
78 | // 添加标题栏内容
79 | [self setupTitleView];
80 |
81 | [self addChildViewInContentView:0];
82 |
83 | // 添加标题栏下划线
84 | [self setupUnderLine];
85 |
86 | }
87 |
88 |
89 | // 添加子控件
90 | - (void)setupChildViews{
91 |
92 | // 头部视图
93 | UIView *headerView = [[UIView alloc]init];
94 | _headerView = headerView;
95 | UIImageView *imageView = [[UIImageView alloc]init];
96 | imageView.contentMode = UIViewContentModeScaleAspectFill;
97 | imageView.image = [UIImage imageNamed:@"bueaty2.jpg"];
98 | headerView.clipsToBounds = YES;
99 | [headerView addSubview:imageView];
100 |
101 | // 标题栏
102 | UIScrollView *titleView =[[UIScrollView alloc]init];
103 | _titleView = titleView;
104 |
105 | // 内容的view
106 | KylinScrollView *contentView = [[KylinScrollView alloc]init];
107 | _contentView = contentView;
108 | contentView.pagingEnabled = YES;
109 | contentView.bounces = NO;
110 | contentView.delegate = self;
111 | contentView.contentSize = CGSizeMake(self.titleArray.count * kScreenW , 0);
112 |
113 | [self.view addSubview:contentView];
114 | [self.view addSubview:titleView];
115 | [self.view addSubview:headerView];
116 |
117 | [headerView mas_makeConstraints:^(MASConstraintMaker *make) {
118 | make.top.equalTo(self.view).offset(NavH);
119 | make.left.right.equalTo(self.view);
120 | make.height.equalTo(@(HeaderH));
121 | }];
122 |
123 | [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
124 | make.edges.equalTo(headerView);
125 | }];
126 |
127 |
128 | [titleView mas_makeConstraints:^(MASConstraintMaker *make) {
129 | make.top.equalTo(headerView.mas_bottom);
130 | make.left.right.equalTo(self.view);
131 | make.height.equalTo(@(TitleViewH));
132 | }];
133 |
134 |
135 | [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
136 | make.top.equalTo(titleView.mas_bottom);
137 | make.width.equalTo(@(kScreenW));
138 | make.left.right.equalTo(self.view);
139 | make.height.equalTo(@(kScreenH - NavH));
140 | }];
141 |
142 |
143 | }
144 |
145 |
146 | // 添加标题view的按钮
147 | - (void)setupTitleView{
148 | NSInteger count = self.titleArray.count;
149 | for (NSInteger i = 0; i < count; i ++) {
150 | UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
151 | btn.titleLabel.font = [UIFont systemFontOfSize:15];
152 | [btn setTitle:_titleArray[i] forState:UIControlStateNormal];
153 | [btn setTitle:_titleArray[i] forState:UIControlStateSelected];
154 | [btn setTitleColor:[UIColor colorWithRed:83/255.0 green:211/255.0 blue:254/255.0 alpha:1.0] forState:UIControlStateSelected];
155 | [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
156 | [btn addTarget:self action:@selector(titleBtnClick:) forControlEvents:UIControlEventTouchUpInside];
157 |
158 | CGFloat btnW = kScreenW / _titleArray.count;
159 | CGFloat btnH = TitleViewH;
160 | CGFloat btnX = i * btnW;
161 | CGFloat btnY = 0;
162 | btn.tag = i;
163 | btn.frame = CGRectMake(btnX, btnY, btnW, btnH - UnderLineH);
164 |
165 | [self.titleView addSubview:btn];
166 |
167 | if (i == 0) {
168 | [self titleBtnClick:btn];
169 | }
170 | }
171 |
172 | }
173 |
174 |
175 | // 添加下划线
176 | - (void)setupUnderLine{
177 | UIButton *selectButton = [UIButton buttonWithType:UIButtonTypeCustom];
178 | selectButton = self.titleView.subviews.firstObject;
179 | UIView *underline = [[UIView alloc] init];
180 | CGFloat underlineH = 3;
181 | CGFloat underlineW = kScreenW / [self titleArray].count;
182 | CGFloat underlineX = 0;
183 | CGFloat underlineY = TitleViewH - UnderLineH;
184 | underline.frame = CGRectMake(underlineX, underlineY, underlineW, underlineH);
185 | //设置下划线的颜色,根随按钮选中的颜色一致
186 | underline.backgroundColor = [selectButton titleColorForState:UIControlStateSelected];
187 | [self.titleView addSubview:underline];
188 | self.selectedUnderLine = underline;
189 |
190 | [selectButton.titleLabel sizeToFit];
191 | selectButton.selected = YES;
192 | self.currentSelectedBtn = selectButton;
193 |
194 | self.selectedUnderLine.KWidth = selectButton.titleLabel.KWidth + 10;
195 | self.selectedUnderLine.KCenterX = selectButton.KCenterX;
196 |
197 | }
198 |
199 | // 添加子控制器
200 | - (void)setupChildViewController{
201 |
202 | KylinOneViewController *oneVc = [[KylinOneViewController alloc]init];
203 | _oneVc = oneVc;
204 | oneVc.delegate = self;
205 | [self addChildViewController:oneVc];
206 |
207 | KylinTwoViewController *twoVc = [[KylinTwoViewController alloc]init];
208 | _twoVc = twoVc;
209 | twoVc.delegate = self;
210 | [self addChildViewController:twoVc];
211 |
212 | KylinThreeViewController *threeVc = [[KylinThreeViewController alloc]init];
213 | _threeVc = threeVc;
214 | threeVc.delegate = self;
215 | [self addChildViewController:threeVc];
216 |
217 | KylinFourViewController *fourVc = [[KylinFourViewController alloc]init];
218 | _fourVc = fourVc;
219 | fourVc.delegate = self;
220 | [self addChildViewController:fourVc];
221 | }
222 |
223 | // 添加相应的控制器的view到内容视图中
224 | - (void)addChildViewInContentView:(NSInteger)index{
225 |
226 | UIViewController *childView = self.childViewControllers[index];
227 | [self.contentView addSubview:childView.view];
228 | childView.view.frame = CGRectMake(index * kScreenW, OffsetY, kScreenW, kScreenH + 85);
229 |
230 | // 取出要跳转的view
231 | KylinTwoViewController *twovc = (KylinTwoViewController *)childView;
232 |
233 | // 跳转时滚动到当前view 的offsetY位置
234 | [self KylinScrollToChangeHeaderViewHeight:twovc.tableView.contentOffset.y];
235 | // NSLog(@"第二个控制制 OFFSETY ----//%f",twovc.tableView.contentOffset.y);
236 | }
237 | #pragma mark- 点击事件
238 | - (void)titleBtnClick:(UIButton *)button{
239 |
240 | self.currentSelectedBtn.selected = NO;
241 | button.selected = YES;
242 | self.currentSelectedBtn = button;
243 |
244 | NSInteger index = button.tag;
245 |
246 | [UIView animateWithDuration:0.25 animations:^{
247 | self.selectedUnderLine.KWidth = button.titleLabel.KWidth + 10;
248 | self.selectedUnderLine.KCenterX = button.KCenterX;
249 | }completion:nil];
250 |
251 | self.contentView.contentOffset = CGPointMake(index * kScreenW, 0);
252 |
253 | [self addChildViewInContentView:index];
254 |
255 | _oneVc.tableView.scrollEnabled = YES;
256 | _twoVc.tableView.scrollEnabled = YES;
257 | _threeVc.tableView.scrollEnabled = YES;
258 | _fourVc.tableView.scrollEnabled = YES;
259 |
260 | }
261 |
262 | #pragma mark- TableViewScrollDelegate
263 | /**
264 | * 通过代理接收每个子控制器的滚动Y值
265 | *
266 | * @param scrollY 滚动了多少Y值
267 | */
268 | - (void)KylinOneViewTableViewDidScroll:(CGFloat)scrollY{
269 | [self KylinScrollToChangeHeaderViewHeight:scrollY];
270 | }
271 |
272 | - (void)KylinTwoViewTableViewDidScroll:(CGFloat)scrollY{
273 | [self KylinScrollToChangeHeaderViewHeight:scrollY];
274 |
275 | }
276 | - (void)KylinThreeViewTableViewDidScroll:(CGFloat)scrollY{
277 | [self KylinScrollToChangeHeaderViewHeight:scrollY];
278 |
279 | }
280 | - (void)KylinFourViewTableViewDidScroll:(CGFloat)scrollY{
281 | [self KylinScrollToChangeHeaderViewHeight:scrollY];
282 |
283 | }
284 |
285 | // 动态计算滚动的Y值
286 | - (void)KylinScrollToChangeHeaderViewHeight:(CGFloat)scrollY{
287 | // NSLog(@"%f",scrollY);
288 |
289 | CGFloat offsetY = scrollY - OffsetY;
290 | CGFloat height = HeaderH - offsetY;
291 |
292 | if (height > HeaderH) {
293 | height = HeaderH;
294 | }
295 |
296 | if (height < 0) {
297 | height = 0;
298 | }
299 |
300 | [self.headerView mas_updateConstraints:^(MASConstraintMaker *make) {
301 | make.top.equalTo(self.view).offset(NavH);
302 | make.left.right.equalTo(self.view);
303 | make.height.equalTo(@(height));
304 | }];
305 |
306 | [self.titleView mas_updateConstraints:^(MASConstraintMaker *make) {
307 | make.top.equalTo(_headerView.mas_bottom);
308 | make.left.right.equalTo(self.view);
309 | make.height.equalTo(@(TitleViewH));
310 | }];
311 |
312 | }
313 | #pragma mark- ScrollViewDelegate
314 |
315 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
316 |
317 | if (scrollView == self.contentView) {
318 | _oneVc.tableView.scrollEnabled = NO;
319 | _twoVc.tableView.scrollEnabled = NO;
320 | _threeVc.tableView.scrollEnabled = NO;
321 | _fourVc.tableView.scrollEnabled = NO;
322 |
323 | }
324 |
325 | }
326 | // 滚动切换控制器
327 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
328 | if (scrollView == self.contentView) {
329 | _oneVc.tableView.scrollEnabled = YES;
330 | _twoVc.tableView.scrollEnabled = YES;
331 | _threeVc.tableView.scrollEnabled = YES;
332 | _fourVc.tableView.scrollEnabled = YES;
333 |
334 | }
335 | NSInteger index = scrollView.contentOffset.x / kScreenW;
336 |
337 | NSMutableArray *buttonArray = [NSMutableArray array];
338 |
339 | for (NSInteger i = 0; i < self.titleView.subviews.count; i ++) {
340 | UIView *button = self.titleView.subviews[i];
341 |
342 | if (button.class == [UIButton buttonWithType:UIButtonTypeCustom].class) {
343 | [buttonArray addObject:button];
344 | }
345 | }
346 |
347 | UIButton *button = buttonArray[index];
348 |
349 | [self titleBtnClick:button];
350 |
351 | }
352 | @end
353 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView/Masonry/MASViewConstraint.m:
--------------------------------------------------------------------------------
1 | //
2 | // MASConstraint.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 "MASViewConstraint.h"
10 | #import "MASConstraint+Private.h"
11 | #import "MASCompositeConstraint.h"
12 | #import "MASLayoutConstraint.h"
13 | #import "View+MASAdditions.h"
14 | #import
15 |
16 | @interface MAS_VIEW (MASConstraints)
17 |
18 | @property (nonatomic, readonly) NSMutableSet *mas_installedConstraints;
19 |
20 | @end
21 |
22 | @implementation MAS_VIEW (MASConstraints)
23 |
24 | static char kInstalledConstraintsKey;
25 |
26 | - (NSMutableSet *)mas_installedConstraints {
27 | NSMutableSet *constraints = objc_getAssociatedObject(self, &kInstalledConstraintsKey);
28 | if (!constraints) {
29 | constraints = [NSMutableSet set];
30 | objc_setAssociatedObject(self, &kInstalledConstraintsKey, constraints, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
31 | }
32 | return constraints;
33 | }
34 |
35 | @end
36 |
37 |
38 | @interface MASViewConstraint ()
39 |
40 | @property (nonatomic, strong, readwrite) MASViewAttribute *secondViewAttribute;
41 | @property (nonatomic, weak) MAS_VIEW *installedView;
42 | @property (nonatomic, weak) MASLayoutConstraint *layoutConstraint;
43 | @property (nonatomic, assign) NSLayoutRelation layoutRelation;
44 | @property (nonatomic, assign) MASLayoutPriority layoutPriority;
45 | @property (nonatomic, assign) CGFloat layoutMultiplier;
46 | @property (nonatomic, assign) CGFloat layoutConstant;
47 | @property (nonatomic, assign) BOOL hasLayoutRelation;
48 | @property (nonatomic, strong) id mas_key;
49 | @property (nonatomic, assign) BOOL useAnimator;
50 |
51 | @end
52 |
53 | @implementation MASViewConstraint
54 |
55 | - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute {
56 | self = [super init];
57 | if (!self) return nil;
58 |
59 | _firstViewAttribute = firstViewAttribute;
60 | self.layoutPriority = MASLayoutPriorityRequired;
61 | self.layoutMultiplier = 1;
62 |
63 | return self;
64 | }
65 |
66 | #pragma mark - NSCoping
67 |
68 | - (id)copyWithZone:(NSZone __unused *)zone {
69 | MASViewConstraint *constraint = [[MASViewConstraint alloc] initWithFirstViewAttribute:self.firstViewAttribute];
70 | constraint.layoutConstant = self.layoutConstant;
71 | constraint.layoutRelation = self.layoutRelation;
72 | constraint.layoutPriority = self.layoutPriority;
73 | constraint.layoutMultiplier = self.layoutMultiplier;
74 | constraint.delegate = self.delegate;
75 | return constraint;
76 | }
77 |
78 | #pragma mark - Public
79 |
80 | + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view {
81 | return [view.mas_installedConstraints allObjects];
82 | }
83 |
84 | #pragma mark - Private
85 |
86 | - (void)setLayoutConstant:(CGFloat)layoutConstant {
87 | _layoutConstant = layoutConstant;
88 |
89 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
90 | if (self.useAnimator) {
91 | [self.layoutConstraint.animator setConstant:layoutConstant];
92 | } else {
93 | self.layoutConstraint.constant = layoutConstant;
94 | }
95 | #else
96 | self.layoutConstraint.constant = layoutConstant;
97 | #endif
98 | }
99 |
100 | - (void)setLayoutRelation:(NSLayoutRelation)layoutRelation {
101 | _layoutRelation = layoutRelation;
102 | self.hasLayoutRelation = YES;
103 | }
104 |
105 | - (BOOL)supportsActiveProperty {
106 | return [self.layoutConstraint respondsToSelector:@selector(isActive)];
107 | }
108 |
109 | - (BOOL)isActive {
110 | BOOL active = YES;
111 | if ([self supportsActiveProperty]) {
112 | active = [self.layoutConstraint isActive];
113 | }
114 |
115 | return active;
116 | }
117 |
118 | - (BOOL)hasBeenInstalled {
119 | return (self.layoutConstraint != nil) && [self isActive];
120 | }
121 |
122 | - (void)setSecondViewAttribute:(id)secondViewAttribute {
123 | if ([secondViewAttribute isKindOfClass:NSValue.class]) {
124 | [self setLayoutConstantWithValue:secondViewAttribute];
125 | } else if ([secondViewAttribute isKindOfClass:MAS_VIEW.class]) {
126 | _secondViewAttribute = [[MASViewAttribute alloc] initWithView:secondViewAttribute layoutAttribute:self.firstViewAttribute.layoutAttribute];
127 | } else if ([secondViewAttribute isKindOfClass:MASViewAttribute.class]) {
128 | _secondViewAttribute = secondViewAttribute;
129 | } else {
130 | NSAssert(NO, @"attempting to add unsupported attribute: %@", secondViewAttribute);
131 | }
132 | }
133 |
134 | #pragma mark - NSLayoutConstraint multiplier proxies
135 |
136 | - (MASConstraint * (^)(CGFloat))multipliedBy {
137 | return ^id(CGFloat multiplier) {
138 | NSAssert(!self.hasBeenInstalled,
139 | @"Cannot modify constraint multiplier after it has been installed");
140 |
141 | self.layoutMultiplier = multiplier;
142 | return self;
143 | };
144 | }
145 |
146 |
147 | - (MASConstraint * (^)(CGFloat))dividedBy {
148 | return ^id(CGFloat divider) {
149 | NSAssert(!self.hasBeenInstalled,
150 | @"Cannot modify constraint multiplier after it has been installed");
151 |
152 | self.layoutMultiplier = 1.0/divider;
153 | return self;
154 | };
155 | }
156 |
157 | #pragma mark - MASLayoutPriority proxy
158 |
159 | - (MASConstraint * (^)(MASLayoutPriority))priority {
160 | return ^id(MASLayoutPriority priority) {
161 | NSAssert(!self.hasBeenInstalled,
162 | @"Cannot modify constraint priority after it has been installed");
163 |
164 | self.layoutPriority = priority;
165 | return self;
166 | };
167 | }
168 |
169 | #pragma mark - NSLayoutRelation proxy
170 |
171 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation {
172 | return ^id(id attribute, NSLayoutRelation relation) {
173 | if ([attribute isKindOfClass:NSArray.class]) {
174 | NSAssert(!self.hasLayoutRelation, @"Redefinition of constraint relation");
175 | NSMutableArray *children = NSMutableArray.new;
176 | for (id attr in attribute) {
177 | MASViewConstraint *viewConstraint = [self copy];
178 | viewConstraint.secondViewAttribute = attr;
179 | [children addObject:viewConstraint];
180 | }
181 | MASCompositeConstraint *compositeConstraint = [[MASCompositeConstraint alloc] initWithChildren:children];
182 | compositeConstraint.delegate = self.delegate;
183 | [self.delegate constraint:self shouldBeReplacedWithConstraint:compositeConstraint];
184 | return compositeConstraint;
185 | } else {
186 | NSAssert(!self.hasLayoutRelation || self.layoutRelation == relation && [attribute isKindOfClass:NSValue.class], @"Redefinition of constraint relation");
187 | self.layoutRelation = relation;
188 | self.secondViewAttribute = attribute;
189 | return self;
190 | }
191 | };
192 | }
193 |
194 | #pragma mark - Semantic properties
195 |
196 | - (MASConstraint *)with {
197 | return self;
198 | }
199 |
200 | - (MASConstraint *)and {
201 | return self;
202 | }
203 |
204 | #pragma mark - attribute chaining
205 |
206 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
207 | NSAssert(!self.hasLayoutRelation, @"Attributes should be chained before defining the constraint relation");
208 |
209 | return [self.delegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute];
210 | }
211 |
212 | #pragma mark - Animator proxy
213 |
214 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV)
215 |
216 | - (MASConstraint *)animator {
217 | self.useAnimator = YES;
218 | return self;
219 | }
220 |
221 | #endif
222 |
223 | #pragma mark - debug helpers
224 |
225 | - (MASConstraint * (^)(id))key {
226 | return ^id(id key) {
227 | self.mas_key = key;
228 | return self;
229 | };
230 | }
231 |
232 | #pragma mark - NSLayoutConstraint constant setters
233 |
234 | - (void)setInsets:(MASEdgeInsets)insets {
235 | NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute;
236 | switch (layoutAttribute) {
237 | case NSLayoutAttributeLeft:
238 | case NSLayoutAttributeLeading:
239 | self.layoutConstant = insets.left;
240 | break;
241 | case NSLayoutAttributeTop:
242 | self.layoutConstant = insets.top;
243 | break;
244 | case NSLayoutAttributeBottom:
245 | self.layoutConstant = -insets.bottom;
246 | break;
247 | case NSLayoutAttributeRight:
248 | case NSLayoutAttributeTrailing:
249 | self.layoutConstant = -insets.right;
250 | break;
251 | default:
252 | break;
253 | }
254 | }
255 |
256 | - (void)setOffset:(CGFloat)offset {
257 | self.layoutConstant = offset;
258 | }
259 |
260 | - (void)setSizeOffset:(CGSize)sizeOffset {
261 | NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute;
262 | switch (layoutAttribute) {
263 | case NSLayoutAttributeWidth:
264 | self.layoutConstant = sizeOffset.width;
265 | break;
266 | case NSLayoutAttributeHeight:
267 | self.layoutConstant = sizeOffset.height;
268 | break;
269 | default:
270 | break;
271 | }
272 | }
273 |
274 | - (void)setCenterOffset:(CGPoint)centerOffset {
275 | NSLayoutAttribute layoutAttribute = self.firstViewAttribute.layoutAttribute;
276 | switch (layoutAttribute) {
277 | case NSLayoutAttributeCenterX:
278 | self.layoutConstant = centerOffset.x;
279 | break;
280 | case NSLayoutAttributeCenterY:
281 | self.layoutConstant = centerOffset.y;
282 | break;
283 | default:
284 | break;
285 | }
286 | }
287 |
288 | #pragma mark - MASConstraint
289 |
290 | - (void)activate {
291 | [self install];
292 | }
293 |
294 | - (void)deactivate {
295 | [self uninstall];
296 | }
297 |
298 | - (void)install {
299 | if (self.hasBeenInstalled) {
300 | return;
301 | }
302 |
303 | if ([self supportsActiveProperty] && self.layoutConstraint) {
304 | self.layoutConstraint.active = YES;
305 | [self.firstViewAttribute.view.mas_installedConstraints addObject:self];
306 | return;
307 | }
308 |
309 | MAS_VIEW *firstLayoutItem = self.firstViewAttribute.item;
310 | NSLayoutAttribute firstLayoutAttribute = self.firstViewAttribute.layoutAttribute;
311 | MAS_VIEW *secondLayoutItem = self.secondViewAttribute.item;
312 | NSLayoutAttribute secondLayoutAttribute = self.secondViewAttribute.layoutAttribute;
313 |
314 | // alignment attributes must have a secondViewAttribute
315 | // therefore we assume that is refering to superview
316 | // eg make.left.equalTo(@10)
317 | if (!self.firstViewAttribute.isSizeAttribute && !self.secondViewAttribute) {
318 | secondLayoutItem = self.firstViewAttribute.view.superview;
319 | secondLayoutAttribute = firstLayoutAttribute;
320 | }
321 |
322 | MASLayoutConstraint *layoutConstraint
323 | = [MASLayoutConstraint constraintWithItem:firstLayoutItem
324 | attribute:firstLayoutAttribute
325 | relatedBy:self.layoutRelation
326 | toItem:secondLayoutItem
327 | attribute:secondLayoutAttribute
328 | multiplier:self.layoutMultiplier
329 | constant:self.layoutConstant];
330 |
331 | layoutConstraint.priority = self.layoutPriority;
332 | layoutConstraint.mas_key = self.mas_key;
333 |
334 | if (self.secondViewAttribute.view) {
335 | MAS_VIEW *closestCommonSuperview = [self.firstViewAttribute.view mas_closestCommonSuperview:self.secondViewAttribute.view];
336 | NSAssert(closestCommonSuperview,
337 | @"couldn't find a common superview for %@ and %@",
338 | self.firstViewAttribute.view, self.secondViewAttribute.view);
339 | self.installedView = closestCommonSuperview;
340 | } else if (self.firstViewAttribute.isSizeAttribute) {
341 | self.installedView = self.firstViewAttribute.view;
342 | } else {
343 | self.installedView = self.firstViewAttribute.view.superview;
344 | }
345 |
346 |
347 | MASLayoutConstraint *existingConstraint = nil;
348 | if (self.updateExisting) {
349 | existingConstraint = [self layoutConstraintSimilarTo:layoutConstraint];
350 | }
351 | if (existingConstraint) {
352 | // just update the constant
353 | existingConstraint.constant = layoutConstraint.constant;
354 | self.layoutConstraint = existingConstraint;
355 | } else {
356 | [self.installedView addConstraint:layoutConstraint];
357 | self.layoutConstraint = layoutConstraint;
358 | [firstLayoutItem.mas_installedConstraints addObject:self];
359 | }
360 | }
361 |
362 | - (MASLayoutConstraint *)layoutConstraintSimilarTo:(MASLayoutConstraint *)layoutConstraint {
363 | // check if any constraints are the same apart from the only mutable property constant
364 |
365 | // go through constraints in reverse as we do not want to match auto-resizing or interface builder constraints
366 | // and they are likely to be added first.
367 | for (NSLayoutConstraint *existingConstraint in self.installedView.constraints.reverseObjectEnumerator) {
368 | if (![existingConstraint isKindOfClass:MASLayoutConstraint.class]) continue;
369 | if (existingConstraint.firstItem != layoutConstraint.firstItem) continue;
370 | if (existingConstraint.secondItem != layoutConstraint.secondItem) continue;
371 | if (existingConstraint.firstAttribute != layoutConstraint.firstAttribute) continue;
372 | if (existingConstraint.secondAttribute != layoutConstraint.secondAttribute) continue;
373 | if (existingConstraint.relation != layoutConstraint.relation) continue;
374 | if (existingConstraint.multiplier != layoutConstraint.multiplier) continue;
375 | if (existingConstraint.priority != layoutConstraint.priority) continue;
376 |
377 | return (id)existingConstraint;
378 | }
379 | return nil;
380 | }
381 |
382 | - (void)uninstall {
383 | if ([self supportsActiveProperty]) {
384 | self.layoutConstraint.active = NO;
385 | [self.firstViewAttribute.view.mas_installedConstraints removeObject:self];
386 | return;
387 | }
388 |
389 | [self.installedView removeConstraint:self.layoutConstraint];
390 | self.layoutConstraint = nil;
391 | self.installedView = nil;
392 |
393 | [self.firstViewAttribute.view.mas_installedConstraints removeObject:self];
394 | }
395 |
396 | @end
397 |
--------------------------------------------------------------------------------
/TableViewsInTableView/TableViewsInTableView.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | CE8F5FD51D311B7400A2FDBD /* KylinOneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8F5FD41D311B7400A2FDBD /* KylinOneViewController.m */; };
11 | CE8F5FD81D311B9000A2FDBD /* KylinTwoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8F5FD71D311B9000A2FDBD /* KylinTwoViewController.m */; };
12 | CE8F5FDB1D311BA100A2FDBD /* KylinThreeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8F5FDA1D311BA100A2FDBD /* KylinThreeViewController.m */; };
13 | CE8F5FDE1D311BAE00A2FDBD /* KylinFourViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8F5FDD1D311BAE00A2FDBD /* KylinFourViewController.m */; };
14 | CEEDC7691D2FCE9C006A820D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7681D2FCE9C006A820D /* main.m */; };
15 | CEEDC76C1D2FCE9C006A820D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC76B1D2FCE9C006A820D /* AppDelegate.m */; };
16 | CEEDC7741D2FCE9C006A820D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CEEDC7731D2FCE9C006A820D /* Assets.xcassets */; };
17 | CEEDC7771D2FCE9C006A820D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CEEDC7751D2FCE9C006A820D /* LaunchScreen.storyboard */; };
18 | CEEDC7821D2FCE9C006A820D /* TableViewsInTableViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7811D2FCE9C006A820D /* TableViewsInTableViewTests.m */; };
19 | CEEDC78D1D2FCE9D006A820D /* TableViewsInTableViewUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC78C1D2FCE9D006A820D /* TableViewsInTableViewUITests.m */; };
20 | CEEDC79C1D2FD5D6006A820D /* KylinMainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC79B1D2FD5D6006A820D /* KylinMainViewController.m */; };
21 | CEEDC7B81D2FD82F006A820D /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = CEEDC79E1D2FD82F006A820D /* Info.plist */; };
22 | CEEDC7B91D2FD82F006A820D /* MASCompositeConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7A01D2FD82F006A820D /* MASCompositeConstraint.m */; };
23 | CEEDC7BA1D2FD82F006A820D /* MASConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7A31D2FD82F006A820D /* MASConstraint.m */; };
24 | CEEDC7BB1D2FD82F006A820D /* MASConstraintMaker.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7A51D2FD82F006A820D /* MASConstraintMaker.m */; };
25 | CEEDC7BC1D2FD82F006A820D /* MASLayoutConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7A71D2FD82F006A820D /* MASLayoutConstraint.m */; };
26 | CEEDC7BD1D2FD82F006A820D /* MASViewAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7AB1D2FD82F006A820D /* MASViewAttribute.m */; };
27 | CEEDC7BE1D2FD82F006A820D /* MASViewConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7AD1D2FD82F006A820D /* MASViewConstraint.m */; };
28 | CEEDC7BF1D2FD82F006A820D /* NSArray+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7AF1D2FD82F006A820D /* NSArray+MASAdditions.m */; };
29 | CEEDC7C01D2FD82F006A820D /* NSLayoutConstraint+MASDebugAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7B21D2FD82F006A820D /* NSLayoutConstraint+MASDebugAdditions.m */; };
30 | CEEDC7C11D2FD82F006A820D /* View+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7B41D2FD82F006A820D /* View+MASAdditions.m */; };
31 | CEEDC7C21D2FD82F006A820D /* ViewController+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7B71D2FD82F006A820D /* ViewController+MASAdditions.m */; };
32 | CEEDC7C81D2FD99D006A820D /* KylinScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7C71D2FD99D006A820D /* KylinScrollView.m */; };
33 | CEEDC7CB1D2FFD64006A820D /* UIView+Kylin.m in Sources */ = {isa = PBXBuildFile; fileRef = CEEDC7CA1D2FFD64006A820D /* UIView+Kylin.m */; };
34 | /* End PBXBuildFile section */
35 |
36 | /* Begin PBXContainerItemProxy section */
37 | CEEDC77E1D2FCE9C006A820D /* PBXContainerItemProxy */ = {
38 | isa = PBXContainerItemProxy;
39 | containerPortal = CEEDC75C1D2FCE9C006A820D /* Project object */;
40 | proxyType = 1;
41 | remoteGlobalIDString = CEEDC7631D2FCE9C006A820D;
42 | remoteInfo = TableViewsInTableView;
43 | };
44 | CEEDC7891D2FCE9D006A820D /* PBXContainerItemProxy */ = {
45 | isa = PBXContainerItemProxy;
46 | containerPortal = CEEDC75C1D2FCE9C006A820D /* Project object */;
47 | proxyType = 1;
48 | remoteGlobalIDString = CEEDC7631D2FCE9C006A820D;
49 | remoteInfo = TableViewsInTableView;
50 | };
51 | /* End PBXContainerItemProxy section */
52 |
53 | /* Begin PBXFileReference section */
54 | CE8F5FD31D311B7400A2FDBD /* KylinOneViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KylinOneViewController.h; sourceTree = ""; };
55 | CE8F5FD41D311B7400A2FDBD /* KylinOneViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KylinOneViewController.m; sourceTree = ""; };
56 | CE8F5FD61D311B9000A2FDBD /* KylinTwoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KylinTwoViewController.h; sourceTree = ""; };
57 | CE8F5FD71D311B9000A2FDBD /* KylinTwoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KylinTwoViewController.m; sourceTree = ""; };
58 | CE8F5FD91D311BA100A2FDBD /* KylinThreeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KylinThreeViewController.h; sourceTree = ""; };
59 | CE8F5FDA1D311BA100A2FDBD /* KylinThreeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KylinThreeViewController.m; sourceTree = ""; };
60 | CE8F5FDC1D311BAE00A2FDBD /* KylinFourViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KylinFourViewController.h; sourceTree = ""; };
61 | CE8F5FDD1D311BAE00A2FDBD /* KylinFourViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KylinFourViewController.m; sourceTree = ""; };
62 | CEEDC7641D2FCE9C006A820D /* TableViewsInTableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TableViewsInTableView.app; sourceTree = BUILT_PRODUCTS_DIR; };
63 | CEEDC7681D2FCE9C006A820D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
64 | CEEDC76A1D2FCE9C006A820D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
65 | CEEDC76B1D2FCE9C006A820D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
66 | CEEDC7731D2FCE9C006A820D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
67 | CEEDC7761D2FCE9C006A820D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
68 | CEEDC7781D2FCE9C006A820D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
69 | CEEDC77D1D2FCE9C006A820D /* TableViewsInTableViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TableViewsInTableViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
70 | CEEDC7811D2FCE9C006A820D /* TableViewsInTableViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TableViewsInTableViewTests.m; sourceTree = ""; };
71 | CEEDC7831D2FCE9C006A820D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
72 | CEEDC7881D2FCE9D006A820D /* TableViewsInTableViewUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TableViewsInTableViewUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
73 | CEEDC78C1D2FCE9D006A820D /* TableViewsInTableViewUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TableViewsInTableViewUITests.m; sourceTree = ""; };
74 | CEEDC78E1D2FCE9D006A820D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
75 | CEEDC79A1D2FD5D6006A820D /* KylinMainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KylinMainViewController.h; sourceTree = ""; };
76 | CEEDC79B1D2FD5D6006A820D /* KylinMainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KylinMainViewController.m; sourceTree = ""; };
77 | CEEDC79E1D2FD82F006A820D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
78 | CEEDC79F1D2FD82F006A820D /* MASCompositeConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASCompositeConstraint.h; sourceTree = ""; };
79 | CEEDC7A01D2FD82F006A820D /* MASCompositeConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASCompositeConstraint.m; sourceTree = ""; };
80 | CEEDC7A11D2FD82F006A820D /* MASConstraint+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MASConstraint+Private.h"; sourceTree = ""; };
81 | CEEDC7A21D2FD82F006A820D /* MASConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASConstraint.h; sourceTree = ""; };
82 | CEEDC7A31D2FD82F006A820D /* MASConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASConstraint.m; sourceTree = ""; };
83 | CEEDC7A41D2FD82F006A820D /* MASConstraintMaker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASConstraintMaker.h; sourceTree = ""; };
84 | CEEDC7A51D2FD82F006A820D /* MASConstraintMaker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASConstraintMaker.m; sourceTree = ""; };
85 | CEEDC7A61D2FD82F006A820D /* MASLayoutConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASLayoutConstraint.h; sourceTree = ""; };
86 | CEEDC7A71D2FD82F006A820D /* MASLayoutConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASLayoutConstraint.m; sourceTree = ""; };
87 | CEEDC7A81D2FD82F006A820D /* Masonry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Masonry.h; sourceTree = ""; };
88 | CEEDC7A91D2FD82F006A820D /* MASUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASUtilities.h; sourceTree = ""; };
89 | CEEDC7AA1D2FD82F006A820D /* MASViewAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASViewAttribute.h; sourceTree = ""; };
90 | CEEDC7AB1D2FD82F006A820D /* MASViewAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASViewAttribute.m; sourceTree = ""; };
91 | CEEDC7AC1D2FD82F006A820D /* MASViewConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASViewConstraint.h; sourceTree = ""; };
92 | CEEDC7AD1D2FD82F006A820D /* MASViewConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASViewConstraint.m; sourceTree = ""; };
93 | CEEDC7AE1D2FD82F006A820D /* NSArray+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MASAdditions.h"; sourceTree = ""; };
94 | CEEDC7AF1D2FD82F006A820D /* NSArray+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+MASAdditions.m"; sourceTree = ""; };
95 | CEEDC7B01D2FD82F006A820D /* NSArray+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MASShorthandAdditions.h"; sourceTree = ""; };
96 | CEEDC7B11D2FD82F006A820D /* NSLayoutConstraint+MASDebugAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSLayoutConstraint+MASDebugAdditions.h"; sourceTree = ""; };
97 | CEEDC7B21D2FD82F006A820D /* NSLayoutConstraint+MASDebugAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSLayoutConstraint+MASDebugAdditions.m"; sourceTree = ""; };
98 | CEEDC7B31D2FD82F006A820D /* View+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "View+MASAdditions.h"; sourceTree = ""; };
99 | CEEDC7B41D2FD82F006A820D /* View+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "View+MASAdditions.m"; sourceTree = ""; };
100 | CEEDC7B51D2FD82F006A820D /* View+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "View+MASShorthandAdditions.h"; sourceTree = ""; };
101 | CEEDC7B61D2FD82F006A820D /* ViewController+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ViewController+MASAdditions.h"; sourceTree = ""; };
102 | CEEDC7B71D2FD82F006A820D /* ViewController+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ViewController+MASAdditions.m"; sourceTree = ""; };
103 | CEEDC7C61D2FD99D006A820D /* KylinScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KylinScrollView.h; sourceTree = ""; };
104 | CEEDC7C71D2FD99D006A820D /* KylinScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KylinScrollView.m; sourceTree = ""; };
105 | CEEDC7C91D2FFD64006A820D /* UIView+Kylin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Kylin.h"; sourceTree = ""; };
106 | CEEDC7CA1D2FFD64006A820D /* UIView+Kylin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Kylin.m"; sourceTree = ""; };
107 | /* End PBXFileReference section */
108 |
109 | /* Begin PBXFrameworksBuildPhase section */
110 | CEEDC7611D2FCE9C006A820D /* Frameworks */ = {
111 | isa = PBXFrameworksBuildPhase;
112 | buildActionMask = 2147483647;
113 | files = (
114 | );
115 | runOnlyForDeploymentPostprocessing = 0;
116 | };
117 | CEEDC77A1D2FCE9C006A820D /* Frameworks */ = {
118 | isa = PBXFrameworksBuildPhase;
119 | buildActionMask = 2147483647;
120 | files = (
121 | );
122 | runOnlyForDeploymentPostprocessing = 0;
123 | };
124 | CEEDC7851D2FCE9D006A820D /* Frameworks */ = {
125 | isa = PBXFrameworksBuildPhase;
126 | buildActionMask = 2147483647;
127 | files = (
128 | );
129 | runOnlyForDeploymentPostprocessing = 0;
130 | };
131 | /* End PBXFrameworksBuildPhase section */
132 |
133 | /* Begin PBXGroup section */
134 | CE8F5FD21D311B1600A2FDBD /* titleViews */ = {
135 | isa = PBXGroup;
136 | children = (
137 | CE8F5FD31D311B7400A2FDBD /* KylinOneViewController.h */,
138 | CE8F5FD41D311B7400A2FDBD /* KylinOneViewController.m */,
139 | CE8F5FD61D311B9000A2FDBD /* KylinTwoViewController.h */,
140 | CE8F5FD71D311B9000A2FDBD /* KylinTwoViewController.m */,
141 | CE8F5FD91D311BA100A2FDBD /* KylinThreeViewController.h */,
142 | CE8F5FDA1D311BA100A2FDBD /* KylinThreeViewController.m */,
143 | CE8F5FDC1D311BAE00A2FDBD /* KylinFourViewController.h */,
144 | CE8F5FDD1D311BAE00A2FDBD /* KylinFourViewController.m */,
145 | );
146 | name = titleViews;
147 | sourceTree = "";
148 | };
149 | CEEDC75B1D2FCE9C006A820D = {
150 | isa = PBXGroup;
151 | children = (
152 | CEEDC7661D2FCE9C006A820D /* TableViewsInTableView */,
153 | CEEDC7801D2FCE9C006A820D /* TableViewsInTableViewTests */,
154 | CEEDC78B1D2FCE9D006A820D /* TableViewsInTableViewUITests */,
155 | CEEDC7651D2FCE9C006A820D /* Products */,
156 | );
157 | sourceTree = "";
158 | };
159 | CEEDC7651D2FCE9C006A820D /* Products */ = {
160 | isa = PBXGroup;
161 | children = (
162 | CEEDC7641D2FCE9C006A820D /* TableViewsInTableView.app */,
163 | CEEDC77D1D2FCE9C006A820D /* TableViewsInTableViewTests.xctest */,
164 | CEEDC7881D2FCE9D006A820D /* TableViewsInTableViewUITests.xctest */,
165 | );
166 | name = Products;
167 | sourceTree = "";
168 | };
169 | CEEDC7661D2FCE9C006A820D /* TableViewsInTableView */ = {
170 | isa = PBXGroup;
171 | children = (
172 | CE8F5FD21D311B1600A2FDBD /* titleViews */,
173 | CEEDC79A1D2FD5D6006A820D /* KylinMainViewController.h */,
174 | CEEDC79B1D2FD5D6006A820D /* KylinMainViewController.m */,
175 | CEEDC7C61D2FD99D006A820D /* KylinScrollView.h */,
176 | CEEDC7C71D2FD99D006A820D /* KylinScrollView.m */,
177 | CEEDC7C91D2FFD64006A820D /* UIView+Kylin.h */,
178 | CEEDC7CA1D2FFD64006A820D /* UIView+Kylin.m */,
179 | CEEDC76A1D2FCE9C006A820D /* AppDelegate.h */,
180 | CEEDC76B1D2FCE9C006A820D /* AppDelegate.m */,
181 | CEEDC7731D2FCE9C006A820D /* Assets.xcassets */,
182 | CEEDC7751D2FCE9C006A820D /* LaunchScreen.storyboard */,
183 | CEEDC7781D2FCE9C006A820D /* Info.plist */,
184 | CEEDC79D1D2FD82F006A820D /* Masonry */,
185 | CEEDC7671D2FCE9C006A820D /* Supporting Files */,
186 | );
187 | path = TableViewsInTableView;
188 | sourceTree = "";
189 | };
190 | CEEDC7671D2FCE9C006A820D /* Supporting Files */ = {
191 | isa = PBXGroup;
192 | children = (
193 | CEEDC7681D2FCE9C006A820D /* main.m */,
194 | );
195 | name = "Supporting Files";
196 | sourceTree = "";
197 | };
198 | CEEDC7801D2FCE9C006A820D /* TableViewsInTableViewTests */ = {
199 | isa = PBXGroup;
200 | children = (
201 | CEEDC7811D2FCE9C006A820D /* TableViewsInTableViewTests.m */,
202 | CEEDC7831D2FCE9C006A820D /* Info.plist */,
203 | );
204 | path = TableViewsInTableViewTests;
205 | sourceTree = "";
206 | };
207 | CEEDC78B1D2FCE9D006A820D /* TableViewsInTableViewUITests */ = {
208 | isa = PBXGroup;
209 | children = (
210 | CEEDC78C1D2FCE9D006A820D /* TableViewsInTableViewUITests.m */,
211 | CEEDC78E1D2FCE9D006A820D /* Info.plist */,
212 | );
213 | path = TableViewsInTableViewUITests;
214 | sourceTree = "";
215 | };
216 | CEEDC79D1D2FD82F006A820D /* Masonry */ = {
217 | isa = PBXGroup;
218 | children = (
219 | CEEDC79E1D2FD82F006A820D /* Info.plist */,
220 | CEEDC79F1D2FD82F006A820D /* MASCompositeConstraint.h */,
221 | CEEDC7A01D2FD82F006A820D /* MASCompositeConstraint.m */,
222 | CEEDC7A11D2FD82F006A820D /* MASConstraint+Private.h */,
223 | CEEDC7A21D2FD82F006A820D /* MASConstraint.h */,
224 | CEEDC7A31D2FD82F006A820D /* MASConstraint.m */,
225 | CEEDC7A41D2FD82F006A820D /* MASConstraintMaker.h */,
226 | CEEDC7A51D2FD82F006A820D /* MASConstraintMaker.m */,
227 | CEEDC7A61D2FD82F006A820D /* MASLayoutConstraint.h */,
228 | CEEDC7A71D2FD82F006A820D /* MASLayoutConstraint.m */,
229 | CEEDC7A81D2FD82F006A820D /* Masonry.h */,
230 | CEEDC7A91D2FD82F006A820D /* MASUtilities.h */,
231 | CEEDC7AA1D2FD82F006A820D /* MASViewAttribute.h */,
232 | CEEDC7AB1D2FD82F006A820D /* MASViewAttribute.m */,
233 | CEEDC7AC1D2FD82F006A820D /* MASViewConstraint.h */,
234 | CEEDC7AD1D2FD82F006A820D /* MASViewConstraint.m */,
235 | CEEDC7AE1D2FD82F006A820D /* NSArray+MASAdditions.h */,
236 | CEEDC7AF1D2FD82F006A820D /* NSArray+MASAdditions.m */,
237 | CEEDC7B01D2FD82F006A820D /* NSArray+MASShorthandAdditions.h */,
238 | CEEDC7B11D2FD82F006A820D /* NSLayoutConstraint+MASDebugAdditions.h */,
239 | CEEDC7B21D2FD82F006A820D /* NSLayoutConstraint+MASDebugAdditions.m */,
240 | CEEDC7B31D2FD82F006A820D /* View+MASAdditions.h */,
241 | CEEDC7B41D2FD82F006A820D /* View+MASAdditions.m */,
242 | CEEDC7B51D2FD82F006A820D /* View+MASShorthandAdditions.h */,
243 | CEEDC7B61D2FD82F006A820D /* ViewController+MASAdditions.h */,
244 | CEEDC7B71D2FD82F006A820D /* ViewController+MASAdditions.m */,
245 | );
246 | path = Masonry;
247 | sourceTree = "";
248 | };
249 | /* End PBXGroup section */
250 |
251 | /* Begin PBXNativeTarget section */
252 | CEEDC7631D2FCE9C006A820D /* TableViewsInTableView */ = {
253 | isa = PBXNativeTarget;
254 | buildConfigurationList = CEEDC7911D2FCE9D006A820D /* Build configuration list for PBXNativeTarget "TableViewsInTableView" */;
255 | buildPhases = (
256 | CEEDC7601D2FCE9C006A820D /* Sources */,
257 | CEEDC7611D2FCE9C006A820D /* Frameworks */,
258 | CEEDC7621D2FCE9C006A820D /* Resources */,
259 | );
260 | buildRules = (
261 | );
262 | dependencies = (
263 | );
264 | name = TableViewsInTableView;
265 | productName = TableViewsInTableView;
266 | productReference = CEEDC7641D2FCE9C006A820D /* TableViewsInTableView.app */;
267 | productType = "com.apple.product-type.application";
268 | };
269 | CEEDC77C1D2FCE9C006A820D /* TableViewsInTableViewTests */ = {
270 | isa = PBXNativeTarget;
271 | buildConfigurationList = CEEDC7941D2FCE9D006A820D /* Build configuration list for PBXNativeTarget "TableViewsInTableViewTests" */;
272 | buildPhases = (
273 | CEEDC7791D2FCE9C006A820D /* Sources */,
274 | CEEDC77A1D2FCE9C006A820D /* Frameworks */,
275 | CEEDC77B1D2FCE9C006A820D /* Resources */,
276 | );
277 | buildRules = (
278 | );
279 | dependencies = (
280 | CEEDC77F1D2FCE9C006A820D /* PBXTargetDependency */,
281 | );
282 | name = TableViewsInTableViewTests;
283 | productName = TableViewsInTableViewTests;
284 | productReference = CEEDC77D1D2FCE9C006A820D /* TableViewsInTableViewTests.xctest */;
285 | productType = "com.apple.product-type.bundle.unit-test";
286 | };
287 | CEEDC7871D2FCE9D006A820D /* TableViewsInTableViewUITests */ = {
288 | isa = PBXNativeTarget;
289 | buildConfigurationList = CEEDC7971D2FCE9D006A820D /* Build configuration list for PBXNativeTarget "TableViewsInTableViewUITests" */;
290 | buildPhases = (
291 | CEEDC7841D2FCE9D006A820D /* Sources */,
292 | CEEDC7851D2FCE9D006A820D /* Frameworks */,
293 | CEEDC7861D2FCE9D006A820D /* Resources */,
294 | );
295 | buildRules = (
296 | );
297 | dependencies = (
298 | CEEDC78A1D2FCE9D006A820D /* PBXTargetDependency */,
299 | );
300 | name = TableViewsInTableViewUITests;
301 | productName = TableViewsInTableViewUITests;
302 | productReference = CEEDC7881D2FCE9D006A820D /* TableViewsInTableViewUITests.xctest */;
303 | productType = "com.apple.product-type.bundle.ui-testing";
304 | };
305 | /* End PBXNativeTarget section */
306 |
307 | /* Begin PBXProject section */
308 | CEEDC75C1D2FCE9C006A820D /* Project object */ = {
309 | isa = PBXProject;
310 | attributes = {
311 | CLASSPREFIX = Kylin;
312 | LastUpgradeCheck = 0720;
313 | ORGANIZATIONNAME = Kylin;
314 | TargetAttributes = {
315 | CEEDC7631D2FCE9C006A820D = {
316 | CreatedOnToolsVersion = 7.2;
317 | DevelopmentTeam = 5LRV39VPHP;
318 | ProvisioningStyle = Automatic;
319 | };
320 | CEEDC77C1D2FCE9C006A820D = {
321 | CreatedOnToolsVersion = 7.2;
322 | DevelopmentTeam = 8G79N249F6;
323 | TestTargetID = CEEDC7631D2FCE9C006A820D;
324 | };
325 | CEEDC7871D2FCE9D006A820D = {
326 | CreatedOnToolsVersion = 7.2;
327 | DevelopmentTeam = 8G79N249F6;
328 | TestTargetID = CEEDC7631D2FCE9C006A820D;
329 | };
330 | };
331 | };
332 | buildConfigurationList = CEEDC75F1D2FCE9C006A820D /* Build configuration list for PBXProject "TableViewsInTableView" */;
333 | compatibilityVersion = "Xcode 3.2";
334 | developmentRegion = English;
335 | hasScannedForEncodings = 0;
336 | knownRegions = (
337 | en,
338 | Base,
339 | );
340 | mainGroup = CEEDC75B1D2FCE9C006A820D;
341 | productRefGroup = CEEDC7651D2FCE9C006A820D /* Products */;
342 | projectDirPath = "";
343 | projectRoot = "";
344 | targets = (
345 | CEEDC7631D2FCE9C006A820D /* TableViewsInTableView */,
346 | CEEDC77C1D2FCE9C006A820D /* TableViewsInTableViewTests */,
347 | CEEDC7871D2FCE9D006A820D /* TableViewsInTableViewUITests */,
348 | );
349 | };
350 | /* End PBXProject section */
351 |
352 | /* Begin PBXResourcesBuildPhase section */
353 | CEEDC7621D2FCE9C006A820D /* Resources */ = {
354 | isa = PBXResourcesBuildPhase;
355 | buildActionMask = 2147483647;
356 | files = (
357 | CEEDC7771D2FCE9C006A820D /* LaunchScreen.storyboard in Resources */,
358 | CEEDC7741D2FCE9C006A820D /* Assets.xcassets in Resources */,
359 | CEEDC7B81D2FD82F006A820D /* Info.plist in Resources */,
360 | );
361 | runOnlyForDeploymentPostprocessing = 0;
362 | };
363 | CEEDC77B1D2FCE9C006A820D /* Resources */ = {
364 | isa = PBXResourcesBuildPhase;
365 | buildActionMask = 2147483647;
366 | files = (
367 | );
368 | runOnlyForDeploymentPostprocessing = 0;
369 | };
370 | CEEDC7861D2FCE9D006A820D /* Resources */ = {
371 | isa = PBXResourcesBuildPhase;
372 | buildActionMask = 2147483647;
373 | files = (
374 | );
375 | runOnlyForDeploymentPostprocessing = 0;
376 | };
377 | /* End PBXResourcesBuildPhase section */
378 |
379 | /* Begin PBXSourcesBuildPhase section */
380 | CEEDC7601D2FCE9C006A820D /* Sources */ = {
381 | isa = PBXSourcesBuildPhase;
382 | buildActionMask = 2147483647;
383 | files = (
384 | CEEDC7C01D2FD82F006A820D /* NSLayoutConstraint+MASDebugAdditions.m in Sources */,
385 | CE8F5FDB1D311BA100A2FDBD /* KylinThreeViewController.m in Sources */,
386 | CEEDC7BE1D2FD82F006A820D /* MASViewConstraint.m in Sources */,
387 | CEEDC7B91D2FD82F006A820D /* MASCompositeConstraint.m in Sources */,
388 | CEEDC7C81D2FD99D006A820D /* KylinScrollView.m in Sources */,
389 | CEEDC7BF1D2FD82F006A820D /* NSArray+MASAdditions.m in Sources */,
390 | CEEDC79C1D2FD5D6006A820D /* KylinMainViewController.m in Sources */,
391 | CEEDC76C1D2FCE9C006A820D /* AppDelegate.m in Sources */,
392 | CE8F5FDE1D311BAE00A2FDBD /* KylinFourViewController.m in Sources */,
393 | CEEDC7BC1D2FD82F006A820D /* MASLayoutConstraint.m in Sources */,
394 | CE8F5FD81D311B9000A2FDBD /* KylinTwoViewController.m in Sources */,
395 | CEEDC7691D2FCE9C006A820D /* main.m in Sources */,
396 | CEEDC7C21D2FD82F006A820D /* ViewController+MASAdditions.m in Sources */,
397 | CEEDC7C11D2FD82F006A820D /* View+MASAdditions.m in Sources */,
398 | CE8F5FD51D311B7400A2FDBD /* KylinOneViewController.m in Sources */,
399 | CEEDC7BD1D2FD82F006A820D /* MASViewAttribute.m in Sources */,
400 | CEEDC7BA1D2FD82F006A820D /* MASConstraint.m in Sources */,
401 | CEEDC7CB1D2FFD64006A820D /* UIView+Kylin.m in Sources */,
402 | CEEDC7BB1D2FD82F006A820D /* MASConstraintMaker.m in Sources */,
403 | );
404 | runOnlyForDeploymentPostprocessing = 0;
405 | };
406 | CEEDC7791D2FCE9C006A820D /* Sources */ = {
407 | isa = PBXSourcesBuildPhase;
408 | buildActionMask = 2147483647;
409 | files = (
410 | CEEDC7821D2FCE9C006A820D /* TableViewsInTableViewTests.m in Sources */,
411 | );
412 | runOnlyForDeploymentPostprocessing = 0;
413 | };
414 | CEEDC7841D2FCE9D006A820D /* Sources */ = {
415 | isa = PBXSourcesBuildPhase;
416 | buildActionMask = 2147483647;
417 | files = (
418 | CEEDC78D1D2FCE9D006A820D /* TableViewsInTableViewUITests.m in Sources */,
419 | );
420 | runOnlyForDeploymentPostprocessing = 0;
421 | };
422 | /* End PBXSourcesBuildPhase section */
423 |
424 | /* Begin PBXTargetDependency section */
425 | CEEDC77F1D2FCE9C006A820D /* PBXTargetDependency */ = {
426 | isa = PBXTargetDependency;
427 | target = CEEDC7631D2FCE9C006A820D /* TableViewsInTableView */;
428 | targetProxy = CEEDC77E1D2FCE9C006A820D /* PBXContainerItemProxy */;
429 | };
430 | CEEDC78A1D2FCE9D006A820D /* PBXTargetDependency */ = {
431 | isa = PBXTargetDependency;
432 | target = CEEDC7631D2FCE9C006A820D /* TableViewsInTableView */;
433 | targetProxy = CEEDC7891D2FCE9D006A820D /* PBXContainerItemProxy */;
434 | };
435 | /* End PBXTargetDependency section */
436 |
437 | /* Begin PBXVariantGroup section */
438 | CEEDC7751D2FCE9C006A820D /* LaunchScreen.storyboard */ = {
439 | isa = PBXVariantGroup;
440 | children = (
441 | CEEDC7761D2FCE9C006A820D /* Base */,
442 | );
443 | name = LaunchScreen.storyboard;
444 | sourceTree = "";
445 | };
446 | /* End PBXVariantGroup section */
447 |
448 | /* Begin XCBuildConfiguration section */
449 | CEEDC78F1D2FCE9D006A820D /* Debug */ = {
450 | isa = XCBuildConfiguration;
451 | buildSettings = {
452 | ALWAYS_SEARCH_USER_PATHS = NO;
453 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
454 | CLANG_CXX_LIBRARY = "libc++";
455 | CLANG_ENABLE_MODULES = YES;
456 | CLANG_ENABLE_OBJC_ARC = YES;
457 | CLANG_WARN_BOOL_CONVERSION = YES;
458 | CLANG_WARN_CONSTANT_CONVERSION = YES;
459 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
460 | CLANG_WARN_EMPTY_BODY = YES;
461 | CLANG_WARN_ENUM_CONVERSION = YES;
462 | CLANG_WARN_INT_CONVERSION = YES;
463 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
464 | CLANG_WARN_UNREACHABLE_CODE = YES;
465 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
466 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
467 | COPY_PHASE_STRIP = NO;
468 | DEBUG_INFORMATION_FORMAT = dwarf;
469 | ENABLE_STRICT_OBJC_MSGSEND = YES;
470 | ENABLE_TESTABILITY = YES;
471 | GCC_C_LANGUAGE_STANDARD = gnu99;
472 | GCC_DYNAMIC_NO_PIC = NO;
473 | GCC_NO_COMMON_BLOCKS = YES;
474 | GCC_OPTIMIZATION_LEVEL = 0;
475 | GCC_PREPROCESSOR_DEFINITIONS = (
476 | "DEBUG=1",
477 | "$(inherited)",
478 | );
479 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
480 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
481 | GCC_WARN_UNDECLARED_SELECTOR = YES;
482 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
483 | GCC_WARN_UNUSED_FUNCTION = YES;
484 | GCC_WARN_UNUSED_VARIABLE = YES;
485 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
486 | MTL_ENABLE_DEBUG_INFO = YES;
487 | ONLY_ACTIVE_ARCH = YES;
488 | SDKROOT = iphoneos;
489 | };
490 | name = Debug;
491 | };
492 | CEEDC7901D2FCE9D006A820D /* Release */ = {
493 | isa = XCBuildConfiguration;
494 | buildSettings = {
495 | ALWAYS_SEARCH_USER_PATHS = NO;
496 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
497 | CLANG_CXX_LIBRARY = "libc++";
498 | CLANG_ENABLE_MODULES = YES;
499 | CLANG_ENABLE_OBJC_ARC = YES;
500 | CLANG_WARN_BOOL_CONVERSION = YES;
501 | CLANG_WARN_CONSTANT_CONVERSION = YES;
502 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
503 | CLANG_WARN_EMPTY_BODY = YES;
504 | CLANG_WARN_ENUM_CONVERSION = YES;
505 | CLANG_WARN_INT_CONVERSION = YES;
506 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
507 | CLANG_WARN_UNREACHABLE_CODE = YES;
508 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
509 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
510 | COPY_PHASE_STRIP = NO;
511 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
512 | ENABLE_NS_ASSERTIONS = NO;
513 | ENABLE_STRICT_OBJC_MSGSEND = YES;
514 | GCC_C_LANGUAGE_STANDARD = gnu99;
515 | GCC_NO_COMMON_BLOCKS = YES;
516 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
517 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
518 | GCC_WARN_UNDECLARED_SELECTOR = YES;
519 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
520 | GCC_WARN_UNUSED_FUNCTION = YES;
521 | GCC_WARN_UNUSED_VARIABLE = YES;
522 | IPHONEOS_DEPLOYMENT_TARGET = 9.2;
523 | MTL_ENABLE_DEBUG_INFO = NO;
524 | SDKROOT = iphoneos;
525 | VALIDATE_PRODUCT = YES;
526 | };
527 | name = Release;
528 | };
529 | CEEDC7921D2FCE9D006A820D /* Debug */ = {
530 | isa = XCBuildConfiguration;
531 | buildSettings = {
532 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
533 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
534 | DEVELOPMENT_TEAM = 5LRV39VPHP;
535 | INFOPLIST_FILE = TableViewsInTableView/Info.plist;
536 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
537 | PRODUCT_BUNDLE_IDENTIFIER = space.kylin.www.TableViewsInTableView;
538 | PRODUCT_NAME = "$(TARGET_NAME)";
539 | };
540 | name = Debug;
541 | };
542 | CEEDC7931D2FCE9D006A820D /* Release */ = {
543 | isa = XCBuildConfiguration;
544 | buildSettings = {
545 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
546 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
547 | DEVELOPMENT_TEAM = 5LRV39VPHP;
548 | INFOPLIST_FILE = TableViewsInTableView/Info.plist;
549 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
550 | PRODUCT_BUNDLE_IDENTIFIER = space.kylin.www.TableViewsInTableView;
551 | PRODUCT_NAME = "$(TARGET_NAME)";
552 | };
553 | name = Release;
554 | };
555 | CEEDC7951D2FCE9D006A820D /* Debug */ = {
556 | isa = XCBuildConfiguration;
557 | buildSettings = {
558 | BUNDLE_LOADER = "$(TEST_HOST)";
559 | INFOPLIST_FILE = TableViewsInTableViewTests/Info.plist;
560 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
561 | PRODUCT_BUNDLE_IDENTIFIER = space.kylin.www.TableViewsInTableViewTests;
562 | PRODUCT_NAME = "$(TARGET_NAME)";
563 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TableViewsInTableView.app/TableViewsInTableView";
564 | };
565 | name = Debug;
566 | };
567 | CEEDC7961D2FCE9D006A820D /* Release */ = {
568 | isa = XCBuildConfiguration;
569 | buildSettings = {
570 | BUNDLE_LOADER = "$(TEST_HOST)";
571 | INFOPLIST_FILE = TableViewsInTableViewTests/Info.plist;
572 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
573 | PRODUCT_BUNDLE_IDENTIFIER = space.kylin.www.TableViewsInTableViewTests;
574 | PRODUCT_NAME = "$(TARGET_NAME)";
575 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TableViewsInTableView.app/TableViewsInTableView";
576 | };
577 | name = Release;
578 | };
579 | CEEDC7981D2FCE9D006A820D /* Debug */ = {
580 | isa = XCBuildConfiguration;
581 | buildSettings = {
582 | INFOPLIST_FILE = TableViewsInTableViewUITests/Info.plist;
583 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
584 | PRODUCT_BUNDLE_IDENTIFIER = space.kylin.www.TableViewsInTableViewUITests;
585 | PRODUCT_NAME = "$(TARGET_NAME)";
586 | TEST_TARGET_NAME = TableViewsInTableView;
587 | USES_XCTRUNNER = YES;
588 | };
589 | name = Debug;
590 | };
591 | CEEDC7991D2FCE9D006A820D /* Release */ = {
592 | isa = XCBuildConfiguration;
593 | buildSettings = {
594 | INFOPLIST_FILE = TableViewsInTableViewUITests/Info.plist;
595 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
596 | PRODUCT_BUNDLE_IDENTIFIER = space.kylin.www.TableViewsInTableViewUITests;
597 | PRODUCT_NAME = "$(TARGET_NAME)";
598 | TEST_TARGET_NAME = TableViewsInTableView;
599 | USES_XCTRUNNER = YES;
600 | };
601 | name = Release;
602 | };
603 | /* End XCBuildConfiguration section */
604 |
605 | /* Begin XCConfigurationList section */
606 | CEEDC75F1D2FCE9C006A820D /* Build configuration list for PBXProject "TableViewsInTableView" */ = {
607 | isa = XCConfigurationList;
608 | buildConfigurations = (
609 | CEEDC78F1D2FCE9D006A820D /* Debug */,
610 | CEEDC7901D2FCE9D006A820D /* Release */,
611 | );
612 | defaultConfigurationIsVisible = 0;
613 | defaultConfigurationName = Release;
614 | };
615 | CEEDC7911D2FCE9D006A820D /* Build configuration list for PBXNativeTarget "TableViewsInTableView" */ = {
616 | isa = XCConfigurationList;
617 | buildConfigurations = (
618 | CEEDC7921D2FCE9D006A820D /* Debug */,
619 | CEEDC7931D2FCE9D006A820D /* Release */,
620 | );
621 | defaultConfigurationIsVisible = 0;
622 | defaultConfigurationName = Release;
623 | };
624 | CEEDC7941D2FCE9D006A820D /* Build configuration list for PBXNativeTarget "TableViewsInTableViewTests" */ = {
625 | isa = XCConfigurationList;
626 | buildConfigurations = (
627 | CEEDC7951D2FCE9D006A820D /* Debug */,
628 | CEEDC7961D2FCE9D006A820D /* Release */,
629 | );
630 | defaultConfigurationIsVisible = 0;
631 | defaultConfigurationName = Release;
632 | };
633 | CEEDC7971D2FCE9D006A820D /* Build configuration list for PBXNativeTarget "TableViewsInTableViewUITests" */ = {
634 | isa = XCConfigurationList;
635 | buildConfigurations = (
636 | CEEDC7981D2FCE9D006A820D /* Debug */,
637 | CEEDC7991D2FCE9D006A820D /* Release */,
638 | );
639 | defaultConfigurationIsVisible = 0;
640 | defaultConfigurationName = Release;
641 | };
642 | /* End XCConfigurationList section */
643 | };
644 | rootObject = CEEDC75C1D2FCE9C006A820D /* Project object */;
645 | }
646 |
--------------------------------------------------------------------------------