├── .gitignore
├── AutolayoutScrollViewInCode
├── AutolayoutScrollViewInCode.xcodeproj
│ └── project.pbxproj
├── AutolayoutScrollViewInCode
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ └── ViewController.swift
├── AutolayoutScrollViewInCodeTests
│ ├── AutolayoutScrollViewInCodeTests.swift
│ └── Info.plist
├── AutolayoutScrollViewInCodeUITests
│ ├── AutolayoutScrollViewInCodeUITests.swift
│ └── Info.plist
├── Podfile
├── Podfile.lock
├── Pods
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ └── project.pbxproj
│ ├── SnapKit
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── Source
│ │ │ ├── Constraint.swift
│ │ │ ├── ConstraintAttributes.swift
│ │ │ ├── ConstraintDescription.swift
│ │ │ ├── ConstraintItem.swift
│ │ │ ├── ConstraintMaker.swift
│ │ │ ├── ConstraintRelation.swift
│ │ │ ├── Debugging.swift
│ │ │ ├── EdgeInsets.swift
│ │ │ ├── LayoutConstraint.swift
│ │ │ ├── SnapKit.swift
│ │ │ ├── SourceLocation.swift
│ │ │ ├── View+SnapKit.swift
│ │ │ └── ViewController+SnapKit.swift
│ └── Target Support Files
│ │ ├── Pods
│ │ ├── Info.plist
│ │ ├── Pods-acknowledgements.markdown
│ │ ├── Pods-acknowledgements.plist
│ │ ├── Pods-dummy.m
│ │ ├── Pods-frameworks.sh
│ │ ├── Pods-resources.sh
│ │ ├── Pods-umbrella.h
│ │ ├── Pods.debug.xcconfig
│ │ ├── Pods.modulemap
│ │ └── Pods.release.xcconfig
│ │ └── SnapKit
│ │ ├── Info.plist
│ │ ├── SnapKit-dummy.m
│ │ ├── SnapKit-prefix.pch
│ │ ├── SnapKit-umbrella.h
│ │ ├── SnapKit.modulemap
│ │ └── SnapKit.xcconfig
└── README.md
├── BATInterview
├── BAT面试指南 PPT.pdf
├── BAT面试指南.pdf
└── 张星宇-东北大学-iOS开发.pdf
├── CocoaPodsDemo
├── BSStaticLibraryOne
│ ├── BSStaticLibraryOne.xcodeproj
│ │ └── project.pbxproj
│ ├── BSStaticLibraryOne
│ │ ├── BSStaticLibraryOne+Extension.h
│ │ ├── BSStaticLibraryOne+Extension.m
│ │ ├── BSStaticLibraryOne.h
│ │ └── BSStaticLibraryOne.m
│ ├── BSStaticLibraryTwo
│ │ ├── BSStaticLibraryTwo.h
│ │ └── BSStaticLibraryTwo.m
│ └── Pod
│ │ ├── Pod.h
│ │ └── Pod.m
├── OtherLinkerFlag
│ ├── OtherLinkerFlag.xcodeproj
│ │ └── project.pbxproj
│ └── OtherLinkerFlag
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── BSStaticLibraryOne+Extension.h
│ │ ├── BSStaticLibraryOne.h
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ ├── ViewController.h
│ │ ├── ViewController.m
│ │ └── main.m
├── ShellProject.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── ShellProject.xcscmblueprint
│ └── xcuserdata
│ │ └── zxy.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── ShellProject
│ ├── ShellProject.xcodeproj
│ └── project.pbxproj
│ └── ShellProject
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── CornerRadius
├── CornerRadius.xcodeproj
│ └── project.pbxproj
├── CornerRadius
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ └── photo.imageset
│ │ │ ├── Contents.json
│ │ │ └── photo.png
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── CornerRadius-Bridging-Header.h
│ ├── CustomTableViewCell.swift
│ ├── Info.plist
│ ├── KtCorner.swift
│ ├── UIImage+ImageRoundedCorner.h
│ ├── UIImage+ImageRoundedCorner.m
│ └── ViewController.swift
├── CornerRadiusTests
│ ├── CornerRadiusTests.swift
│ └── Info.plist
├── CornerRadiusUITests
│ ├── CornerRadiusUITests.swift
│ └── Info.plist
└── README.md
├── CustomTransition
├── CustomTransition-OC
│ ├── CustomTransitions.xcodeproj
│ │ └── project.pbxproj
│ ├── CustomTransitions
│ │ ├── AAPLAppDelegate.h
│ │ ├── AAPLAppDelegate.m
│ │ ├── AAPLExternalStoryboardSegue.h
│ │ ├── AAPLExternalStoryboardSegue.m
│ │ ├── AAPLMenuViewController.h
│ │ ├── AAPLMenuViewController.m
│ │ ├── Adaptive Presentation
│ │ │ ├── AAPLAdaptivePresentationController.h
│ │ │ ├── AAPLAdaptivePresentationController.m
│ │ │ ├── AAPLAdaptivePresentationFirstViewController.h
│ │ │ ├── AAPLAdaptivePresentationFirstViewController.m
│ │ │ ├── AAPLAdaptivePresentationSecondViewController.h
│ │ │ ├── AAPLAdaptivePresentationSecondViewController.m
│ │ │ ├── AAPLAdaptivePresentationSegue.h
│ │ │ ├── AAPLAdaptivePresentationSegue.m
│ │ │ └── AdaptivePresentation.storyboard
│ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.xib
│ │ │ └── Main.storyboard
│ │ ├── Checkerboard
│ │ │ ├── AAPLCheckerboardFirstViewController.h
│ │ │ ├── AAPLCheckerboardFirstViewController.m
│ │ │ ├── AAPLCheckerboardTransitionAnimator.h
│ │ │ ├── AAPLCheckerboardTransitionAnimator.m
│ │ │ └── Checkerboard.storyboard
│ │ ├── Cross Dissolve
│ │ │ ├── AAPLCrossDissolveFirstViewController.h
│ │ │ ├── AAPLCrossDissolveFirstViewController.m
│ │ │ ├── AAPLCrossDissolveSecondViewController.h
│ │ │ ├── AAPLCrossDissolveSecondViewController.m
│ │ │ ├── AAPLCrossDissolveTransitionAnimator.h
│ │ │ ├── AAPLCrossDissolveTransitionAnimator.m
│ │ │ └── CrossDissolve.storyboard
│ │ ├── Custom Presentation
│ │ │ ├── AAPLCustomPresentationController.h
│ │ │ ├── AAPLCustomPresentationController.m
│ │ │ ├── AAPLCustomPresentationFirstViewController.h
│ │ │ ├── AAPLCustomPresentationFirstViewController.m
│ │ │ ├── AAPLCustomPresentationSecondViewController.h
│ │ │ ├── AAPLCustomPresentationSecondViewController.m
│ │ │ └── CustomPresentation.storyboard
│ │ ├── Images.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ │ ├── CloseButton.imageset
│ │ │ │ ├── CloseButton.pdf
│ │ │ │ └── Contents.json
│ │ │ └── LaunchImage.launchimage
│ │ │ │ └── Contents.json
│ │ ├── Info.plist
│ │ ├── Slide
│ │ │ ├── AAPLSlideTransitionAnimator.h
│ │ │ ├── AAPLSlideTransitionAnimator.m
│ │ │ ├── AAPLSlideTransitionDelegate.h
│ │ │ ├── AAPLSlideTransitionDelegate.m
│ │ │ ├── AAPLSlideTransitionInteractionController.h
│ │ │ ├── AAPLSlideTransitionInteractionController.m
│ │ │ └── Slide.storyboard
│ │ ├── Swipe
│ │ │ ├── AAPLSwipeFirstViewController.h
│ │ │ ├── AAPLSwipeFirstViewController.m
│ │ │ ├── AAPLSwipeSecondViewController.h
│ │ │ ├── AAPLSwipeSecondViewController.m
│ │ │ ├── AAPLSwipeTransitionAnimator.h
│ │ │ ├── AAPLSwipeTransitionAnimator.m
│ │ │ ├── AAPLSwipeTransitionDelegate.h
│ │ │ ├── AAPLSwipeTransitionDelegate.m
│ │ │ ├── AAPLSwipeTransitionInteractionController.h
│ │ │ ├── AAPLSwipeTransitionInteractionController.m
│ │ │ └── Swipe.storyboard
│ │ └── main.m
│ ├── LICENSE.txt
│ └── README.md
└── CustomTransition-Swift
│ ├── CustomTransition-Swift.xcodeproj
│ └── project.pbxproj
│ ├── CustomTransition-Swift
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Cross Dissolve
│ │ ├── CrossDissolveAnimator.swift
│ │ ├── CrossDissolveFirstViewController.swift
│ │ ├── CrossDissolveSecondViewController.swift
│ │ └── HalfWaySpringAnimator.swift
│ ├── Custom Presentation
│ │ ├── CustomPresentationAnimator.swift
│ │ ├── CustomPresentationController.swift
│ │ ├── CustomPresentationFirstViewController.swift
│ │ └── CustomPresentationSecondViewController.swift
│ ├── Info.plist
│ ├── Interactivity
│ │ ├── InteractivityFirstViewController.swift
│ │ ├── InteractivitySecondViewController.swift
│ │ ├── InteractivityTransitionAnimator.swift
│ │ ├── InteractivityTransitionDelegate.swift
│ │ └── TransitionInteractionController.swift
│ ├── UIViewShortHand.swift
│ └── ViewController.swift
│ ├── CustomTransition-SwiftTests
│ ├── CustomTransition_SwiftTests.swift
│ └── Info.plist
│ ├── CustomTransition-SwiftUITests
│ ├── CustomTransition_SwiftUITests.swift
│ └── Info.plist
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Pods
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ └── project.pbxproj
│ ├── SnapKit
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── Source
│ │ │ ├── Constraint.swift
│ │ │ ├── ConstraintAttributes.swift
│ │ │ ├── ConstraintDescription.swift
│ │ │ ├── ConstraintItem.swift
│ │ │ ├── ConstraintMaker.swift
│ │ │ ├── ConstraintRelation.swift
│ │ │ ├── Debugging.swift
│ │ │ ├── EdgeInsets.swift
│ │ │ ├── LayoutConstraint.swift
│ │ │ ├── SnapKit.swift
│ │ │ ├── View+SnapKit.swift
│ │ │ └── ViewController+SnapKit.swift
│ └── Target Support Files
│ │ ├── Pods
│ │ ├── Info.plist
│ │ ├── Pods-acknowledgements.markdown
│ │ ├── Pods-acknowledgements.plist
│ │ ├── Pods-dummy.m
│ │ ├── Pods-frameworks.sh
│ │ ├── Pods-resources.sh
│ │ ├── Pods-umbrella.h
│ │ ├── Pods.debug.xcconfig
│ │ ├── Pods.modulemap
│ │ └── Pods.release.xcconfig
│ │ └── SnapKit
│ │ ├── Info.plist
│ │ ├── SnapKit-dummy.m
│ │ ├── SnapKit-prefix.pch
│ │ ├── SnapKit-umbrella.h
│ │ ├── SnapKit.modulemap
│ │ └── SnapKit.xcconfig
│ └── README.md
├── Effective OC
├── EffectiveObjectiveC
│ ├── EffectiveObjectiveC.xcodeproj
│ │ └── project.pbxproj
│ └── EffectiveObjectiveC
│ │ ├── EOCEmployee.h
│ │ ├── EOCEmployee.m
│ │ ├── EOCEmployeeDesigner.h
│ │ ├── EOCEmployeeDesigner.m
│ │ ├── EOCEmployeeDeveloper.h
│ │ ├── EOCEmployeeDeveloper.m
│ │ ├── EOCEmployeeFinance.h
│ │ ├── EOCEmployeeFinance.m
│ │ ├── EOCErrors.h
│ │ ├── EOCErrors.m
│ │ ├── EOCPerson.h
│ │ ├── EOCPerson.m
│ │ ├── EOCSmithPerson.h
│ │ ├── EOCSmithPerson.m
│ │ ├── Enum.h
│ │ ├── Enum.m
│ │ ├── HashTest.h
│ │ ├── HashTest.m
│ │ ├── Literal.h
│ │ ├── Literal.m
│ │ └── main.m
└── 读书总结.md
├── Enum
├── Enum.xcodeproj
│ └── project.pbxproj
└── Enum
│ ├── Enum-Bridging-Header.h
│ ├── OCEnum.h
│ ├── Tree.swift
│ └── main.swift
├── GraphicsPerformance-Starter
├── GraphicsPerformance-Starter.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ │ └── contents.xcworkspacedata
├── GraphicsPerformance-Starter
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ ├── 1.imageset
│ │ │ ├── 1.png
│ │ │ └── Contents.json
│ │ ├── 10.imageset
│ │ │ ├── 10.png
│ │ │ └── Contents.json
│ │ ├── 2.imageset
│ │ │ ├── 2.png
│ │ │ └── Contents.json
│ │ ├── 3.imageset
│ │ │ ├── 3.png
│ │ │ └── Contents.json
│ │ ├── 4.imageset
│ │ │ ├── 4.png
│ │ │ └── Contents.json
│ │ ├── 5.imageset
│ │ │ ├── 5.png
│ │ │ └── Contents.json
│ │ ├── 6.imageset
│ │ │ ├── 6.png
│ │ │ └── Contents.json
│ │ ├── 7.imageset
│ │ │ ├── 7.png
│ │ │ └── Contents.json
│ │ ├── 8.imageset
│ │ │ ├── 8.png
│ │ │ └── Contents.json
│ │ ├── 9.imageset
│ │ │ ├── 9.png
│ │ │ └── Contents.json
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ ├── first.imageset
│ │ │ ├── Contents.json
│ │ │ └── first.pdf
│ │ └── second.imageset
│ │ │ ├── Contents.json
│ │ │ └── second.pdf
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── CustomTableCell.swift
│ ├── FirstViewController.swift
│ ├── Info.plist
│ └── SecondViewController.swift
├── GraphicsPerformance-StarterTests
│ ├── GraphicsPerformance_StarterTests.swift
│ └── Info.plist
├── GraphicsPerformance-StarterUITests
│ ├── GraphicsPerformance_StarterUITests.swift
│ └── Info.plist
└── README.md
├── KtColor
├── KTColor.xcodeproj
│ └── project.pbxproj
├── KTColor
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── KtColor.swift
│ └── ViewController.swift
├── KTColorTests
│ ├── Info.plist
│ └── KTColorTests.swift
├── KTColorUITests
│ ├── Info.plist
│ └── KTColorUITests.swift
└── README.md
├── KtTableView
├── KtTableView.xcodeproj
│ ├── project.pbxproj
│ └── project.xcworkspace
│ │ └── contents.xcworkspacedata
├── KtTableView.xcworkspace
│ └── contents.xcworkspacedata
├── KtTableView
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── KTMainViewController.h
│ ├── KTMainViewController.m
│ ├── KtBaseModel
│ │ ├── KtBaseItem.h
│ │ ├── KtBaseItem.m
│ │ ├── KtBaseListModel
│ │ │ ├── KtBaseListItem.h
│ │ │ ├── KtBaseListItem.m
│ │ │ ├── KtBaseListModel.h
│ │ │ ├── KtBaseListModel.m
│ │ │ ├── KtRefreshTableViewController.h
│ │ │ └── KtRefreshTableViewController.m
│ │ ├── KtBaseModel.h
│ │ ├── KtBaseModel.m
│ │ ├── KtBaseServerAPI.h
│ │ └── KtBaseServerAPI.m
│ ├── KtBaseTableView.h
│ ├── KtBaseTableView.m
│ ├── KtBaseTableViewCell.h
│ ├── KtBaseTableViewCell.m
│ ├── KtExtension
│ │ ├── NSDictionary+KtExtension.h
│ │ ├── NSDictionary+KtExtension.m
│ │ ├── UIView+KtExtension.h
│ │ └── UIView+KtExtension.m
│ ├── KtMainTableItem.h
│ ├── KtMainTableItem.m
│ ├── KtMainTableModel.h
│ ├── KtMainTableModel.m
│ ├── KtMainTableViewCell.h
│ ├── KtMainTableViewCell.m
│ ├── KtMainTableViewDataSource.h
│ ├── KtMainTableViewDataSource.m
│ ├── KtTableViewBaseItem.h
│ ├── KtTableViewBaseItem.m
│ ├── KtTableViewController.h
│ ├── KtTableViewController.m
│ ├── KtTableViewDataSource.h
│ ├── KtTableViewDataSource.m
│ ├── KtTableViewSectionObject.h
│ ├── KtTableViewSectionObject.m
│ └── main.m
├── KtTableViewTests
│ ├── Info.plist
│ └── KtTableViewTests.m
├── KtTableViewUITests
│ ├── Info.plist
│ └── KtTableViewUITests.m
├── Podfile
├── Podfile.lock
├── Pods
│ ├── AFNetworking
│ │ ├── AFNetworking
│ │ │ ├── AFHTTPSessionManager.h
│ │ │ ├── AFHTTPSessionManager.m
│ │ │ ├── AFNetworkReachabilityManager.h
│ │ │ ├── AFNetworkReachabilityManager.m
│ │ │ ├── AFNetworking.h
│ │ │ ├── AFSecurityPolicy.h
│ │ │ ├── AFSecurityPolicy.m
│ │ │ ├── AFURLRequestSerialization.h
│ │ │ ├── AFURLRequestSerialization.m
│ │ │ ├── AFURLResponseSerialization.h
│ │ │ ├── AFURLResponseSerialization.m
│ │ │ ├── AFURLSessionManager.h
│ │ │ └── AFURLSessionManager.m
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── UIKit+AFNetworking
│ │ │ ├── AFAutoPurgingImageCache.h
│ │ │ ├── AFAutoPurgingImageCache.m
│ │ │ ├── AFImageDownloader.h
│ │ │ ├── AFImageDownloader.m
│ │ │ ├── AFNetworkActivityIndicatorManager.h
│ │ │ ├── AFNetworkActivityIndicatorManager.m
│ │ │ ├── UIActivityIndicatorView+AFNetworking.h
│ │ │ ├── UIActivityIndicatorView+AFNetworking.m
│ │ │ ├── UIButton+AFNetworking.h
│ │ │ ├── UIButton+AFNetworking.m
│ │ │ ├── UIImage+AFNetworking.h
│ │ │ ├── UIImageView+AFNetworking.h
│ │ │ ├── UIImageView+AFNetworking.m
│ │ │ ├── UIKit+AFNetworking.h
│ │ │ ├── UIProgressView+AFNetworking.h
│ │ │ ├── UIProgressView+AFNetworking.m
│ │ │ ├── UIRefreshControl+AFNetworking.h
│ │ │ ├── UIRefreshControl+AFNetworking.m
│ │ │ ├── UIWebView+AFNetworking.h
│ │ │ └── UIWebView+AFNetworking.m
│ ├── Headers
│ │ ├── Private
│ │ │ ├── AFNetworking
│ │ │ │ ├── AFAutoPurgingImageCache.h
│ │ │ │ ├── AFHTTPSessionManager.h
│ │ │ │ ├── AFImageDownloader.h
│ │ │ │ ├── AFNetworkActivityIndicatorManager.h
│ │ │ │ ├── AFNetworkReachabilityManager.h
│ │ │ │ ├── AFNetworking.h
│ │ │ │ ├── AFSecurityPolicy.h
│ │ │ │ ├── AFURLRequestSerialization.h
│ │ │ │ ├── AFURLResponseSerialization.h
│ │ │ │ ├── AFURLSessionManager.h
│ │ │ │ ├── UIActivityIndicatorView+AFNetworking.h
│ │ │ │ ├── UIButton+AFNetworking.h
│ │ │ │ ├── UIImage+AFNetworking.h
│ │ │ │ ├── UIImageView+AFNetworking.h
│ │ │ │ ├── UIKit+AFNetworking.h
│ │ │ │ ├── UIProgressView+AFNetworking.h
│ │ │ │ ├── UIRefreshControl+AFNetworking.h
│ │ │ │ └── UIWebView+AFNetworking.h
│ │ │ └── MJRefresh
│ │ │ │ ├── MJRefresh.h
│ │ │ │ ├── MJRefreshAutoFooter.h
│ │ │ │ ├── MJRefreshAutoGifFooter.h
│ │ │ │ ├── MJRefreshAutoNormalFooter.h
│ │ │ │ ├── MJRefreshAutoStateFooter.h
│ │ │ │ ├── MJRefreshBackFooter.h
│ │ │ │ ├── MJRefreshBackGifFooter.h
│ │ │ │ ├── MJRefreshBackNormalFooter.h
│ │ │ │ ├── MJRefreshBackStateFooter.h
│ │ │ │ ├── MJRefreshComponent.h
│ │ │ │ ├── MJRefreshConst.h
│ │ │ │ ├── MJRefreshFooter.h
│ │ │ │ ├── MJRefreshGifHeader.h
│ │ │ │ ├── MJRefreshHeader.h
│ │ │ │ ├── MJRefreshNormalHeader.h
│ │ │ │ ├── MJRefreshStateHeader.h
│ │ │ │ ├── UIScrollView+MJExtension.h
│ │ │ │ ├── UIScrollView+MJRefresh.h
│ │ │ │ └── UIView+MJExtension.h
│ │ └── Public
│ │ │ ├── AFNetworking
│ │ │ ├── AFAutoPurgingImageCache.h
│ │ │ ├── AFHTTPSessionManager.h
│ │ │ ├── AFImageDownloader.h
│ │ │ ├── AFNetworkActivityIndicatorManager.h
│ │ │ ├── AFNetworkReachabilityManager.h
│ │ │ ├── AFNetworking.h
│ │ │ ├── AFSecurityPolicy.h
│ │ │ ├── AFURLRequestSerialization.h
│ │ │ ├── AFURLResponseSerialization.h
│ │ │ ├── AFURLSessionManager.h
│ │ │ ├── UIActivityIndicatorView+AFNetworking.h
│ │ │ ├── UIButton+AFNetworking.h
│ │ │ ├── UIImage+AFNetworking.h
│ │ │ ├── UIImageView+AFNetworking.h
│ │ │ ├── UIKit+AFNetworking.h
│ │ │ ├── UIProgressView+AFNetworking.h
│ │ │ ├── UIRefreshControl+AFNetworking.h
│ │ │ └── UIWebView+AFNetworking.h
│ │ │ └── MJRefresh
│ │ │ ├── MJRefresh.h
│ │ │ ├── MJRefreshAutoFooter.h
│ │ │ ├── MJRefreshAutoGifFooter.h
│ │ │ ├── MJRefreshAutoNormalFooter.h
│ │ │ ├── MJRefreshAutoStateFooter.h
│ │ │ ├── MJRefreshBackFooter.h
│ │ │ ├── MJRefreshBackGifFooter.h
│ │ │ ├── MJRefreshBackNormalFooter.h
│ │ │ ├── MJRefreshBackStateFooter.h
│ │ │ ├── MJRefreshComponent.h
│ │ │ ├── MJRefreshConst.h
│ │ │ ├── MJRefreshFooter.h
│ │ │ ├── MJRefreshGifHeader.h
│ │ │ ├── MJRefreshHeader.h
│ │ │ ├── MJRefreshNormalHeader.h
│ │ │ ├── MJRefreshStateHeader.h
│ │ │ ├── UIScrollView+MJExtension.h
│ │ │ ├── UIScrollView+MJRefresh.h
│ │ │ └── UIView+MJExtension.h
│ ├── MJRefresh
│ │ ├── LICENSE
│ │ ├── MJRefresh
│ │ │ ├── Base
│ │ │ │ ├── MJRefreshAutoFooter.h
│ │ │ │ ├── MJRefreshAutoFooter.m
│ │ │ │ ├── MJRefreshBackFooter.h
│ │ │ │ ├── MJRefreshBackFooter.m
│ │ │ │ ├── MJRefreshComponent.h
│ │ │ │ ├── MJRefreshComponent.m
│ │ │ │ ├── MJRefreshFooter.h
│ │ │ │ ├── MJRefreshFooter.m
│ │ │ │ ├── MJRefreshHeader.h
│ │ │ │ └── MJRefreshHeader.m
│ │ │ ├── Custom
│ │ │ │ ├── Footer
│ │ │ │ │ ├── Auto
│ │ │ │ │ │ ├── MJRefreshAutoGifFooter.h
│ │ │ │ │ │ ├── MJRefreshAutoGifFooter.m
│ │ │ │ │ │ ├── MJRefreshAutoNormalFooter.h
│ │ │ │ │ │ ├── MJRefreshAutoNormalFooter.m
│ │ │ │ │ │ ├── MJRefreshAutoStateFooter.h
│ │ │ │ │ │ └── MJRefreshAutoStateFooter.m
│ │ │ │ │ └── Back
│ │ │ │ │ │ ├── MJRefreshBackGifFooter.h
│ │ │ │ │ │ ├── MJRefreshBackGifFooter.m
│ │ │ │ │ │ ├── MJRefreshBackNormalFooter.h
│ │ │ │ │ │ ├── MJRefreshBackNormalFooter.m
│ │ │ │ │ │ ├── MJRefreshBackStateFooter.h
│ │ │ │ │ │ └── MJRefreshBackStateFooter.m
│ │ │ │ └── Header
│ │ │ │ │ ├── MJRefreshGifHeader.h
│ │ │ │ │ ├── MJRefreshGifHeader.m
│ │ │ │ │ ├── MJRefreshNormalHeader.h
│ │ │ │ │ ├── MJRefreshNormalHeader.m
│ │ │ │ │ ├── MJRefreshStateHeader.h
│ │ │ │ │ └── MJRefreshStateHeader.m
│ │ │ ├── MJRefresh.bundle
│ │ │ │ └── arrow@2x.png
│ │ │ ├── MJRefresh.h
│ │ │ ├── MJRefreshConst.h
│ │ │ ├── MJRefreshConst.m
│ │ │ ├── UIScrollView+MJExtension.h
│ │ │ ├── UIScrollView+MJExtension.m
│ │ │ ├── UIScrollView+MJRefresh.h
│ │ │ ├── UIScrollView+MJRefresh.m
│ │ │ ├── UIView+MJExtension.h
│ │ │ └── UIView+MJExtension.m
│ │ └── README.md
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ └── project.pbxproj
│ └── Target Support Files
│ │ ├── AFNetworking
│ │ ├── AFNetworking-dummy.m
│ │ ├── AFNetworking-prefix.pch
│ │ └── AFNetworking.xcconfig
│ │ ├── MJRefresh
│ │ ├── MJRefresh-dummy.m
│ │ ├── MJRefresh-prefix.pch
│ │ └── MJRefresh.xcconfig
│ │ └── Pods
│ │ ├── Pods-acknowledgements.markdown
│ │ ├── Pods-acknowledgements.plist
│ │ ├── Pods-dummy.m
│ │ ├── Pods-frameworks.sh
│ │ ├── Pods-resources.sh
│ │ ├── Pods.debug.xcconfig
│ │ └── Pods.release.xcconfig
└── README.md
├── NodeRequireTest
├── .vscode
│ └── launch.json
├── README.md
├── jsconfig.json
├── main
│ └── index.js
├── package.json
└── utils
│ └── utils.js
├── ParallelMap
├── ParallelMap.xcodeproj
│ └── project.pbxproj
├── ParallelMap
│ ├── extension.swift
│ ├── main.swift
│ └── test.swift
└── README.md
├── README.md
├── RunloopAndThread
├── RunloopAndThread.xcodeproj
│ └── project.pbxproj
└── RunloopAndThread
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── NSObject+DeallocBlock.h
│ ├── NSObject+DeallocBlock.m
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── Streamable
├── Streamable.xcodeproj
│ └── project.pbxproj
└── Streamable
│ ├── Debug.swift
│ ├── Print.swift
│ └── main.swift
├── SwiftMysterious
├── README.md
├── SwiftMysterious.xcodeproj
│ └── project.pbxproj
└── SwiftMysterious
│ ├── InlineLazy.swift
│ ├── LoopLabel.swift
│ ├── SpecialLiteral.swift
│ └── main.swift
├── SwiftTips
├── README.md
├── SwiftTips.xcodeproj
│ └── project.pbxproj
└── SwiftTips
│ ├── Breakpoint.swift
│ ├── PrivateSet.swift
│ ├── ReuseIdentifier.swift
│ ├── Semicolon.swift
│ └── main.swift
├── load
├── README.md
├── load.xcodeproj
│ └── project.pbxproj
└── load
│ ├── Child+load.h
│ ├── Child+load.m
│ ├── Child.h
│ ├── Child.m
│ ├── Other.h
│ ├── Other.m
│ ├── Parent.h
│ ├── Parent.m
│ └── main.m
└── runtime
├── README.md
├── runtime.xcodeproj
└── project.pbxproj
└── runtime
├── MethodForwardTest.h
├── MethodForwardTest.m
├── MethodSwizzlingTest.h
├── MethodSwizzlingTest.m
├── NSString+MyImplementation.h
├── NSString+MyImplementation.m
├── Replacement.h
├── Replacement.m
└── main.m
/.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 | .DS_Store
8 | DerivedData
9 |
10 | ## Various settings
11 | *.pbxuser
12 | !default.pbxuser
13 | *.mode1v3
14 | !default.mode1v3
15 | *.mode2v3
16 | !default.mode2v3
17 | *.perspectivev3
18 | !default.perspectivev3
19 | xcuserdata
20 |
21 | ## Other
22 | *.xccheckout
23 | *.moved-aside
24 | *.xcuserstate
25 | *.xcscmblueprint
26 | .xcworkspacedata
27 |
28 | ## Obj-C/Swift specific
29 | *.hmap
30 | *.ipa
31 |
32 | # CocoaPods
33 | #
34 | # We recommend against adding the Pods directory to your .gitignore. However
35 | # you should judge for yourself, the pros and cons are mentioned at:
36 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
37 | #
38 | #Pods/
39 |
40 | # Carthage
41 | #
42 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
43 | # Carthage/Checkouts
44 |
45 | Carthage/Build
46 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/AutolayoutScrollViewInCode/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 | }
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/AutolayoutScrollViewInCode/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/AutolayoutScrollViewInCodeTests/AutolayoutScrollViewInCodeTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AutolayoutScrollViewInCodeTests.swift
3 | // AutolayoutScrollViewInCodeTests
4 | //
5 | // Created by 张星宇 on 15/12/21.
6 | // Copyright © 2015年 张星宇. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import AutolayoutScrollViewInCode
11 |
12 | class AutolayoutScrollViewInCodeTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | // Use XCTAssert and related functions to verify your tests produce the correct results.
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measureBlock {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/AutolayoutScrollViewInCodeTests/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 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/AutolayoutScrollViewInCodeUITests/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 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 | platform :ios, '8.0'
3 | use_frameworks!
4 | pod 'SnapKit', '~> 0.17.0'
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SnapKit (0.17.0)
3 |
4 | DEPENDENCIES:
5 | - SnapKit (~> 0.17.0)
6 |
7 | SPEC CHECKSUMS:
8 | SnapKit: 49fd7b1b3ff58ab4064004036b8afcfddbd3a4bd
9 |
10 | COCOAPODS: 0.39.0
11 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SnapKit (0.17.0)
3 |
4 | DEPENDENCIES:
5 | - SnapKit (~> 0.17.0)
6 |
7 | SPEC CHECKSUMS:
8 | SnapKit: 49fd7b1b3ff58ab4064004036b8afcfddbd3a4bd
9 |
10 | COCOAPODS: 0.39.0
11 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/SnapKit/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/SnapKit/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.
4 |
5 | [](https://travis-ci.org/SnapKit/SnapKit)
6 | [](https://img.shields.io/cocoapods/v/SnapKit.svg)
7 | [](https://github.com/Carthage/Carthage)
8 |
9 | ```swift
10 | import SnapKit
11 |
12 | class MyViewController: UIViewController {
13 |
14 | lazy var box = UIView()
15 |
16 | override func viewDidLoad() {
17 | super.viewDidLoad()
18 |
19 | self.view.addSubview(box)
20 | box.snp_makeConstraints { (make) -> Void in
21 | make.width.height.equalTo(50)
22 | make.center.equalTo(self.view)
23 | }
24 | }
25 |
26 | }
27 | ```
28 |
29 | ## Resources
30 |
31 | * [Documentation](http://snapkit.io/docs/)
32 | * [F.A.Q.](http://snapkit.io/faq/)
33 | * [Legacy Platforms (iOS 7.0, OS X 10.9)](http://snapkit.io/legacy-platforms/)
34 |
35 | ## License
36 |
37 | MIT license. See the `LICENSE` file for details.
38 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/Pods/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## SnapKit
5 |
6 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining a copy
9 | of this software and associated documentation files (the "Software"), to deal
10 | in the Software without restriction, including without limitation the rights
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | copies of the Software, and to permit persons to whom the Software is
13 | furnished to do so, subject to the following conditions:
14 |
15 | The above copyright notice and this permission notice shall be included in
16 | all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 | THE SOFTWARE.
25 |
26 | Generated by CocoaPods - http://cocoapods.org
27 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/Pods/Pods-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods : NSObject
3 | @end
4 | @implementation PodsDummy_Pods
5 | @end
6 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/Pods/Pods-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double PodsVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char PodsVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/Pods/Pods.debug.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/SnapKit.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SnapKit"
6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
8 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/Pods/Pods.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods {
2 | umbrella header "Pods-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/Pods/Pods.release.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/SnapKit.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SnapKit"
6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
8 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/SnapKit/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 0.17.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/SnapKit/SnapKit-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SnapKit : NSObject
3 | @end
4 | @implementation PodsDummy_SnapKit
5 | @end
6 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/SnapKit/SnapKit-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/SnapKit/SnapKit-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double SnapKitVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char SnapKitVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/SnapKit/SnapKit.modulemap:
--------------------------------------------------------------------------------
1 | framework module SnapKit {
2 | umbrella header "SnapKit-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/Pods/Target Support Files/SnapKit/SnapKit.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SnapKit" "${PODS_ROOT}/Headers/Public"
3 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
4 | PODS_ROOT = ${SRCROOT}
5 | SKIP_INSTALL = YES
--------------------------------------------------------------------------------
/AutolayoutScrollViewInCode/README.md:
--------------------------------------------------------------------------------
1 | # Two approaches to use Autolayout in UIScrollView with pure code
2 |
3 | These code shows two ways to use Autolayout in UIScrollView with pure code. One is using container and another is locate subviews according to the position of some other view outside the scrollview.
4 |
5 | I highly recommand you to use container instead of a view outsdie scrollview because it is much more safe and convenient.
6 |
7 | # 纯代码在UIScrollview中使用Autolayout的两种方法
8 |
9 | 主要涉及两种用代码处理autolayout和scrollview的方法。一种是利用container,另一种是通过外部的视图布局。
10 |
11 | 强烈推荐使用container,这种写法远比用外部视图安全、方便
12 |
13 | 详细的教程请参考我的博客:[史上最简单的UIScrollView+Autolayout出坑指南](http://www.jianshu.com/p/f7f1ba67c3ca)
14 |
15 |
--------------------------------------------------------------------------------
/BATInterview/BAT面试指南 PPT.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/BATInterview/BAT面试指南 PPT.pdf
--------------------------------------------------------------------------------
/BATInterview/BAT面试指南.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/BATInterview/BAT面试指南.pdf
--------------------------------------------------------------------------------
/BATInterview/张星宇-东北大学-iOS开发.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/BATInterview/张星宇-东北大学-iOS开发.pdf
--------------------------------------------------------------------------------
/CocoaPodsDemo/BSStaticLibraryOne/BSStaticLibraryOne/BSStaticLibraryOne+Extension.h:
--------------------------------------------------------------------------------
1 | //
2 | // BSStaticLibraryOne+Extension.h
3 | // BSStaticLibraryOne
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import "BSStaticLibraryOne.h"
10 |
11 | @interface BSStaticLibraryOne (Extension)
12 |
13 | - (void)sayOtherThing;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/BSStaticLibraryOne/BSStaticLibraryOne/BSStaticLibraryOne+Extension.m:
--------------------------------------------------------------------------------
1 | //
2 | // BSStaticLibraryOne+Extension.m
3 | // BSStaticLibraryOne
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import "BSStaticLibraryOne+Extension.h"
10 |
11 | @implementation BSStaticLibraryOne (Extension)
12 |
13 | - (void)sayOtherThing {
14 | NSLog(@"In File: BSStaticLibraryOne + Extension");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/BSStaticLibraryOne/BSStaticLibraryOne/BSStaticLibraryOne.h:
--------------------------------------------------------------------------------
1 | //
2 | // BSStaticLibraryOne.h
3 | // BSStaticLibraryOne
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BSStaticLibraryOne : NSObject
12 |
13 | - (void)saySomething;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/BSStaticLibraryOne/BSStaticLibraryOne/BSStaticLibraryOne.m:
--------------------------------------------------------------------------------
1 | //
2 | // BSStaticLibraryOne.m
3 | // BSStaticLibraryOne
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import "BSStaticLibraryOne.h"
10 |
11 | @implementation BSStaticLibraryOne
12 |
13 | - (void)saySomething {
14 | NSLog(@"In Library: BSStaticLibraryOne");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/BSStaticLibraryOne/BSStaticLibraryTwo/BSStaticLibraryTwo.h:
--------------------------------------------------------------------------------
1 | //
2 | // BSStaticLibraryTwo.h
3 | // BSStaticLibraryTwo
4 | //
5 | // Created by 张星宇 on 2017/1/8.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BSStaticLibraryTwo : NSObject
12 |
13 | - (void)saySomething;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/BSStaticLibraryOne/BSStaticLibraryTwo/BSStaticLibraryTwo.m:
--------------------------------------------------------------------------------
1 | //
2 | // BSStaticLibraryTwo.m
3 | // BSStaticLibraryTwo
4 | //
5 | // Created by 张星宇 on 2017/1/8.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import "BSStaticLibraryTwo.h"
10 |
11 | @implementation BSStaticLibraryTwo
12 |
13 | - (void)saySomething {
14 | NSLog(@"In Library: BSStaticLibraryTwo");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/BSStaticLibraryOne/Pod/Pod.h:
--------------------------------------------------------------------------------
1 | //
2 | // Pod.h
3 | // Pod
4 | //
5 | // Created by 张星宇 on 2017/1/8.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface Pod : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/BSStaticLibraryOne/Pod/Pod.m:
--------------------------------------------------------------------------------
1 | //
2 | // Pod.m
3 | // Pod
4 | //
5 | // Created by 张星宇 on 2017/1/8.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import "Pod.h"
10 |
11 | @implementation Pod
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/OtherLinkerFlag/OtherLinkerFlag/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OtherLinkerFlag
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. 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 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/OtherLinkerFlag/OtherLinkerFlag/BSStaticLibraryOne+Extension.h:
--------------------------------------------------------------------------------
1 | //
2 | // BSStaticLibraryOne+Extension.h
3 | // BSStaticLibraryOne
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import "BSStaticLibraryOne.h"
10 |
11 | @interface BSStaticLibraryOne (Extension)
12 |
13 | - (void)sayOtherThing;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/OtherLinkerFlag/OtherLinkerFlag/BSStaticLibraryOne.h:
--------------------------------------------------------------------------------
1 | //
2 | // BSStaticLibraryOne.h
3 | // BSStaticLibraryOne
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BSStaticLibraryOne : NSObject
12 |
13 | - (void)saySomething;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/OtherLinkerFlag/OtherLinkerFlag/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OtherLinkerFlag
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "BSStaticLibraryOne.h"
11 | #import "BSStaticLibraryOne+Extension.h"
12 |
13 | @interface ViewController : UIViewController
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/OtherLinkerFlag/OtherLinkerFlag/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // OtherLinkerFlag
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "BSStaticLibraryOne.h"
11 | #import "BSStaticLibraryOne+Extension.h"
12 |
13 | @interface ViewController ()
14 |
15 | @end
16 |
17 | @implementation ViewController
18 |
19 | - (void)viewDidLoad {
20 | [super viewDidLoad];
21 | [[[BSStaticLibraryOne alloc] init] sayOtherThing];
22 | // Do any additional setup after loading the view, typically from a nib.
23 | }
24 |
25 |
26 | - (void)didReceiveMemoryWarning {
27 | [super didReceiveMemoryWarning];
28 | // Dispose of any resources that can be recreated.
29 | }
30 |
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/OtherLinkerFlag/OtherLinkerFlag/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OtherLinkerFlag
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. 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 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/ShellProject.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/ShellProject.xcworkspace/xcuserdata/zxy.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/CocoaPodsDemo/ShellProject.xcworkspace/xcuserdata/zxy.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/CocoaPodsDemo/ShellProject/ShellProject/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // ShellProject
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. 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 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/ShellProject/ShellProject/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // ShellProject
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/ShellProject/ShellProject/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // ShellProject
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import
11 | #import
12 | #import
13 |
14 | @interface ViewController ()
15 |
16 | @end
17 |
18 | @implementation ViewController
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 | [[[BSStaticLibraryOne alloc] init] saySomething];
23 | [[[BSStaticLibraryTwo alloc] init] saySomething];
24 | // Do any additional setup after loading the view, typically from a nib.
25 | }
26 |
27 |
28 | - (void)didReceiveMemoryWarning {
29 | [super didReceiveMemoryWarning];
30 | // Dispose of any resources that can be recreated.
31 | }
32 |
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/CocoaPodsDemo/ShellProject/ShellProject/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ShellProject
4 | //
5 | // Created by 张星宇 on 2017/1/7.
6 | // Copyright © 2017年 bestswifter. 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 |
--------------------------------------------------------------------------------
/CornerRadius/CornerRadius/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 | }
--------------------------------------------------------------------------------
/CornerRadius/CornerRadius/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/CornerRadius/CornerRadius/Assets.xcassets/photo.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "photo.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 | }
--------------------------------------------------------------------------------
/CornerRadius/CornerRadius/Assets.xcassets/photo.imageset/photo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/CornerRadius/CornerRadius/Assets.xcassets/photo.imageset/photo.png
--------------------------------------------------------------------------------
/CornerRadius/CornerRadius/CornerRadius-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 | #import "UIImage+ImageRoundedCorner.h"
--------------------------------------------------------------------------------
/CornerRadius/CornerRadius/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/CornerRadius/CornerRadius/UIImage+ImageRoundedCorner.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+ImageRoundedCorner.h
3 | // CornerRadius
4 | //
5 | // Created by 张星宇 on 16/3/3.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UIImage (ImageRoundedCorner)
12 |
13 | - (UIImage*)imageAddCornerWithRadius:(CGFloat)radius andSize:(CGSize)size;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CornerRadius/CornerRadius/UIImage+ImageRoundedCorner.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+ImageRoundedCorner.m
3 | // CornerRadius
4 | //
5 | // Created by 张星宇 on 16/3/3.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "UIImage+ImageRoundedCorner.h"
10 |
11 | @implementation UIImage (ImageRoundedCorner)
12 |
13 | - (UIImage*)imageAddCornerWithRadius:(CGFloat)radius andSize:(CGSize)size{
14 | CGRect rect = CGRectMake(0, 0, size.width, size.height);
15 |
16 | UIGraphicsBeginImageContextWithOptions(size, NO, [UIScreen mainScreen].scale);
17 | CGContextRef ctx = UIGraphicsGetCurrentContext();
18 | UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(radius, radius)];
19 | CGContextAddPath(ctx,path.CGPath);
20 | CGContextClip(ctx);
21 | [self drawInRect:rect];
22 | CGContextDrawPath(ctx, kCGPathFillStroke);
23 | UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext();
24 | UIGraphicsEndImageContext();
25 | return newImage;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/CornerRadius/CornerRadiusTests/CornerRadiusTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CornerRadiusTests.swift
3 | // CornerRadiusTests
4 | //
5 | // Created by 张星宇 on 16/2/27.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import CornerRadius
11 |
12 | class CornerRadiusTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | // Use XCTAssert and related functions to verify your tests produce the correct results.
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measureBlock {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/CornerRadius/CornerRadiusTests/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 |
--------------------------------------------------------------------------------
/CornerRadius/CornerRadiusUITests/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 |
--------------------------------------------------------------------------------
/CornerRadius/README.md:
--------------------------------------------------------------------------------
1 | # CornerRadius
2 |
3 | 这是我的博客中:[iOS高效添加圆角效果实战讲解](http://www.jianshu.com/p/f970872fdc22)一文的 demo,据说配合着代码看博客效果更佳!
4 |
5 | ## 2016.2.28 A
6 |
7 | 不存在 iOS9 优化,只是圆角不够多,还没有影响性能。一旦超过某个临界值(iPhone6 上估计是 20多)就会大幅度降低 fps。
8 |
9 | 如果 `UIImageView` 的 width 和 height 相同,在某些情况下(可能是图片带有 alpha 通道),系统可能会自动优化,这时候就不会出现离屏渲染。
10 |
11 | ## 2016.2.27 Q
12 | 参考了这篇文章:[小心别让圆角成了你列表的帧数杀手](http://www.cocoachina.com/ios/20150803/12873.html)
13 |
14 | 都说 `cornerRadius` + `masksToBounds` 会导致离屏渲染,从而大幅度降低 `UITabelView` 滑动时的性能。
15 |
16 | 我做了一个 demo,在 cell 中放了四个 UIImageView,令我惊讶的是,使用不同的图片可能会导致不同的结果。有些图片设置圆角会导致离屏渲染,有些则不会。即使四个图片都导致了离屏渲染,也并没有看到滑动时帧数的下降。
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/AAPLAppDelegate.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The application delegate.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLAppDelegate : UIResponder
12 |
13 | @property (nonatomic, strong) UIWindow *window;
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/AAPLAppDelegate.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The application delegate.
7 | */
8 |
9 | #import "AAPLAppDelegate.h"
10 |
11 | @implementation AAPLAppDelegate
12 |
13 | //| ----------------------------------------------------------------------------
14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
15 | {
16 | // Override point for customization after application launch.
17 | return YES;
18 | }
19 |
20 |
21 | //| ----------------------------------------------------------------------------
22 | #ifdef __IPHONE_9_0
23 | - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
24 | #else
25 | - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
26 | #endif
27 | {
28 | if ([UIDevice currentDevice].systemVersion.floatValue < 8.f)
29 | return UIInterfaceOrientationMaskPortrait;
30 | else
31 | return UIInterfaceOrientationMaskAll;
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/AAPLExternalStoryboardSegue.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | A custom storyboard segue that loads its destination view controller from an
7 | external storyboard (named by the segue's identifier), then presents it
8 | modally.
9 | */
10 |
11 | @import UIKit;
12 |
13 | @interface AAPLExternalStoryboardSegue : UIStoryboardSegue
14 | @end
15 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/AAPLMenuViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | Displays the list of examples.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLMenuViewController : UITableViewController
12 | @end
13 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Adaptive Presentation/AAPLAdaptivePresentationController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | */
6 |
7 | @import UIKit;
8 |
9 | @interface AAPLAdaptivePresentationController : UIPresentationController
10 | @end
11 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Adaptive Presentation/AAPLAdaptivePresentationFirstViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The initial view controller for the Adaptive Presentation demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLAdaptivePresentationFirstViewController : UIViewController
12 | @end
13 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Adaptive Presentation/AAPLAdaptivePresentationFirstViewController.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The initial view controller for the Adaptive Presentation demo.
7 | */
8 |
9 | #import "AAPLAdaptivePresentationFirstViewController.h"
10 |
11 | @implementation AAPLAdaptivePresentationFirstViewController
12 |
13 | #pragma mark -
14 | #pragma mark Unwind Actions
15 |
16 | //| ----------------------------------------------------------------------------
17 | //! Action for unwinding from AAPLAdaptivePresentationSecondViewController.
18 | //
19 | - (IBAction)unwindToAdaptivePresentationFirstViewController:(UIStoryboardSegue *)sender
20 | { }
21 |
22 | @end
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Adaptive Presentation/AAPLAdaptivePresentationSecondViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The second view controller for the Adaptive Presentation demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLAdaptivePresentationSecondViewController : UIViewController
12 | @end
13 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Adaptive Presentation/AAPLAdaptivePresentationSegue.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | */
6 |
7 | @import UIKit;
8 |
9 | @interface AAPLAdaptivePresentationSegue : UIStoryboardSegue
10 | @end
11 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Checkerboard/AAPLCheckerboardFirstViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The initial view controller for the Checkerboard demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLCheckerboardFirstViewController : UIViewController
12 | @end
13 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Checkerboard/AAPLCheckerboardTransitionAnimator.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | A transition animator that transitions between two view controllers in
7 | a navigation stack, using a 3D checkerboard effect.
8 | */
9 |
10 | @import UIKit;
11 |
12 | @interface AAPLCheckerboardTransitionAnimator : NSObject
13 | @end
14 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Cross Dissolve/AAPLCrossDissolveFirstViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The initial view controller for the Cross Dissolve demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLCrossDissolveFirstViewController : UIViewController
12 | @end
13 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Cross Dissolve/AAPLCrossDissolveSecondViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The presented view controller for the Cross Dissolve demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLCrossDissolveSecondViewController : UIViewController
12 | @end
13 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Cross Dissolve/AAPLCrossDissolveSecondViewController.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The presented view controller for the Cross Dissolve demo.
7 | */
8 |
9 | #import "AAPLCrossDissolveSecondViewController.h"
10 |
11 | @implementation AAPLCrossDissolveSecondViewController
12 |
13 | //| ----------------------------------------------------------------------------
14 | - (IBAction)dismissAction:(id)sender
15 | {
16 | // For the sake of example, this demo implements the presentation and
17 | // dismissal logic completely in code. Take a look at the later demos
18 | // to learn how to integrate custom transitions with segues.
19 | [self dismissViewControllerAnimated:YES completion:NULL];
20 | }
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Cross Dissolve/AAPLCrossDissolveTransitionAnimator.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | A transition animator that performs a cross dissolve transition between
7 | two view controllers.
8 | */
9 |
10 | @import UIKit;
11 |
12 | @interface AAPLCrossDissolveTransitionAnimator : NSObject
13 | @end
14 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Custom Presentation/AAPLCustomPresentationController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | A custom presentation controller which slides the presenting view controller
7 | upwards to reveal the presented view controller.
8 | */
9 |
10 | @import UIKit;
11 |
12 | @interface AAPLCustomPresentationController : UIPresentationController
13 | @end
14 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Custom Presentation/AAPLCustomPresentationFirstViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The initial view controller for the Custom Presentation demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLCustomPresentationFirstViewController : UIViewController
12 | @end
13 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Custom Presentation/AAPLCustomPresentationSecondViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The second view controller for the Custom Presentation demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLCustomPresentationSecondViewController : UIViewController
12 | @end
13 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Images.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 | }
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Images.xcassets/CloseButton.imageset/CloseButton.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/CustomTransition/CustomTransition-OC/CustomTransitions/Images.xcassets/CloseButton.imageset/CloseButton.pdf
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Images.xcassets/CloseButton.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "CloseButton.pdf"
6 | }
7 | ],
8 | "info" : {
9 | "version" : 1,
10 | "author" : "xcode",
11 | "template-rendering-intent" : "original"
12 | }
13 | }
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "extent" : "full-screen",
14 | "minimum-system-version" : "7.0",
15 | "subtype" : "retina4",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Slide/AAPLSlideTransitionAnimator.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | A transition animator that transitions between two view controllers in
7 | a tab bar controller by sliding both view controllers in a given
8 | direction.
9 | */
10 |
11 | @import UIKit;
12 |
13 | @interface AAPLSlideTransitionAnimator : NSObject
14 |
15 | - (instancetype)initWithTargetEdge:(UIRectEdge)targetEdge;
16 |
17 | //! The value for this property determines which direction the view controllers
18 | //! slide during the transition. This must be one of UIRectEdgeLeft or
19 | //! UIRectEdgeRight.
20 | @property (nonatomic, readwrite) UIRectEdge targetEdge;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Slide/AAPLSlideTransitionDelegate.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The delegate of the tab bar controller for the Slide demo. Manages the
7 | gesture recognizer used for the interactive transition. Vends
8 | instances of AAPLSlideTransitionAnimator and
9 | AAPLSlideTransitionInteractionController.
10 | */
11 |
12 | @import UIKit;
13 |
14 | @interface AAPLSlideTransitionDelegate : NSObject
15 |
16 | //! The UITabBarController instance for which this object is the delegate of.
17 | @property (nonatomic, weak) IBOutlet UITabBarController *tabBarController;
18 |
19 | //! The gesture recognizer used for driving the interactive transition
20 | //! between view controllers. AAPLSlideTransitionDelegate installs this
21 | //! gesture recognizer on the tab bar controller's view.
22 | @property (nonatomic, strong, readonly) UIPanGestureRecognizer *panGestureRecongizer;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Slide/AAPLSlideTransitionInteractionController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The interaction controller for the Slide demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLSlideTransitionInteractionController : UIPercentDrivenInteractiveTransition
12 |
13 | - (instancetype)initWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer NS_DESIGNATED_INITIALIZER;
14 |
15 | - (instancetype)init NS_UNAVAILABLE;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Swipe/AAPLSwipeFirstViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The initial view controller for the Swipe demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLSwipeFirstViewController : UIViewController
12 | @end
13 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Swipe/AAPLSwipeSecondViewController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The presented view controller for the Swipe demo.
7 | */
8 |
9 | @import UIKit;
10 |
11 | @interface AAPLSwipeSecondViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Swipe/AAPLSwipeTransitionAnimator.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | A transition animator that slides the incoming view controller over the
7 | presenting view controller.
8 | */
9 |
10 | @import UIKit;
11 |
12 | @interface AAPLSwipeTransitionAnimator : NSObject
13 |
14 | - (instancetype)initWithTargetEdge:(UIRectEdge)targetEdge;
15 |
16 | @property (nonatomic, readwrite) UIRectEdge targetEdge;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Swipe/AAPLSwipeTransitionDelegate.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The transition delegate for the Swipe demo. Vends instances of
7 | AAPLSwipeTransitionAnimator and optionally
8 | AAPLSwipeTransitionInteractionController.
9 | */
10 |
11 | @import UIKit;
12 |
13 | @interface AAPLSwipeTransitionDelegate : NSObject
14 |
15 | //! If this transition will be interactive, this property is set to the
16 | //! gesture recognizer which will drive the interactivity.
17 | @property (nonatomic, strong) UIScreenEdgePanGestureRecognizer *gestureRecognizer;
18 |
19 | @property (nonatomic, readwrite) UIRectEdge targetEdge;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/Swipe/AAPLSwipeTransitionInteractionController.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The interaction controller for the Swipe demo. Tracks a UIScreenEdgePanGestureRecognizer
7 | from a specified screen edge and derives the completion percentage for the
8 | transition.
9 | */
10 |
11 | @import UIKit;
12 |
13 | @interface AAPLSwipeTransitionInteractionController : UIPercentDrivenInteractiveTransition
14 |
15 | - (instancetype)initWithGestureRecognizer:(UIScreenEdgePanGestureRecognizer*)gestureRecognizer edgeForDragging:(UIRectEdge)edge NS_DESIGNATED_INITIALIZER;
16 |
17 | - (instancetype)init NS_UNAVAILABLE;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-OC/CustomTransitions/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2016 Apple Inc. All Rights Reserved.
3 | See LICENSE.txt for this sample’s licensing information
4 |
5 | Abstract:
6 | The main file.
7 | */
8 |
9 | #import
10 | #import "AAPLAppDelegate.h"
11 |
12 | int main(int argc, char * argv[])
13 | {
14 | @autoreleasepool {
15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AAPLAppDelegate class]));
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/CustomTransition-Swift/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 | }
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/CustomTransition-Swift/UIViewShortHand.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewShortHand.swift
3 | // CustomTransition-Swift
4 | //
5 | // Created by 张星宇 on 16/2/8.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 |
12 | extension CollectionType where Generator.Element == Int {
13 | public var color: UIColor {
14 | guard self.count == 3 else { fatalError("You should specify R,G,B values with 3 integers") }
15 | let r = CGFloat(self[startIndex]) / CGFloat(255)
16 | let g = CGFloat(self[startIndex.advancedBy(1)]) / CGFloat(255)
17 | let b = CGFloat(self[startIndex.advancedBy(2)]) / CGFloat(255)
18 | return UIColor(red: r, green: g, blue: b, alpha: 1.0)
19 | }
20 | }
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/CustomTransition-SwiftTests/CustomTransition_SwiftTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CustomTransition_SwiftTests.swift
3 | // CustomTransition-SwiftTests
4 | //
5 | // Created by 张星宇 on 16/2/7.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import CustomTransition_Swift
11 |
12 | class CustomTransition_SwiftTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | // Use XCTAssert and related functions to verify your tests produce the correct results.
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measureBlock {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/CustomTransition-SwiftTests/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 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/CustomTransition-SwiftUITests/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 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 | platform :ios, '8.0'
3 | use_frameworks!
4 | pod 'SnapKit'
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SnapKit (0.18.0)
3 |
4 | DEPENDENCIES:
5 | - SnapKit
6 |
7 | SPEC CHECKSUMS:
8 | SnapKit: e1f090a6d47b1dd4bd89b73f72b6746a7835ef3c
9 |
10 | COCOAPODS: 0.39.0
11 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - SnapKit (0.18.0)
3 |
4 | DEPENDENCIES:
5 | - SnapKit
6 |
7 | SPEC CHECKSUMS:
8 | SnapKit: e1f090a6d47b1dd4bd89b73f72b6746a7835ef3c
9 |
10 | COCOAPODS: 0.39.0
11 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/SnapKit/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/SnapKit/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.
4 |
5 | [](https://travis-ci.org/SnapKit/SnapKit)
6 | [](https://img.shields.io/cocoapods/v/SnapKit.svg)
7 | [](https://github.com/Carthage/Carthage)
8 |
9 | ```swift
10 | import SnapKit
11 |
12 | class MyViewController: UIViewController {
13 |
14 | lazy var box = UIView()
15 |
16 | override func viewDidLoad() {
17 | super.viewDidLoad()
18 |
19 | self.view.addSubview(box)
20 | box.snp_makeConstraints { (make) -> Void in
21 | make.width.height.equalTo(50)
22 | make.center.equalTo(self.view)
23 | }
24 | }
25 |
26 | }
27 | ```
28 |
29 | ## Resources
30 |
31 | * [Documentation](http://snapkit.io/docs/)
32 | * [F.A.Q.](http://snapkit.io/faq/)
33 | * [Legacy Platforms (iOS 7.0, OS X 10.9)](http://snapkit.io/legacy-platforms/)
34 |
35 | ## License
36 |
37 | MIT license. See the `LICENSE` file for details.
38 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/Pods/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/Pods/Pods-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods : NSObject
3 | @end
4 | @implementation PodsDummy_Pods
5 | @end
6 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/Pods/Pods-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double PodsVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char PodsVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/Pods/Pods.debug.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/SnapKit.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SnapKit"
6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
8 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/Pods/Pods.modulemap:
--------------------------------------------------------------------------------
1 | framework module Pods {
2 | umbrella header "Pods-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/Pods/Pods.release.xcconfig:
--------------------------------------------------------------------------------
1 | EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
4 | OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/SnapKit.framework/Headers"
5 | OTHER_LDFLAGS = $(inherited) -framework "SnapKit"
6 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
7 | PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods
8 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/SnapKit/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 0.18.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${CURRENT_PROJECT_VERSION}
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/SnapKit/SnapKit-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_SnapKit : NSObject
3 | @end
4 | @implementation PodsDummy_SnapKit
5 | @end
6 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/SnapKit/SnapKit-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/SnapKit/SnapKit-umbrella.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | FOUNDATION_EXPORT double SnapKitVersionNumber;
5 | FOUNDATION_EXPORT const unsigned char SnapKitVersionString[];
6 |
7 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/SnapKit/SnapKit.modulemap:
--------------------------------------------------------------------------------
1 | framework module SnapKit {
2 | umbrella header "SnapKit-umbrella.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/Pods/Target Support Files/SnapKit/SnapKit.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SnapKit" "${PODS_ROOT}/Headers/Public"
3 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
4 | PODS_ROOT = ${SRCROOT}
5 | SKIP_INSTALL = YES
--------------------------------------------------------------------------------
/CustomTransition/CustomTransition-Swift/README.md:
--------------------------------------------------------------------------------
1 | # 自定义转场动画
2 |
3 | 这是我为[iOS自定义转场动画实战讲解](http://www.jianshu.com/p/ea0132738057)提供的demo,使用Swift和Snapkit。
4 |
5 | 如果您使用的是OC和Storyboard,可以参考[这个demo](https://github.com/bestswifter/MySampleCode/tree/master/CustomTransition/CustomTransition-OC)
6 |
7 | demo效果如下:
8 |
9 | 
10 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCEmployee.h:
--------------------------------------------------------------------------------
1 | //
2 | // EOCEmployee.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "EOCPerson.h"
11 |
12 | typedef NS_ENUM(NSUInteger, EOCEmployeeType) {
13 | EOCEmployeeTypeDeveloper,
14 | EOCEmployeeTypeDesigner,
15 | EOCEmployeeTypeFinance,
16 | };
17 |
18 | @interface EOCEmployee : NSObject
19 |
20 | - (void) addEmployee:(EOCPerson *)person;
21 | - (void) doSomeWork;
22 |
23 | + (EOCEmployee *)employeeWithType:(EOCEmployeeType)type;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCEmployee.m:
--------------------------------------------------------------------------------
1 | //
2 | // EOCEmployee.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCEmployee.h"
10 | #import "EOCEmployeeDeveloper.h"
11 | #import "EOCEmployeeFinance.h"
12 | #import "EOCEmployeeDesigner.h"
13 |
14 | int EOCConst = 1;
15 |
16 | @implementation EOCEmployee
17 |
18 | - (void)addEmployee:(EOCPerson *)person {
19 | return;
20 | }
21 |
22 | - (void)doSomeWork {
23 | return;
24 | }
25 |
26 | + (EOCEmployee *)employeeWithType:(EOCEmployeeType)type {
27 | switch (type) {
28 | case EOCEmployeeTypeDeveloper:
29 | return [EOCEmployeeDeveloper new];
30 | break;
31 | case EOCEmployeeTypeFinance:
32 | return [EOCEmployeeFinance new];
33 | break;
34 | case EOCEmployeeTypeDesigner:
35 | return [EOCEmployeeDesigner new];
36 | break;
37 | }
38 | }
39 |
40 | - (instancetype)copyWithZone:(NSZone *)zone {
41 | return [[EOCEmployee allocWithZone:zone] init];
42 | }
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCEmployeeDesigner.h:
--------------------------------------------------------------------------------
1 | //
2 | // EOCEmployeeDesigner.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/25.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCEmployee.h"
10 |
11 | @interface EOCEmployeeDesigner : EOCEmployee
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCEmployeeDesigner.m:
--------------------------------------------------------------------------------
1 | //
2 | // EOCEmployeeDesigner.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/25.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCEmployeeDesigner.h"
10 |
11 | @implementation EOCEmployeeDesigner
12 |
13 | - (void)doSomeWork {
14 | NSLog(@"EOCEmployeeDesigner do some work");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCEmployeeDeveloper.h:
--------------------------------------------------------------------------------
1 | //
2 | // EOCEmployeeDeveloper.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/25.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCEmployee.h"
10 |
11 | @interface EOCEmployeeDeveloper : EOCEmployee
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCEmployeeDeveloper.m:
--------------------------------------------------------------------------------
1 | //
2 | // EOCEmployeeDeveloper.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/25.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCEmployeeDeveloper.h"
10 |
11 | @implementation EOCEmployeeDeveloper
12 |
13 | - (void)doSomeWork {
14 | NSLog(@"EOCEmployeeDeveloper do some work");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCEmployeeFinance.h:
--------------------------------------------------------------------------------
1 | //
2 | // EOCEmployeeFinance.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/25.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCEmployee.h"
10 |
11 | @interface EOCEmployeeFinance : EOCEmployee
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCEmployeeFinance.m:
--------------------------------------------------------------------------------
1 | //
2 | // EOCEmployeeFinance.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/25.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCEmployeeFinance.h"
10 |
11 | @implementation EOCEmployeeFinance
12 |
13 | - (void)doSomeWork {
14 | NSLog(@"EOCEmployeeFinance do some work");
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCErrors.h:
--------------------------------------------------------------------------------
1 | //
2 | // EOCErrors.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/27.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface EOCErrors : NSObject
12 |
13 | extern NSString *const EOCErrorDomain;
14 |
15 | typedef NS_ENUM(NSUInteger, EOCError) {
16 | EOCErrorUnkonwn = -1,
17 | EOCErrorInternalInconsistency = 100,
18 | EOCErrorGeneralFault = 105,
19 | EOCErrorBadInput = 500,
20 | };
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCErrors.m:
--------------------------------------------------------------------------------
1 | //
2 | // EOCErrors.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/27.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCErrors.h"
10 |
11 | NSString *const EOCErrorDomain = @"EOCErrorDomain";
12 |
13 | @implementation EOCErrors
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCPerson.h:
--------------------------------------------------------------------------------
1 | //
2 | // EOCPerson.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | // 引入这行代码会导致两个头文件互相引用
11 | //#import "EOCEmployer.h"
12 | @class EOCEmployee;
13 |
14 | // 不要在头文件中使用 static,否则会变成全局变量,放在实现文件里面即可
15 | static const int ANIMATION_DURATION = 1;
16 | static int ANOTHER_DURATION = 2;
17 | static void * const EOCMyKey = @"EOCMyKey";
18 |
19 | FOUNDATION_EXPORT NSString *const EOCStringConstant;
20 |
21 | @interface EOCPerson : NSObject
22 |
23 | @property (nonatomic, copy) NSString *firstName;
24 | @property (nonatomic, copy) NSString *lastName;
25 | @property (nonatomic, strong) EOCEmployee *employee;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCSmithPerson.h:
--------------------------------------------------------------------------------
1 | //
2 | // EOCSmithPerson.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCPerson.h"
10 |
11 | @interface EOCSmithPerson : EOCPerson
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/EOCSmithPerson.m:
--------------------------------------------------------------------------------
1 | //
2 | // EOCSmithPerson.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCSmithPerson.h"
10 | #import "EOCErrors.h"
11 |
12 | @implementation EOCSmithPerson
13 |
14 | @synthesize lastName = _lastName;
15 |
16 | - (void)setLastName:(NSString *)lastName {
17 | if (![lastName isEqualToString:@"Smith"]) {
18 | // 会执行到这段代码
19 | // [NSException raise:NSInvalidArgumentException format:@"Last name must be Smith"];
20 | }
21 |
22 | _lastName = lastName;
23 | }
24 |
25 | - (bool) doSomething:(NSError **)error {
26 | if (![self.firstName isEqualToString:@""]) {
27 | if (error) {
28 | *error = [NSError errorWithDomain:EOCErrorDomain
29 | code:EOCErrorUnkonwn
30 | userInfo:nil];
31 | }
32 | return NO;
33 | }
34 | else {
35 | return YES;
36 | }
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/Enum.h:
--------------------------------------------------------------------------------
1 | //
2 | // Enum.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface Enum : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/Enum.m:
--------------------------------------------------------------------------------
1 | //
2 | // Enum.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "Enum.h"
10 |
11 | @implementation Enum
12 |
13 | // 可以声明枚举变量的类型
14 | enum EOCConnectionState: NSInteger {
15 | ECOConnectStateDisconnected = 1, // 不指定值的时候默认是 0,然后下面的依次递增
16 | ECOConnectStateConnecting = 2,
17 | ECOConnectStateConnected = 3
18 | };
19 |
20 | // 常规写法
21 | enum EOCConnectionState state = ECOConnectStateConnected;
22 |
23 | // 用了 typedef 简化语法
24 | typedef enum EOCConnectionState EOCConnectionState;
25 | EOCConnectionState state2 = ECOConnectStateConnecting;
26 |
27 | // 使用 NS_ENUM 宏
28 | typedef NS_ENUM(NSInteger, EOCEnumType) {
29 | EOCEnumTypeA,
30 | EOCEnumTypeB,
31 | EOCEnumTypeC
32 | };
33 |
34 | EOCEnumType type = EOCEnumTypeA;
35 |
36 | // 使用 NS_OPTION 宏
37 | typedef NS_ENUM(NSInteger, EOCOptionType) {
38 | EOCOptionTypeA,
39 | EOCOptionTypeB,
40 | EOCOptionTypeC
41 | };
42 |
43 | EOCOptionType option = EOCOptionTypeA;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/HashTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // HashTest.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/25.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "EOCPerson.h"
10 |
11 | @interface HashTest : EOCPerson
12 |
13 | - (void)testMutableCollection;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/HashTest.m:
--------------------------------------------------------------------------------
1 | //
2 | // HashTest.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/25.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "HashTest.h"
10 | #import "EOCPerson.h"
11 |
12 | @implementation HashTest
13 |
14 | - (instancetype)init
15 | {
16 | self = [super init];
17 | if (self) {
18 | EOCPerson *person1 = [[EOCPerson alloc] init];
19 | EOCPerson *person2 = [[EOCPerson alloc] init];
20 | NSLog(@"person1.hashValue = %lu", (unsigned long)[person1 hash]);
21 | NSLog(@"person2.hashValue = %lu", (unsigned long)[person2 hash]);
22 |
23 | if ([person1 isEqual:person2]) {
24 | NSLog(@"Person1 and Person2 is the same");
25 | }
26 | else {
27 | NSLog(@"Person1 and Person2 is not the same");
28 | }
29 | }
30 | return self;
31 | }
32 |
33 | - (void)testMutableCollection {
34 | NSMutableSet *set = [NSMutableSet new];
35 |
36 | NSMutableArray *arrayA = [@[@1, @2] mutableCopy];
37 | [set addObject:arrayA];
38 |
39 | NSMutableArray *arrayB = [@[@1, @2] mutableCopy];
40 | [set addObject:arrayB];
41 |
42 | NSMutableArray *arrayC = [@[@1] mutableCopy];
43 | [set addObject:arrayC];
44 |
45 | [arrayC addObject:@2];
46 | NSLog(@"set = %@", set);
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/Literal.h:
--------------------------------------------------------------------------------
1 | //
2 | // Literal.h
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface Literal : NSObject
12 |
13 | @property (nonatomic, strong) NSArray *animals;
14 | @property (nonatomic, strong) NSDictionary *personData;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/Literal.m:
--------------------------------------------------------------------------------
1 | //
2 | // Literal.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "Literal.h"
10 | #import "EOCPerson.h"
11 |
12 | @implementation Literal
13 |
14 | - (instancetype)init
15 | {
16 | self = [super init];
17 | if (self) {
18 | EOCPerson *p = nil;
19 | // 如果有变量为 nil,使用字面量语法会导致运行时崩溃
20 | // self.animals = @[@"dog", @"cat", p, @"mouse"];
21 | self.animals = [NSArray arrayWithObjects:@"dog", @"cat", p, @"mouse", nil];
22 |
23 | // 直接写 nil 会导致编译错误,需要注意变量为 nil 的情况
24 | // self.animals = @[@"dog", @"cat", p, @"mouse"];
25 |
26 | // 字典与数组同理
27 | self.personData = [NSDictionary dictionaryWithObjectsAndKeys:@"Matt", @"firstName",
28 | p, @"person",
29 | @"Galloway", @"lastName",nil];
30 | // self.personData = @{@"Matt" : @"firstName",
31 | // p : @"person",
32 | // @"Galloway" : @"lastName"};
33 | NSLog(@"%d, %d, %@", ANIMATION_DURATION, ANOTHER_DURATION, EOCStringConstant);
34 | }
35 | return self;
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/Effective OC/EffectiveObjectiveC/EffectiveObjectiveC/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // EffectiveObjectiveC
4 | //
5 | // Created by 张星宇 on 16/3/24.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | #import "Literal.h"
13 | #import "EOCPerson.h"
14 | #import "EOCSmithPerson.h"
15 | #import "HashTest.h"
16 | #import "EOCEmployee.h"
17 |
18 | int main(int argc, const char * argv[]) {
19 | @autoreleasepool {
20 | Literal *l = [[Literal alloc] init];
21 | NSLog(@"%@\n%@", l.animals, l.personData);
22 |
23 | EOCSmithPerson *smith = [[EOCSmithPerson alloc] init];
24 | NSLog(@"%@", smith.lastName);
25 |
26 | HashTest *test = [[HashTest alloc] init];
27 | [test testMutableCollection];
28 |
29 | EOCEmployee *employee = [EOCEmployee employeeWithType:EOCEmployeeTypeDeveloper];
30 | [employee doSomeWork];
31 | NSLog(@"%@ member of", [employee isMemberOfClass:[EOCEmployee class]] ? @"is " : @"not");
32 | NSLog(@"%@ kind of", [employee isKindOfClass:[EOCEmployee class]] ? @"is" : @"not");
33 |
34 | EOCPerson *person = [[EOCPerson alloc] init];
35 | NSLog(@"associated string = %@", objc_getAssociatedObject(person, EOCMyKey));
36 | NSLog(@"person = %@", person);
37 |
38 | }
39 | return 0;
40 | }
41 |
--------------------------------------------------------------------------------
/Enum/Enum/Enum-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 | #import "OCEnum.h"
--------------------------------------------------------------------------------
/Enum/Enum/OCEnum.h:
--------------------------------------------------------------------------------
1 | //
2 | // OCEnum.m
3 | // Enum
4 | //
5 | // Created by 张星宇 on 16/1/12.
6 | // Copyright © 2016年 张星宇. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef NS_ENUM(NSInteger, MyEnum) {
12 | //以下是枚举成员
13 | ValueA = 1, // 如果不写值,默认为1,这是枚举的原始值
14 | ValueB, // 默认是ValueA的值加1
15 | ValueC, // 默认是ValueB的值加1,以此类推
16 | ValueD
17 | };
--------------------------------------------------------------------------------
/Enum/Enum/main.swift:
--------------------------------------------------------------------------------
1 | //
2 | // main.swift
3 | // Enum
4 | //
5 | // Created by 张星宇 on 16/1/12.
6 | // Copyright © 2016年 张星宇. All rights reserved.
7 | //
8 |
9 | /// 测试红黑树的实现
10 | import Foundation
11 |
12 | /// OC中的枚举一般是这样用的
13 | var enumValue = MyEnum.ValueA
14 |
15 | /// 关联类型的基本使用
16 | enum Password {
17 | case DeigtPassword(Int)
18 | case StringPassword(String)
19 | }
20 |
21 | var password = Password.DeigtPassword(123456)
22 | password = .StringPassword("123456")
23 |
24 | switch password {
25 | case .DeigtPassword(let digit): print("这是数字密码: \(digit)")
26 | case .StringPassword(let digit): print("这是字符串密码: \(digit)")
27 | }
28 |
29 | /// 测试contains方法
30 | let root = Tree(3), x = Tree()
31 | print(root.contains(3)) // true
32 | print(x.contains(3)) // false
33 |
34 | /// 测试Insert方法
35 | let alphabet = Tree("the quick brown fox jumps over the lazy dog".characters)
36 | for node in alphabet {
37 | print(node) // 打印从a到z的所有字母
38 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/1.imageset/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/1.imageset/1.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/1.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "1.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/10.imageset/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/10.imageset/10.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/10.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "10.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/2.imageset/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/2.imageset/2.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/2.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "2.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/3.imageset/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/3.imageset/3.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/3.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "3.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/4.imageset/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/4.imageset/4.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/4.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "4.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/5.imageset/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/5.imageset/5.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/5.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "5.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/6.imageset/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/6.imageset/6.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/6.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "6.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/7.imageset/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/7.imageset/7.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/7.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "7.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/8.imageset/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/8.imageset/8.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/8.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "8.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/9.imageset/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/9.imageset/9.png
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/9.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "9.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/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 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/first.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "first.pdf"
6 | }
7 | ],
8 | "info" : {
9 | "version" : 1,
10 | "author" : "xcode"
11 | }
12 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/first.imageset/first.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/first.imageset/first.pdf
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/second.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "second.pdf"
6 | }
7 | ],
8 | "info" : {
9 | "version" : 1,
10 | "author" : "xcode"
11 | }
12 | }
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/second.imageset/second.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/GraphicsPerformance-Starter/GraphicsPerformance-Starter/Assets.xcassets/second.imageset/second.pdf
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/CustomTableCell.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CustomTableCell.swift
3 | // GraphicsPerformance-Starter
4 | //
5 | // Created by 张星宇 on 16/1/21.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class CustomTableCell: UITableViewCell {
12 | let imgView = UIImageView(frame: CGRect(x: 10, y: 10, width: 180, height: 180))
13 | let label = UILabel(frame: CGRect(x: 220, y: 90, width: 150, height: 20))
14 |
15 | override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
16 | super.init(style: style, reuseIdentifier: reuseIdentifier)
17 |
18 | imgView.layer.shadowColor = UIColor.black.cgColor
19 | imgView.layer.shadowOpacity = 1
20 | imgView.layer.shadowRadius = 2
21 | imgView.layer.shadowOffset = CGSize(width: 1, height: 1)
22 |
23 | label.layer.shouldRasterize = true
24 |
25 | self.contentView.addSubview(imgView)
26 | self.contentView.addSubview(label)
27 | }
28 |
29 | func setupContent(imgName: String, text: String) {
30 | imgView.image = UIImage(named: imgName)
31 | label.text = text
32 | }
33 |
34 | required init?(coder aDecoder: NSCoder) {
35 | fatalError("init(coder:) has not been implemented")
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-Starter/SecondViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SecondViewController.swift
3 | // GraphicsPerformance-Starter
4 | //
5 | // Created by 张星宇 on 16/1/21.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class SecondViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 | // Do any additional setup after loading the view, typically from a nib.
16 | }
17 |
18 | override func didReceiveMemoryWarning() {
19 | super.didReceiveMemoryWarning()
20 | // Dispose of any resources that can be recreated.
21 | }
22 |
23 |
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-StarterTests/GraphicsPerformance_StarterTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GraphicsPerformance_StarterTests.swift
3 | // GraphicsPerformance-StarterTests
4 | //
5 | // Created by 张星宇 on 16/1/21.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import GraphicsPerformance_Starter
11 |
12 | class GraphicsPerformance_StarterTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | // Use XCTAssert and related functions to verify your tests produce the correct results.
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measureBlock {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-StarterTests/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 |
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/GraphicsPerformance-StarterUITests/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 |
--------------------------------------------------------------------------------
/GraphicsPerformance-Starter/README.md:
--------------------------------------------------------------------------------
1 | # UIKit性能调优
2 |
3 | 这个demo主要用于介绍UIKit性能调优的过程。具体文章可以参考我的博客:[UIKit性能调优实战](http://bestswifter.com/uikitxing-neng-diao-you-shi-zhan-jiang-jie/)
4 |
--------------------------------------------------------------------------------
/KtColor/KTColor/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 | }
--------------------------------------------------------------------------------
/KtColor/KTColor/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/KtColor/KTColorTests/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 |
--------------------------------------------------------------------------------
/KtColor/KTColorTests/KTColorTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // KTColorTests.swift
3 | // KTColorTests
4 | //
5 | // Created by 张星宇 on 16/2/14.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import KTColor
11 |
12 | class KTColorTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | // Use XCTAssert and related functions to verify your tests produce the correct results.
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measureBlock {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/KtColor/KTColorUITests/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 |
--------------------------------------------------------------------------------
/KtColor/KTColorUITests/KTColorUITests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // KTColorUITests.swift
3 | // KTColorUITests
4 | //
5 | // Created by 张星宇 on 16/2/14.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import XCTest
10 |
11 | class KTColorUITests: XCTestCase {
12 |
13 | override func setUp() {
14 | super.setUp()
15 |
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 |
18 | // In UI tests it is usually best to stop immediately when a failure occurs.
19 | continueAfterFailure = false
20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
21 | XCUIApplication().launch()
22 |
23 | // 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.
24 | }
25 |
26 | override func tearDown() {
27 | // Put teardown code here. This method is called after the invocation of each test method in the class.
28 | super.tearDown()
29 | }
30 |
31 | func testExample() {
32 | // Use recording to get started writing UI tests.
33 | // Use XCTAssert and related functions to verify your tests produce the correct results.
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/KtColor/README.md:
--------------------------------------------------------------------------------
1 | # 当 UIColor 遇上 Swift
2 |
3 | 这个 demo 主要用于分析如何利用 Swift 的语法特性简化创建 `UIColor`对象的过程。具体文章可以参考我的博客:[当UIColor遇上 Swift](http://www.jianshu.com/p/f2173235cde8)
4 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. 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 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KTMainViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "KtRefreshTableViewController.h"
11 |
12 | @interface KTMainViewController : KtRefreshTableViewController
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KTMainViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KTMainViewController.h"
10 | #import "KtMainTableViewCell.h"
11 | #import "KtMainTableViewDataSource.h"
12 |
13 | #import "AFNetworking.h"
14 | #import "KtTableViewBaseItem.h"
15 | #import "KtMainTableModel.h"
16 |
17 | #import "MJRefresh.h"
18 |
19 | @implementation KTMainViewController
20 |
21 | - (void)viewDidLoad {
22 | [super viewDidLoad];
23 | [self createModel];
24 | }
25 |
26 | - (void)createModel {
27 | self.listModel = [[KtMainTableModel alloc] initWithAddress:@"/mooclist.php"];
28 | self.listModel.delegate = self;
29 | }
30 |
31 | - (void)createDataSource {
32 | self.dataSource = [[KtMainTableViewDataSource alloc] init]; // 这一步创建了数据源
33 | }
34 |
35 | - (void)requestDidSuccess {
36 | for (KtMainTableBookItem *book in ((KtMainTableModel *)self.listModel).tableViewItem.books) {
37 | KtTableViewBaseItem *item = [[KtTableViewBaseItem alloc] init];
38 | item.itemTitle = book.bookTitle;
39 | [self.dataSource appendItem:item];
40 | }
41 | }
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseModel/KtBaseItem.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtBaseItem.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KtBaseItem : NSObject
12 |
13 | - (id)initWithData:(NSDictionary *)data;
14 |
15 | // property中如有包含TBCBaseListItem对象的数组,需要设定此规则
16 | - (void)addMappingRuleArrayProperty:(NSString*)propertyName class:(Class)cls;
17 | // 所有需要映射的property都需要设定此规则
18 | - (void)addMappingRuleProperty:(NSString*)propertyName pathInJson:(NSString*)path;
19 |
20 | - (id)setData:(id)data;
21 |
22 | @end
23 |
24 | @interface KtClassHelper : NSObject
25 |
26 | + (KtClassHelper *)sharedInstance;
27 |
28 | @property (nonatomic, retain) NSMutableDictionary *propertyListCache;
29 |
30 | - (NSDictionary *)propertyList:(Class)cls;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseModel/KtBaseListModel/KtBaseListItem.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtBaseListItem.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/18.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtBaseItem.h"
10 |
11 | @interface KtBaseListItem : KtBaseItem
12 |
13 | //@property (nonatomic, assign) int hasNext;
14 | //@property (nonatomic, assign) int hasPrev;
15 | @property (nonatomic, assign) int pageNumber; // 为了简化问题,我们让客户端直接传这个值,其实应该用上面两个。
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseModel/KtBaseListModel/KtBaseListItem.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtBaseListItem.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/18.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtBaseListItem.h"
10 |
11 | @implementation KtBaseListItem
12 |
13 | - (id)initWithData:(NSDictionary *)data {
14 | if (self = [super initWithData:data]) {
15 | self.pageNumber = [[NSString stringWithFormat:@"%@", [data objectForKey:@"page_number"]] intValue];
16 | }
17 | return self;
18 | }
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseModel/KtBaseListModel/KtBaseListModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtBaseListModel.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/18.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtBaseModel.h"
10 | #import "KtBaseListItem.h"
11 |
12 | @protocol KtBaseListModelProtocol
13 |
14 | @required
15 | - (void)refreshRequestDidSuccess;
16 | - (void)loadRequestDidSuccess;
17 | - (void)didLoadLastPage;
18 | - (void)handleAfterRequestFinish; // 请求结束后的操作,刷新tableview或关闭动画等。
19 |
20 | @optional
21 | - (void)didLoadFirstPage;
22 |
23 | @end
24 |
25 | @interface KtBaseListModel : KtBaseModel
26 |
27 | @property (nonatomic, strong) KtBaseListItem *listItem;
28 | @property (nonatomic, weak) id delegate;
29 | @property (nonatomic, assign) BOOL isRefresh; // 如果为是,表示刷新,否则为加载。
30 |
31 | - (void)loadPage:(int)pageNumber;
32 | - (void)loadNextPage;
33 | - (void)loadPreviousPage;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseModel/KtBaseListModel/KtRefreshTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtRefreshTableViewController.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/20.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtTableViewController.h"
10 | #import "KtBaseListModel.h"
11 |
12 | @interface KtRefreshTableViewController : KtTableViewController
13 |
14 | @property (nonatomic, strong) KtBaseListModel *listModel;
15 |
16 | - (void)requestDidSuccess; // 子类请求完成后的处理方法。
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseModel/KtBaseListModel/KtRefreshTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtRefreshTableViewController.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/20.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtRefreshTableViewController.h"
10 | #import "MJRefresh.h"
11 |
12 | @implementation KtRefreshTableViewController
13 |
14 | - (void)viewDidLoad {
15 | [super viewDidLoad];
16 |
17 | self.tableView.isNeedPullUpToRefreshAction = YES;
18 | self.tableView.isNeedPullDownToRefreshAction = YES;
19 | }
20 |
21 | #pragma -mark KtBaseListModelProtocol
22 | - (void)loadRequestDidSuccess {
23 | [self requestDidSuccess];
24 | }
25 |
26 | - (void)refreshRequestDidSuccess {
27 | [self.dataSource clearAllItems];
28 | [self requestDidSuccess];
29 | }
30 |
31 | - (void)handleAfterRequestFinish {
32 | [self.tableView stopRefreshingAnimation];
33 | [self.tableView reloadData];
34 | }
35 |
36 | - (void)didLoadLastPage {
37 | [self.tableView.mj_footer endRefreshingWithNoMoreData];
38 | }
39 |
40 | #pragma -mark KtTableViewDelegate
41 | - (void)pullUpToRefreshAction {
42 | [self.listModel loadNextPage];
43 | }
44 |
45 | - (void)pullDownToRefreshAction {
46 | [self.listModel refresh];
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseModel/KtBaseModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtBaseModel.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "KtBaseServerAPI.h"
12 | #import "KtBaseItem.h"
13 |
14 | @class KtBaseModel;
15 |
16 | /*!
17 | @brief 用于KtBaseModel回调的block定义
18 | */
19 | typedef void(^KtModelBlock)(KtBaseModel *);
20 |
21 | @interface KtBaseModel : NSObject
22 |
23 | //自动解析的数据类型 可能在不同线程访问 因此设置为 atomic
24 | @property (assign,atomic) Class parseDataClassType;
25 |
26 | // 回调函数
27 | @property (nonatomic, copy) KtModelBlock completionBlock;
28 |
29 | //网络请求
30 | @property (nonatomic,retain) KtBaseServerAPI *serverApi;
31 |
32 | //网络请求参数
33 | @property (nonatomic,retain) NSDictionary *params;
34 |
35 | //请求地址 需要在子类init中初始化
36 | @property (nonatomic,copy) NSString *address;
37 |
38 | - (instancetype)initWithAddress:(NSString *)address;
39 | - (void)handleParsedData:(KtBaseItem *)parsedData;
40 |
41 | - (void)loadWithShortConnection;
42 | - (void)loadWithLongConnection;
43 | - (void)refresh;
44 | - (void)cancel;
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseTableView.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtBaseTableView.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "KtTableViewDataSource.h"
11 |
12 | @class KtTableViewSectionObject;
13 | @protocol KtTableViewDelegate
14 |
15 | @optional
16 |
17 | /**
18 | * 选择一个cell的回调,并返回被选择cell的数据结构和indexPath
19 | */
20 | - (void)didSelectObject:(id)object atIndexPath:(NSIndexPath*)indexPath;
21 |
22 | - (UIView *)headerViewForSectionObject:(KtTableViewSectionObject *)sectionObject atSection:(NSInteger)section;
23 |
24 | // 下拉刷新触发的方法
25 |
26 | - (void)pullDownToRefreshAction;
27 |
28 | // 上拉加载触发的方法
29 |
30 | - (void)pullUpToRefreshAction;
31 |
32 | // 将来可以有 cell 的编辑,交换,左滑等回调
33 |
34 | // 这个协议继承了UITableViewDelegate ,所以自己做一层中转,VC 依然需要实现某些代理方法。
35 |
36 | @end
37 |
38 | @interface KtBaseTableView : UITableView
39 |
40 | @property (nonatomic, assign) id ktDataSource;
41 |
42 | @property (nonatomic, assign) id ktDelegate;
43 |
44 | // 是否需要下拉刷新和上拉加载
45 | @property (nonatomic, assign) BOOL isNeedPullDownToRefreshAction;
46 | @property (nonatomic, assign) BOOL isNeedPullUpToRefreshAction;
47 |
48 | - (void)stopRefreshingAnimation;
49 | - (void)triggerRefreshing;
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseTableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtBaseTableViewCell.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class KtTableViewBaseItem;
12 |
13 | @interface KtBaseTableViewCell : UITableViewCell
14 |
15 | @property (nonatomic, retain) id object;
16 |
17 | + (CGFloat)tableView:(UITableView*)tableView rowHeightForObject:(KtTableViewBaseItem *)object;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtBaseTableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtBaseTableViewCell.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtBaseTableViewCell.h"
10 | #import "KtTableViewBaseItem.h"
11 | #import "UIView+KtExtension.h"
12 |
13 | @implementation KtBaseTableViewCell
14 |
15 | - (void)awakeFromNib {
16 | [super awakeFromNib];
17 | // Initialization code
18 | }
19 |
20 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
21 | [super setSelected:selected animated:animated];
22 |
23 | // Configure the view for the selected state
24 | }
25 |
26 | - (void)setObject:(KtTableViewBaseItem *)object { // 子类在这个方法中解析数据
27 | self.imageView.image = object.itemImage;
28 | self.textLabel.text = object.itemTitle;
29 | self.detailTextLabel.text = object.itemSubtitle;
30 | self.accessoryView = [[UIImageView alloc] initWithImage:object.itemAccessoryImage];
31 | }
32 |
33 | + (CGFloat)tableView:(UITableView*)tableView rowHeightForObject:(KtTableViewBaseItem *)object {
34 | return 44.0f;
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtMainTableItem.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtMainTableItem.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtBaseListItem.h"
10 |
11 | @interface KtMainTableItem : KtBaseListItem
12 |
13 | @property (strong, nonatomic) NSMutableArray *books; // 存放了每个 cell 的标题
14 |
15 | @end
16 |
17 | @interface KtMainTableBookItem : KtBaseItem
18 |
19 | @property (copy, nonatomic) NSString *bookTitle;
20 | @property (copy, nonatomic) NSString *url;
21 | @property (copy, nonatomic) NSString *imageUrl;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtMainTableItem.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtMainTableItem.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtMainTableItem.h"
10 |
11 | @implementation KtMainTableItem
12 |
13 | - (id)init {
14 | self = [super init];
15 | if (self) {
16 | [self addMappingRuleProperty:@"books" pathInJson:@"data"];
17 | [self addMappingRuleArrayProperty:@"books" class:[KtMainTableBookItem class]];
18 | }
19 | return self;
20 | }
21 |
22 | @end
23 |
24 | @implementation KtMainTableBookItem
25 |
26 | - (id)init {
27 | self = [super init];
28 | if (self) {
29 | [self addMappingRuleProperty:@"bookTitle" pathInJson:@"title"];
30 | [self addMappingRuleProperty:@"url" pathInJson:@"url"];
31 | [self addMappingRuleProperty:@"imageUrl" pathInJson:@"imageUrl"];
32 | }
33 | return self;
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtMainTableModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtMainTableModel.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtBaseListModel.h"
10 | #import "KtMainTableItem.h"
11 |
12 | @interface KtMainTableModel : KtBaseListModel
13 |
14 | @property (nonatomic, strong) KtMainTableItem *tableViewItem;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtMainTableModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtMainTableModel.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/5/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtMainTableModel.h"
10 | #import "KtMainTableItem.h"
11 |
12 | @implementation KtMainTableModel
13 |
14 | - (void)handleParsedData:(KtBaseItem *)parsedData {
15 | [super handleParsedData:parsedData];
16 | if ([parsedData isKindOfClass:[KtMainTableItem class]]) {
17 | self.tableViewItem = (KtMainTableItem *)parsedData;
18 | }
19 | }
20 |
21 | - (void)loadWithShortConnection {
22 | if (!self.parseDataClassType) {
23 | self.parseDataClassType = [KtMainTableItem class];
24 | }
25 | [super loadWithShortConnection];
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtMainTableViewCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtMainTableViewCell.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "KtBaseTableViewCell.h"
11 |
12 | @interface KtMainTableViewCell : KtBaseTableViewCell
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtMainTableViewCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtMainTableViewCell.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtMainTableViewCell.h"
10 |
11 | @implementation KtMainTableViewCell
12 |
13 | - (void)awakeFromNib {
14 | [super awakeFromNib];
15 | // Initialization code
16 | }
17 |
18 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
19 | [super setSelected:selected animated:animated];
20 | // Configure the view for the selected state
21 | }
22 |
23 | + (CGFloat)tableView:(UITableView *)tableView rowHeightForObject:(KtTableViewBaseItem *)object {
24 | return 60;
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtMainTableViewDataSource.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtMainTableViewDataSource.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtTableViewDataSource.h"
10 |
11 | @interface KtMainTableViewDataSource : KtTableViewDataSource
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtTableViewBaseItem.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtTableViewBaseItem.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | FOUNDATION_EXPORT CGFloat const CellInvalidHeight;
13 |
14 | @interface KtTableViewBaseItem : NSObject
15 |
16 | @property (nonatomic, assign) CGFloat cellHeight;
17 |
18 | @property (nonatomic, retain) NSString *itemIdentifier;
19 | @property (nonatomic, retain) UIImage *itemImage;
20 | @property (nonatomic, retain) NSString *itemTitle;
21 | @property (nonatomic, retain) NSString *itemSubtitle;
22 | @property (nonatomic, retain) UIImage *itemAccessoryImage;
23 |
24 | - (instancetype)initWithImage:(UIImage *)image Title:(NSString *)title SubTitle:(NSString *)subTitle AccessoryImage:(UIImage *)accessoryImage;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtTableViewBaseItem.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtTableViewBaseItem.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtTableViewBaseItem.h"
10 |
11 | CGFloat const CellInvalidHeight = -1;
12 |
13 | @implementation KtTableViewBaseItem
14 |
15 | - (instancetype)init {
16 | self = [self initWithImage:nil Title:nil SubTitle:nil AccessoryImage:nil];
17 | return self;
18 | }
19 |
20 | - (instancetype)initWithImage:(UIImage *)image Title:(NSString *)title SubTitle:(NSString *)subTitle AccessoryImage:(UIImage *)accessoryImage {
21 | self = [super init];
22 | if (self) {
23 | _cellHeight = CellInvalidHeight;
24 | _itemImage = image;
25 | _itemTitle = title;
26 | _itemSubtitle = subTitle;
27 | _itemAccessoryImage = accessoryImage;
28 | }
29 | return self;
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtTableViewController.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/16.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "KtBaseTableView.h"
11 |
12 | @class KtTableViewDataSource;
13 |
14 | @protocol KtTableViewControllerDelegate
15 |
16 | @required
17 | - (void)createDataSource;
18 |
19 | @end
20 |
21 | @interface KtTableViewController : UIViewController
22 |
23 | @property (nonatomic, strong) KtBaseTableView *tableView;
24 | @property (nonatomic, strong) KtTableViewDataSource *dataSource;
25 | @property (nonatomic, assign) UITableViewStyle tableViewStyle; // 用来创建 tableView
26 |
27 | - (instancetype)initWithStyle:(UITableViewStyle)style;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtTableViewController.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/16.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtTableViewController.h"
10 | #import "KtTableViewDataSource.h"
11 |
12 | @implementation KtTableViewController
13 |
14 | - (instancetype)initWithStyle:(UITableViewStyle)style {
15 | self = [super init];
16 | if (self) {
17 | [self createDataSource];
18 | }
19 | return self;
20 | }
21 |
22 | // 这个方法实际上要被子类重写,生成对应类型的 data source
23 | - (void)createDataSource {
24 | @throw [NSException exceptionWithName:@"Cann't use this method"
25 | reason:@"You can only call this method in subclass"
26 | userInfo:nil];
27 | }
28 |
29 | - (void)viewDidLoad {
30 | [super viewDidLoad];
31 | [self createTableView];
32 | }
33 |
34 | - (void)createTableView {
35 | if (!self.tableView) {
36 | self.tableView = [[KtBaseTableView alloc] initWithFrame:self.view.bounds style:self.tableViewStyle];
37 | self.tableView.ktDelegate = self;
38 | self.tableView.ktDataSource = self.dataSource;
39 | [self.view addSubview:self.tableView];
40 | }
41 | }
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtTableViewDataSource.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtTableViewDataSource.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @class KtTableViewBaseItem;
13 |
14 | @protocol KtTableViewDataSource
15 |
16 | @optional
17 |
18 | - (KtTableViewBaseItem *)tableView:(UITableView *)tableView objectForRowAtIndexPath:(NSIndexPath *)indexPath;
19 | - (Class)tableView:(UITableView*)tableView cellClassForObject:(KtTableViewBaseItem *)object;
20 |
21 | @end
22 |
23 | @interface KtTableViewDataSource : NSObject
24 |
25 | @property (nonatomic, strong) NSMutableArray *sections; // 二维数组,每个元素都是一个 SectionObject
26 |
27 | - (void)clearAllItems;
28 | - (void)appendItem:(KtTableViewBaseItem *)item;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtTableViewSectionObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // KtTableViewSectionObject.h
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KtTableViewSectionObject : NSObject
12 |
13 | @property (nonatomic, copy) NSString *headerTitle; // UITableDataSource 协议中的 titleForHeaderInSection 方法可能会用到
14 | @property (nonatomic, copy) NSString *footerTitle; // UITableDataSource 协议中的 titleForFooterInSection 方法可能会用到
15 |
16 | @property (nonatomic, retain) NSMutableArray *items;
17 |
18 | - (instancetype)initWithItemArray:(NSMutableArray *)items;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/KtTableViewSectionObject.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtTableViewSectionObject.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "KtTableViewSectionObject.h"
10 |
11 | @implementation KtTableViewSectionObject
12 |
13 | - (instancetype)init {
14 | self = [super init];
15 | if (self) {
16 | self.headerTitle = @"";
17 | self.footerTitle = @"";
18 | self.items = [[NSMutableArray alloc] init];
19 | }
20 | return self;
21 | }
22 |
23 | - (instancetype)initWithItemArray:(NSMutableArray *)items {
24 | self = [self init];
25 | if (self) {
26 | [self.items addObjectsFromArray:items];
27 | }
28 | return self;
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/KtTableView/KtTableView/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // KtTableView
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. 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 |
--------------------------------------------------------------------------------
/KtTableView/KtTableViewTests/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 |
--------------------------------------------------------------------------------
/KtTableView/KtTableViewTests/KtTableViewTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtTableViewTests.m
3 | // KtTableViewTests
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KtTableViewTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation KtTableViewTests
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 |
--------------------------------------------------------------------------------
/KtTableView/KtTableViewUITests/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 |
--------------------------------------------------------------------------------
/KtTableView/KtTableViewUITests/KtTableViewUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // KtTableViewUITests.m
3 | // KtTableViewUITests
4 | //
5 | // Created by bestswifter on 16/4/13.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface KtTableViewUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation KtTableViewUITests
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 |
--------------------------------------------------------------------------------
/KtTableView/Podfile:
--------------------------------------------------------------------------------
1 | source 'https://github.com/CocoaPods/Specs.git'
2 | platform :ios, '8.0'
3 |
4 | pod 'AFNetworking', '~> 3.0'
5 | pod 'MJRefresh'
6 |
--------------------------------------------------------------------------------
/KtTableView/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - AFNetworking (3.1.0):
3 | - AFNetworking/NSURLSession (= 3.1.0)
4 | - AFNetworking/Reachability (= 3.1.0)
5 | - AFNetworking/Security (= 3.1.0)
6 | - AFNetworking/Serialization (= 3.1.0)
7 | - AFNetworking/UIKit (= 3.1.0)
8 | - AFNetworking/NSURLSession (3.1.0):
9 | - AFNetworking/Reachability
10 | - AFNetworking/Security
11 | - AFNetworking/Serialization
12 | - AFNetworking/Reachability (3.1.0)
13 | - AFNetworking/Security (3.1.0)
14 | - AFNetworking/Serialization (3.1.0)
15 | - AFNetworking/UIKit (3.1.0):
16 | - AFNetworking/NSURLSession
17 | - MJRefresh (3.1.0)
18 |
19 | DEPENDENCIES:
20 | - AFNetworking (~> 3.0)
21 | - MJRefresh
22 |
23 | SPEC CHECKSUMS:
24 | AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
25 | MJRefresh: 743e6404967d1c2c688472ea3ecfde247d872db4
26 |
27 | COCOAPODS: 0.39.0
28 |
--------------------------------------------------------------------------------
/KtTableView/Pods/AFNetworking/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFAutoPurgingImageCache.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFHTTPSessionManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFHTTPSessionManager.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFImageDownloader.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFImageDownloader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFNetworkActivityIndicatorManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFNetworkReachabilityManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFSecurityPolicy.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFSecurityPolicy.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFURLRequestSerialization.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLRequestSerialization.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFURLResponseSerialization.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLResponseSerialization.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/AFURLSessionManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLSessionManager.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/UIActivityIndicatorView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/UIButton+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/UIImage+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/UIImageView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/UIKit+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/UIProgressView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/UIRefreshControl+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/AFNetworking/UIWebView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefresh.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/MJRefresh.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshAutoFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshAutoFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshAutoGifFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshAutoNormalFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshAutoStateFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshBackFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshBackFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshBackGifFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshBackNormalFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshBackStateFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshComponent.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshComponent.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshConst.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/MJRefreshConst.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshGifHeader.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshGifHeader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshHeader.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshHeader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshNormalHeader.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshNormalHeader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/MJRefreshStateHeader.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshStateHeader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/UIScrollView+MJExtension.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/UIScrollView+MJExtension.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/UIScrollView+MJRefresh.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/UIScrollView+MJRefresh.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Private/MJRefresh/UIView+MJExtension.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/UIView+MJExtension.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFAutoPurgingImageCache.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFHTTPSessionManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFHTTPSessionManager.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFImageDownloader.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFImageDownloader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFNetworkActivityIndicatorManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFNetworkReachabilityManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFSecurityPolicy.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFSecurityPolicy.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFURLRequestSerialization.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLRequestSerialization.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFURLResponseSerialization.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLResponseSerialization.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/AFURLSessionManager.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/AFNetworking/AFURLSessionManager.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/UIActivityIndicatorView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/UIButton+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/UIImage+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/UIImageView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/UIKit+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/UIProgressView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/UIRefreshControl+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/AFNetworking/UIWebView+AFNetworking.h:
--------------------------------------------------------------------------------
1 | ../../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefresh.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/MJRefresh.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshAutoFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshAutoFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshAutoGifFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshAutoNormalFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshAutoStateFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshBackFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshBackFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshBackGifFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshBackNormalFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshBackStateFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshComponent.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshComponent.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshConst.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/MJRefreshConst.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshFooter.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshFooter.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshGifHeader.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshGifHeader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshHeader.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Base/MJRefreshHeader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshNormalHeader.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshNormalHeader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/MJRefreshStateHeader.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/Custom/Header/MJRefreshStateHeader.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/UIScrollView+MJExtension.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/UIScrollView+MJExtension.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/UIScrollView+MJRefresh.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/UIScrollView+MJRefresh.h
--------------------------------------------------------------------------------
/KtTableView/Pods/Headers/Public/MJRefresh/UIView+MJExtension.h:
--------------------------------------------------------------------------------
1 | ../../../MJRefresh/MJRefresh/UIView+MJExtension.h
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Base/MJRefreshAutoFooter.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshAutoFooter.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/4/24.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshFooter.h"
10 |
11 | @interface MJRefreshAutoFooter : MJRefreshFooter
12 | /** 是否自动刷新(默认为YES) */
13 | @property (assign, nonatomic, getter=isAutomaticallyRefresh) BOOL automaticallyRefresh;
14 |
15 | /** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */
16 | @property (assign, nonatomic) CGFloat appearencePercentTriggerAutoRefresh MJRefreshDeprecated("请使用automaticallyChangeAlpha属性");
17 |
18 | /** 当底部控件出现多少时就自动刷新(默认为1.0,也就是底部控件完全出现时,才会自动刷新) */
19 | @property (assign, nonatomic) CGFloat triggerAutomaticallyRefreshPercent;
20 | @end
21 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Base/MJRefreshBackFooter.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshBackFooter.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/4/24.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshFooter.h"
10 |
11 | @interface MJRefreshBackFooter : MJRefreshFooter
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Base/MJRefreshFooter.h:
--------------------------------------------------------------------------------
1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh
2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
3 | // MJRefreshFooter.h
4 | // MJRefreshExample
5 | //
6 | // Created by MJ Lee on 15/3/5.
7 | // Copyright (c) 2015年 小码哥. All rights reserved.
8 | // 上拉刷新控件
9 |
10 | #import "MJRefreshComponent.h"
11 |
12 | @interface MJRefreshFooter : MJRefreshComponent
13 | /** 创建footer */
14 | + (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
15 | /** 创建footer */
16 | + (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;
17 |
18 | /** 提示没有更多的数据 */
19 | - (void)endRefreshingWithNoMoreData;
20 | - (void)noticeNoMoreData MJRefreshDeprecated("使用endRefreshingWithNoMoreData");
21 |
22 | /** 重置没有更多的数据(消除没有更多数据的状态) */
23 | - (void)resetNoMoreData;
24 |
25 | /** 忽略多少scrollView的contentInset的bottom */
26 | @property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom;
27 |
28 | /** 自动根据有无数据来显示和隐藏(有数据就显示,没有数据隐藏。默认是NO) */
29 | @property (assign, nonatomic, getter=isAutomaticallyHidden) BOOL automaticallyHidden;
30 | @end
31 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Base/MJRefreshHeader.h:
--------------------------------------------------------------------------------
1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh
2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
3 | // MJRefreshHeader.h
4 | // MJRefreshExample
5 | //
6 | // Created by MJ Lee on 15/3/4.
7 | // Copyright (c) 2015年 小码哥. All rights reserved.
8 | // 下拉刷新控件:负责监控用户下拉的状态
9 |
10 | #import "MJRefreshComponent.h"
11 |
12 | @interface MJRefreshHeader : MJRefreshComponent
13 | /** 创建header */
14 | + (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;
15 | /** 创建header */
16 | + (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;
17 |
18 | /** 这个key用来存储上一次下拉刷新成功的时间 */
19 | @property (copy, nonatomic) NSString *lastUpdatedTimeKey;
20 | /** 上一次下拉刷新成功的时间 */
21 | @property (strong, nonatomic, readonly) NSDate *lastUpdatedTime;
22 |
23 | /** 忽略多少scrollView的contentInset的top */
24 | @property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetTop;
25 | @end
26 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshAutoGifFooter.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/4/24.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshAutoStateFooter.h"
10 |
11 | @interface MJRefreshAutoGifFooter : MJRefreshAutoStateFooter
12 | @property (weak, nonatomic, readonly) UIImageView *gifView;
13 |
14 | /** 设置state状态下的动画图片images 动画持续时间duration*/
15 | - (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state;
16 | - (void)setImages:(NSArray *)images forState:(MJRefreshState)state;
17 | @end
18 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshAutoNormalFooter.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/4/24.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshAutoStateFooter.h"
10 |
11 | @interface MJRefreshAutoNormalFooter : MJRefreshAutoStateFooter
12 | /** 菊花的样式 */
13 | @property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
14 | @end
15 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshAutoStateFooter.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/6/13.
6 | // Copyright © 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshAutoFooter.h"
10 |
11 | @interface MJRefreshAutoStateFooter : MJRefreshAutoFooter
12 | /** 显示刷新状态的label */
13 | @property (weak, nonatomic, readonly) UILabel *stateLabel;
14 |
15 | /** 设置state状态下的文字 */
16 | - (void)setTitle:(NSString *)title forState:(MJRefreshState)state;
17 |
18 | /** 隐藏刷新状态的文字 */
19 | @property (assign, nonatomic, getter=isRefreshingTitleHidden) BOOL refreshingTitleHidden;
20 | @end
21 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshBackGifFooter.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/4/24.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshBackStateFooter.h"
10 |
11 | @interface MJRefreshBackGifFooter : MJRefreshBackStateFooter
12 | @property (weak, nonatomic, readonly) UIImageView *gifView;
13 |
14 | /** 设置state状态下的动画图片images 动画持续时间duration*/
15 | - (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state;
16 | - (void)setImages:(NSArray *)images forState:(MJRefreshState)state;
17 | @end
18 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshBackNormalFooter.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/4/24.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshBackStateFooter.h"
10 |
11 | @interface MJRefreshBackNormalFooter : MJRefreshBackStateFooter
12 | @property (weak, nonatomic, readonly) UIImageView *arrowView;
13 | /** 菊花的样式 */
14 | @property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
15 | @end
16 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshBackStateFooter.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/6/13.
6 | // Copyright © 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshBackFooter.h"
10 |
11 | @interface MJRefreshBackStateFooter : MJRefreshBackFooter
12 | /** 显示刷新状态的label */
13 | @property (weak, nonatomic, readonly) UILabel *stateLabel;
14 | /** 设置state状态下的文字 */
15 | - (void)setTitle:(NSString *)title forState:(MJRefreshState)state;
16 |
17 | /** 获取state状态下的title */
18 | - (NSString *)titleForState:(MJRefreshState)state;
19 | @end
20 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshGifHeader.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshGifHeader.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/4/24.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshStateHeader.h"
10 |
11 | @interface MJRefreshGifHeader : MJRefreshStateHeader
12 | @property (weak, nonatomic, readonly) UIImageView *gifView;
13 |
14 | /** 设置state状态下的动画图片images 动画持续时间duration*/
15 | - (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state;
16 | - (void)setImages:(NSArray *)images forState:(MJRefreshState)state;
17 | @end
18 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshNormalHeader.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshNormalHeader.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/4/24.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshStateHeader.h"
10 |
11 | @interface MJRefreshNormalHeader : MJRefreshStateHeader
12 | @property (weak, nonatomic, readonly) UIImageView *arrowView;
13 | /** 菊花的样式 */
14 | @property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
15 | @end
16 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshStateHeader.h:
--------------------------------------------------------------------------------
1 | //
2 | // MJRefreshStateHeader.h
3 | // MJRefreshExample
4 | //
5 | // Created by MJ Lee on 15/4/24.
6 | // Copyright (c) 2015年 小码哥. All rights reserved.
7 | //
8 |
9 | #import "MJRefreshHeader.h"
10 |
11 | @interface MJRefreshStateHeader : MJRefreshHeader
12 | #pragma mark - 刷新时间相关
13 | /** 利用这个block来决定显示的更新时间文字 */
14 | @property (copy, nonatomic) NSString *(^lastUpdatedTimeText)(NSDate *lastUpdatedTime);
15 | /** 显示上一次刷新时间的label */
16 | @property (weak, nonatomic, readonly) UILabel *lastUpdatedTimeLabel;
17 |
18 | #pragma mark - 状态相关
19 | /** 显示刷新状态的label */
20 | @property (weak, nonatomic, readonly) UILabel *stateLabel;
21 | /** 设置state状态下的文字 */
22 | - (void)setTitle:(NSString *)title forState:(MJRefreshState)state;
23 | @end
24 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/arrow@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bestswifter/MySampleCode/db387de2bdc6d07e375d6c19a1e4ac462b91aa24/KtTableView/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/arrow@2x.png
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/MJRefresh.h:
--------------------------------------------------------------------------------
1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh
2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
3 |
4 | #import "UIScrollView+MJRefresh.h"
5 | #import "UIScrollView+MJExtension.h"
6 | #import "UIView+MJExtension.h"
7 |
8 | #import "MJRefreshNormalHeader.h"
9 | #import "MJRefreshGifHeader.h"
10 |
11 | #import "MJRefreshBackNormalFooter.h"
12 | #import "MJRefreshBackGifFooter.h"
13 | #import "MJRefreshAutoNormalFooter.h"
14 | #import "MJRefreshAutoGifFooter.h"
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/UIScrollView+MJExtension.h:
--------------------------------------------------------------------------------
1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh
2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
3 | // UIScrollView+Extension.h
4 | // MJRefreshExample
5 | //
6 | // Created by MJ Lee on 14-5-28.
7 | // Copyright (c) 2014年 小码哥. All rights reserved.
8 | //
9 |
10 | #import
11 |
12 | @interface UIScrollView (MJExtension)
13 | @property (assign, nonatomic) CGFloat mj_insetT;
14 | @property (assign, nonatomic) CGFloat mj_insetB;
15 | @property (assign, nonatomic) CGFloat mj_insetL;
16 | @property (assign, nonatomic) CGFloat mj_insetR;
17 |
18 | @property (assign, nonatomic) CGFloat mj_offsetX;
19 | @property (assign, nonatomic) CGFloat mj_offsetY;
20 |
21 | @property (assign, nonatomic) CGFloat mj_contentW;
22 | @property (assign, nonatomic) CGFloat mj_contentH;
23 | @end
24 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/UIScrollView+MJRefresh.h:
--------------------------------------------------------------------------------
1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh
2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
3 | // UIScrollView+MJRefresh.h
4 | // MJRefreshExample
5 | //
6 | // Created by MJ Lee on 15/3/4.
7 | // Copyright (c) 2015年 小码哥. All rights reserved.
8 | // 给ScrollView增加下拉刷新、上拉刷新的功能
9 |
10 | #import
11 | #import "MJRefreshConst.h"
12 |
13 | @class MJRefreshHeader, MJRefreshFooter;
14 |
15 | @interface UIScrollView (MJRefresh)
16 | /** 下拉刷新控件 */
17 | @property (strong, nonatomic) MJRefreshHeader *mj_header;
18 | @property (strong, nonatomic) MJRefreshHeader *header MJRefreshDeprecated("使用mj_header");
19 | /** 上拉刷新控件 */
20 | @property (strong, nonatomic) MJRefreshFooter *mj_footer;
21 | @property (strong, nonatomic) MJRefreshFooter *footer MJRefreshDeprecated("使用mj_footer");
22 |
23 | #pragma mark - other
24 | - (NSInteger)mj_totalDataCount;
25 | @property (copy, nonatomic) void (^mj_reloadDataBlock)(NSInteger totalDataCount);
26 | @end
27 |
--------------------------------------------------------------------------------
/KtTableView/Pods/MJRefresh/MJRefresh/UIView+MJExtension.h:
--------------------------------------------------------------------------------
1 | // 代码地址: https://github.com/CoderMJLee/MJRefresh
2 | // 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
3 | // UIView+Extension.h
4 | // MJRefreshExample
5 | //
6 | // Created by MJ Lee on 14-5-28.
7 | // Copyright (c) 2014年 小码哥. All rights reserved.
8 | //
9 |
10 | #import
11 |
12 | @interface UIView (MJExtension)
13 | @property (assign, nonatomic) CGFloat mj_x;
14 | @property (assign, nonatomic) CGFloat mj_y;
15 | @property (assign, nonatomic) CGFloat mj_w;
16 | @property (assign, nonatomic) CGFloat mj_h;
17 | @property (assign, nonatomic) CGSize mj_size;
18 | @property (assign, nonatomic) CGPoint mj_origin;
19 | @end
20 |
--------------------------------------------------------------------------------
/KtTableView/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - AFNetworking (3.1.0):
3 | - AFNetworking/NSURLSession (= 3.1.0)
4 | - AFNetworking/Reachability (= 3.1.0)
5 | - AFNetworking/Security (= 3.1.0)
6 | - AFNetworking/Serialization (= 3.1.0)
7 | - AFNetworking/UIKit (= 3.1.0)
8 | - AFNetworking/NSURLSession (3.1.0):
9 | - AFNetworking/Reachability
10 | - AFNetworking/Security
11 | - AFNetworking/Serialization
12 | - AFNetworking/Reachability (3.1.0)
13 | - AFNetworking/Security (3.1.0)
14 | - AFNetworking/Serialization (3.1.0)
15 | - AFNetworking/UIKit (3.1.0):
16 | - AFNetworking/NSURLSession
17 | - MJRefresh (3.1.0)
18 |
19 | DEPENDENCIES:
20 | - AFNetworking (~> 3.0)
21 | - MJRefresh
22 |
23 | SPEC CHECKSUMS:
24 | AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
25 | MJRefresh: 743e6404967d1c2c688472ea3ecfde247d872db4
26 |
27 | COCOAPODS: 0.39.0
28 |
--------------------------------------------------------------------------------
/KtTableView/Pods/Target Support Files/AFNetworking/AFNetworking-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_AFNetworking : NSObject
3 | @end
4 | @implementation PodsDummy_AFNetworking
5 | @end
6 |
--------------------------------------------------------------------------------
/KtTableView/Pods/Target Support Files/AFNetworking/AFNetworking-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 | #ifndef TARGET_OS_IOS
6 | #define TARGET_OS_IOS TARGET_OS_IPHONE
7 | #endif
8 |
9 | #ifndef TARGET_OS_WATCH
10 | #define TARGET_OS_WATCH 0
11 | #endif
12 |
13 | #ifndef TARGET_OS_TV
14 | #define TARGET_OS_TV 0
15 | #endif
16 |
--------------------------------------------------------------------------------
/KtTableView/Pods/Target Support Files/AFNetworking/AFNetworking.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MJRefresh"
3 | OTHER_LDFLAGS = -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
4 | PODS_ROOT = ${SRCROOT}
5 | SKIP_INSTALL = YES
--------------------------------------------------------------------------------
/KtTableView/Pods/Target Support Files/MJRefresh/MJRefresh-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_MJRefresh : NSObject
3 | @end
4 | @implementation PodsDummy_MJRefresh
5 | @end
6 |
--------------------------------------------------------------------------------
/KtTableView/Pods/Target Support Files/MJRefresh/MJRefresh-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/KtTableView/Pods/Target Support Files/MJRefresh/MJRefresh.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MJRefresh" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MJRefresh"
3 | PODS_ROOT = ${SRCROOT}
4 | SKIP_INSTALL = YES
--------------------------------------------------------------------------------
/KtTableView/Pods/Target Support Files/Pods/Pods-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods : NSObject
3 | @end
4 | @implementation PodsDummy_Pods
5 | @end
6 |
--------------------------------------------------------------------------------
/KtTableView/Pods/Target Support Files/Pods/Pods.debug.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MJRefresh"
3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/MJRefresh"
4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"MJRefresh" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
5 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/KtTableView/Pods/Target Support Files/Pods/Pods.release.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/MJRefresh"
3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/MJRefresh"
4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"MJRefresh" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
5 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/NodeRequireTest/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 |
8 | {
9 | "type": "node",
10 | "request": "launch",
11 | "name": "Launch Program",
12 | "program": "${workspaceFolder}/b.js"
13 | }
14 | ]
15 | }
--------------------------------------------------------------------------------
/NodeRequireTest/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | // "target": "es6",
4 | // "module": "commonjs",
5 | "baseUrl": "./",
6 | // "paths": {
7 | // "*": [
8 | // "*"
9 | // ]
10 | // }
11 | },
12 | "exclude": [
13 | "node_modules"
14 | ]
15 | }
--------------------------------------------------------------------------------
/NodeRequireTest/main/index.js:
--------------------------------------------------------------------------------
1 | let path = require('path')
2 | process.env.NODE_PATH = path.resolve(__dirname, '../') ;
3 | require('module').Module._initPaths();
4 |
5 | let utils = require('ut')
6 |
7 | console.log(utils.key)
--------------------------------------------------------------------------------
/NodeRequireTest/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "require",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "directories": {
7 | "test": "test"
8 | },
9 | "scripts": {
10 | "test": "echo \"Error: no test specified\" && exit 1"
11 | },
12 | "author": "",
13 | "license": "ISC"
14 | }
15 |
--------------------------------------------------------------------------------
/NodeRequireTest/utils/utils.js:
--------------------------------------------------------------------------------
1 |
2 | module.exports = {
3 | key:' value'
4 | }
--------------------------------------------------------------------------------
/RunloopAndThread/RunloopAndThread/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // RunloopAndThread
4 | //
5 | // Created by 张星宇 on 16/7/24.
6 | // Copyright © 2016年 bestswifter. 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 |
--------------------------------------------------------------------------------
/RunloopAndThread/RunloopAndThread/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 | }
--------------------------------------------------------------------------------
/RunloopAndThread/RunloopAndThread/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/RunloopAndThread/RunloopAndThread/NSObject+DeallocBlock.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+DeallocBlock.h
3 | // pengpeng
4 | //
5 | // Created by jianwei.chen on 15/9/6.
6 | // Copyright (c) 2015年 AsiaInnovations. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSObject (DeallocBlock)
12 |
13 | -(void)runAtDealloc:(dispatch_block_t)block;
14 | @end
15 |
--------------------------------------------------------------------------------
/RunloopAndThread/RunloopAndThread/NSObject+DeallocBlock.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSObject+DeallocBlock.m
3 | // pengpeng
4 | //
5 | // Created by jianwei.chen on 15/9/6.
6 | // Copyright (c) 2015年 AsiaInnovations. All rights reserved.
7 | //
8 |
9 | #import "NSObject+DeallocBlock.h"
10 | #import
11 |
12 | @interface NBDeallocBlockExecutor : NSObject{
13 | dispatch_block_t _block;
14 | }
15 | - (id)initWithBlock:(dispatch_block_t)block;
16 | @end
17 |
18 | @implementation NBDeallocBlockExecutor
19 | - (id)initWithBlock:(dispatch_block_t)aBlock
20 | {
21 | self = [super init];
22 | if (self) {
23 | _block = [aBlock copy];
24 | }
25 | return self;
26 | }
27 | - (void)dealloc
28 | {
29 | _block ? _block() : nil;
30 | }
31 | @end
32 |
33 |
34 | static char *dealloc_key;
35 | @implementation NSObject (DeallocBlock)
36 |
37 | -(void)runAtDealloc:(dispatch_block_t)block
38 | {
39 | if(block){
40 | NBDeallocBlockExecutor *executor = [[NBDeallocBlockExecutor alloc] initWithBlock:block];
41 | objc_setAssociatedObject(self, &dealloc_key, executor, OBJC_ASSOCIATION_RETAIN);//不要强应用
42 | }
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/RunloopAndThread/RunloopAndThread/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // RunloopAndThread
4 | //
5 | // Created by 张星宇 on 16/7/24.
6 | // Copyright © 2016年 bestswifter. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/RunloopAndThread/RunloopAndThread/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // RunloopAndThread
4 | //
5 | // Created by 张星宇 on 16/7/24.
6 | // Copyright © 2016年 bestswifter. 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 |
--------------------------------------------------------------------------------
/Streamable/Streamable/Debug.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Debug.swift
3 | // Streamable
4 | //
5 | // Created by 张星宇 on 16/1/26.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | struct PersonDebug {
12 | var name: String
13 | private var age: Int
14 |
15 | init(name: String, age: Int) {
16 | self.name = name
17 | self.age = age
18 | }
19 | }
20 |
21 | extension PersonDebug: CustomStringConvertible, CustomDebugStringConvertible {
22 | var description: String {
23 | return "In CustomStringConvertible Protocol"
24 | }
25 |
26 | var debugDescription: String {
27 | return "In CustomDebugStringConvertible Protocol"
28 | }
29 | }
30 |
31 | // print优先调用CustomStringConvertible
32 | func testCustomStringConvertible() {
33 | print("print结构体")
34 | let kt = PersonDebug(name: "kt", age: 21)
35 | print(kt)
36 | print(String(kt))
37 | print("")
38 | }
39 |
40 | // debugPrint优先调用CustomDebugStringConvertible
41 | func testCustomDebugStringConvertible() {
42 | print("debugPrint结构体")
43 | let kt = PersonDebug(name: "kt", age: 21)
44 | debugPrint(kt)
45 | print(String(reflecting: kt))
46 | print("")
47 | }
--------------------------------------------------------------------------------
/Streamable/Streamable/main.swift:
--------------------------------------------------------------------------------
1 | //
2 | // main.swift
3 | // Streamable
4 | //
5 | // Created by 张星宇 on 16/1/26.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | testPrintStruct()
12 | testCreateString()
13 |
14 | testCustomStringConvertible()
15 | testCustomDebugStringConvertible()
--------------------------------------------------------------------------------
/SwiftMysterious/README.md:
--------------------------------------------------------------------------------
1 | # Swift中你应该知道的一些有用的tips
2 |
3 | 这份代码是[《Swift中你应该知道的一些有用的tips》](http://www.jianshu.com/p/a11c6060176c)一文的demo,主要介绍了Swift中很不错,但也很容易忽视的小tip
--------------------------------------------------------------------------------
/SwiftMysterious/SwiftMysterious/InlineLazy.swift:
--------------------------------------------------------------------------------
1 | //
2 | // InlineLazy.swift
3 | // SwiftMysterious
4 | //
5 | // Created by 张星宇 on 16/1/29.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | /// Important!!!!
12 | /// 虽然懒加载的本质是闭包,而且闭包中捕获了self,但是这里并不会产生循环引用
13 | /// 猜测Swift在捕获self时,自动把它标记为unowned
14 |
15 | class ExpensiveObject {
16 | init () {
17 | print("初始化ExpensiveObject对象的过程非常耗时")
18 | }
19 | }
20 |
21 | class PersonOld {
22 | lazy var expensiveObject: ExpensiveObject = {
23 | return self.createExpensiveObject() // 传统实现方式
24 | }()
25 |
26 | private func createExpensiveObject() -> ExpensiveObject {
27 | return ExpensiveObject()
28 | }
29 |
30 | deinit {
31 | print("Person 对象销毁")
32 | }
33 | }
34 |
35 | class Person {
36 | // 内联的lazy属性可以简化不少代码
37 | lazy var expensiveObject: ExpensiveObject = self.createExpensiveObject()
38 |
39 | private func createExpensiveObject() -> ExpensiveObject {
40 | return ExpensiveObject()
41 | }
42 |
43 | deinit {
44 | print("Person 对象销毁")
45 | }
46 | }
47 |
48 | func lazyVariable() {
49 | print("传统的lazy属性的实现")
50 | let p = PersonOld()
51 | _ = p.expensiveObject
52 | }
53 |
54 | func inlineLazyVariable() {
55 | print("\n内联lazy属性的实现")
56 | let p = Person()
57 | _ = p.expensiveObject
58 | }
--------------------------------------------------------------------------------
/SwiftMysterious/SwiftMysterious/LoopLabel.swift:
--------------------------------------------------------------------------------
1 | //
2 | // LoopLabel.swift
3 | // SwiftMysterious
4 | //
5 | // Created by 张星宇 on 16/1/29.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | let firstNames = ["Neil","Kt","Bob"]
12 | let lastNames = ["Zhou","Zhang","Wang","Li"]
13 |
14 | func normalBreak() {
15 | print("\n正常的break循环")
16 | for firstName in firstNames {
17 | var isFound = false
18 | for lastName in lastNames {
19 | if firstName == "Kt" && lastName == "Zhang" {
20 | isFound = true
21 | break
22 | }
23 | print(firstName + " " + lastName)
24 | }
25 |
26 | if isFound {
27 | break
28 | }
29 | }
30 | }
31 |
32 | func breakWithLoopLabel() {
33 | print("\n使用循环标签的break循环")
34 | outsideloop: for firstName in firstNames {
35 | innerloop: for lastName in lastNames {
36 | if firstName == "Kt" && lastName == "Zhang" {
37 | break outsideloop
38 | }
39 | print(firstName + " " + lastName)
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/SwiftMysterious/SwiftMysterious/SpecialLiteral.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SpecialLiteral.swift
3 | // SwiftMysterious
4 | //
5 | // Created by 张星宇 on 16/1/29.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | func specialLitertalExpression() {
12 | print("\n用于调试的特殊字面量表达式")
13 | print(__FILE__)
14 | print(__FUNCTION__)
15 | print(__LINE__)
16 | print(__COLUMN__) // 输出结果为11,因为有4个空格,print是五个字符,还有一个左括号。
17 | }
--------------------------------------------------------------------------------
/SwiftMysterious/SwiftMysterious/main.swift:
--------------------------------------------------------------------------------
1 | //
2 | // main.swift
3 | // SwiftMysterious
4 | //
5 | // Created by 张星宇 on 16/1/29.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | lazyVariable() // 默认的lazy属性实现
12 | inlineLazyVariable() // 内联的lazy属性实现
13 |
14 | specialLitertalExpression() // 用于调试的特殊字面量表达式
15 |
16 | normalBreak() // 正常的break循环
17 | breakWithLoopLabel() // 使用循环标签的break循环
18 |
--------------------------------------------------------------------------------
/SwiftTips/README.md:
--------------------------------------------------------------------------------
1 | # 几个加速Swift开发的小tip
2 |
3 | 这份代码是[《几个加速Swift开发的小tip》](http://www.jianshu.com/p/5ebd5e8ecf60)一文的demo,主要介绍了Swift中很不错,但也很容易忽视的小tip,掌握这些小技巧能够一定程度上加快开发速度,写出更好的代码
--------------------------------------------------------------------------------
/SwiftTips/SwiftTips/Breakpoint.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Debug.swift
3 | // Handy
4 | //
5 | // Created by 张星宇 on 16/2/2.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | func customDebug() {
12 | for i in 1..<10 {
13 |
14 | }
15 | }
--------------------------------------------------------------------------------
/SwiftTips/SwiftTips/PrivateSet.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PrivateSet.swift
3 | // Handy
4 | //
5 | // Created by 张星宇 on 16/2/2.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | struct Person {
12 | private(set) var name = "Unknown"
13 | }
14 |
15 | extension Person {
16 | mutating func changeName(newName: String) {
17 | self.name = newName
18 | }
19 | }
--------------------------------------------------------------------------------
/SwiftTips/SwiftTips/ReuseIdentifier.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ReuseIdentifier.swift
3 | // Handy
4 | //
5 | // Created by 张星宇 on 16/2/2.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | class TableViewCell {
12 |
13 | }
--------------------------------------------------------------------------------
/SwiftTips/SwiftTips/Semicolon.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Semicolon.swift
3 | // Handy
4 | //
5 | // Created by 张星宇 on 16/2/2.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | func doSomething() {
12 | let error: AnyObject? = nil
13 | guard error == nil else { print("Error information"); return }
14 |
15 | /**
16 | * Old version
17 | */
18 | guard error == nil
19 | else {
20 | print("Error information")
21 | return
22 | }
23 | }
--------------------------------------------------------------------------------
/SwiftTips/SwiftTips/main.swift:
--------------------------------------------------------------------------------
1 | //
2 | // main.swift
3 | // SwiftTips
4 | //
5 | // Created by 张星宇 on 16/2/2.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | var person = Person()
12 | person.changeName("kt")
13 |
14 | // 可以获取name属性的值
15 | print(person.name)
16 |
17 | // 报错,不能在PrivateSet.swift文件外对name属性赋值
18 | //person.name = "newName"
19 |
20 | /// 可以简化reuseIdentifier
21 | let reuseIdentifier = String(TableViewCell)
22 | print(reuseIdentifier)
23 |
24 | // 可以把多个相关联的变量声明在一个元组中
25 | var (top, left, width, height) = (0.0, 0.0, 100.0, 50.0)
26 | //rect.width = width
27 |
28 | /**
29 | * 自定义断点
30 | */
31 | customDebug()
32 |
--------------------------------------------------------------------------------
/load/README.md:
--------------------------------------------------------------------------------
1 | # 细说OC中的load和initialize方法
2 |
3 | 这份代码是[《细说OC中的load和initialize方法》](http://www.jianshu.com/p/d25f691f0b07)一文的demo,主要介绍了OC中的`load`和`initialize`方法
4 |
--------------------------------------------------------------------------------
/load/load/Child+load.h:
--------------------------------------------------------------------------------
1 | //
2 | // Child+load.h
3 | // load
4 | //
5 | // Created by 张星宇 on 16/2/1.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "Child.h"
10 |
11 | @interface Child (load)
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/load/load/Child+load.m:
--------------------------------------------------------------------------------
1 | //
2 | // Child+load.m
3 | // load
4 | //
5 | // Created by 张星宇 on 16/2/1.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "Child+load.h"
10 |
11 | @implementation Child (load)
12 |
13 | + (void)load {
14 | /**
15 | * 分类中的load方法会被调用
16 | */
17 | NSLog(@"Load Class Child+load");
18 | }
19 |
20 | /**
21 | * initialize更像是一个普通的方法。
22 | * 即使在Child.m中实现了initialize方法,也会在这里被覆盖
23 | */
24 | //+ (void)initialize {
25 | // NSLog(@"Initialize Class Child+load");
26 | //}
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/load/load/Child.h:
--------------------------------------------------------------------------------
1 | //
2 | // Child.h
3 | // load
4 | //
5 | // Created by 张星宇 on 16/2/1.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "Parent.h"
11 |
12 | @interface Child : Parent
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/load/load/Child.m:
--------------------------------------------------------------------------------
1 | //
2 | // Child.m
3 | // load
4 | //
5 | // Created by 张星宇 on 16/2/1.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "Child.h"
10 | #import "Other.h"
11 |
12 | @implementation Child
13 |
14 | + (void)load {
15 | NSLog(@"Load Class Child");
16 |
17 | /**
18 | * 这时候Other类还没调用load方法,所以输出结果是Original Output
19 | */
20 | Other *other = [Other new];
21 | [other originalFunc];
22 |
23 | // 如果不先调用other的load,下面这行代码就无效,打印出null
24 | [Other printName];
25 | }
26 |
27 | //+ (void)initialize {
28 | // NSLog(@"Initialize Child, caller Class %@", [self class]);
29 | //}
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/load/load/Other.h:
--------------------------------------------------------------------------------
1 | //
2 | // Normal.h
3 | // load
4 | //
5 | // Created by 张星宇 on 16/2/1.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface Other : NSObject
12 |
13 | + (void)printName;
14 | - (void)originalFunc;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/load/load/Other.m:
--------------------------------------------------------------------------------
1 | //
2 | // Normal.m
3 | // load
4 | //
5 | // Created by 张星宇 on 16/2/1.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "Other.h"
10 | #import
11 |
12 | @implementation Other
13 |
14 | static NSString *name;
15 |
16 | + (void)load {
17 | name = @"Other";
18 | NSLog(@"Load Class Other");
19 |
20 | Method originalFunc = class_getInstanceMethod([self class], @selector(originalFunc));
21 | Method swizzledFunc = class_getInstanceMethod([self class], @selector(swizzledFunc));
22 |
23 | method_exchangeImplementations(originalFunc, swizzledFunc);
24 | }
25 |
26 | + (void)printName {
27 | NSLog(@"%@",name);
28 | }
29 |
30 | - (void)originalFunc {
31 | NSLog(@"Original Output");
32 | }
33 |
34 | - (void)swizzledFunc {
35 | NSLog(@"Swizzled Output");
36 | }
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/load/load/Parent.h:
--------------------------------------------------------------------------------
1 | //
2 | // Parent.h
3 | // load
4 | //
5 | // Created by 张星宇 on 16/2/1.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface Parent : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/load/load/Parent.m:
--------------------------------------------------------------------------------
1 | //
2 | // Parent.m
3 | // load
4 | //
5 | // Created by 张星宇 on 16/2/1.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import "Parent.h"
10 |
11 | static int someNumber = 0;
12 | static NSMutableArray *someObjects;
13 |
14 | @implementation Parent
15 |
16 | + (void)load {
17 | NSLog(@"Load Class Parent");
18 | }
19 |
20 | + (void)initialize {
21 | NSLog(@"Initialize Parent, caller Class %@", [self class]);
22 | }
23 |
24 | /**
25 | * 下面这个才是正确的initialize方法的实现,需要判断是不是由自己这个类调用的。
26 | */
27 | + (void)initializeCorrect {
28 | if (self == [Parent class]) {
29 | someObjects = [[NSMutableArray alloc] init]; // 不方便编译期复制的对象在这里赋值
30 | NSLog(@"Initialize Parent, caller Class %@", [self class]);
31 | }
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/load/load/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // load
4 | //
5 | // Created by 张星宇 on 16/2/1.
6 | // Copyright © 2016年 zxy. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "Child.h"
11 | #import "Other.h"
12 |
13 | int main(int argc, const char * argv[]) {
14 | @autoreleasepool {
15 | NSLog(@"Main函数在这里开始");
16 | /**
17 | * 这会触发Child和父类的initialize方法
18 | */
19 | Child *child = [Child new];
20 |
21 | /**
22 | * 这时候other已经调用过load方法,所以输出结果是Swizzled Output
23 | */
24 | Other *other = [Other new];
25 | [other originalFunc];
26 | }
27 | return 0;
28 | }
29 |
--------------------------------------------------------------------------------
/runtime/README.md:
--------------------------------------------------------------------------------
1 | # Runtime相关的方法
2 |
3 | 这份代码是[《歪解Runtime》](http://www.jianshu.com/p/295cd2b6b42e)一文的demo,主要涉及Runtime和方法调用、转发相关的知识
4 |
--------------------------------------------------------------------------------
/runtime/runtime/MethodForwardTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // MyTest.h
3 | // runtime
4 | //
5 | // Created by 张星宇 on 16/1/2.
6 | // Copyright © 2016年 张星宇. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface MethodForwardTest : NSObject
12 |
13 | - (void)test;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/runtime/runtime/MethodSwizzlingTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // MethodSwizzlingTest.h
3 | // runtime
4 | //
5 | // Created by 张星宇 on 16/1/2.
6 | // Copyright © 2016年 张星宇. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface MethodSwizzlingTest : NSObject
12 |
13 | - (void)test;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/runtime/runtime/NSString+MyImplementation.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+MyImplementation.h
3 | // runtime
4 | //
5 | // Created by 张星宇 on 16/1/2.
6 | // Copyright © 2016年 张星宇. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSString (MyImplementation)
12 |
13 | - (NSString *)myLowercaseString;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/runtime/runtime/NSString+MyImplementation.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+MyImplementation.m
3 | // runtime
4 | //
5 | // Created by 张星宇 on 16/1/2.
6 | // Copyright © 2016年 张星宇. All rights reserved.
7 | //
8 |
9 | #import "NSString+MyImplementation.h"
10 |
11 | @implementation NSString (MyImplementation)
12 |
13 | - (NSString *)myLowercaseString {
14 | return [self uppercaseString];
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/runtime/runtime/Replacement.h:
--------------------------------------------------------------------------------
1 | //
2 | // Replacement.h
3 | // runtime
4 | //
5 | // Created by 张星宇 on 16/1/2.
6 | // Copyright © 2016年 张星宇. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface Replacement : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/runtime/runtime/Replacement.m:
--------------------------------------------------------------------------------
1 | //
2 | // Replacement.m
3 | // runtime
4 | //
5 | // Created by 张星宇 on 16/1/2.
6 | // Copyright © 2016年 张星宇. All rights reserved.
7 | //
8 |
9 | #import "Replacement.h"
10 |
11 | /**
12 | * 这个类配合MethodForwardTest使用。它实现了test,所以MethodForwardTest可以把方法转发给这个类
13 | * 的实例对象来处理
14 | */
15 | @implementation Replacement
16 |
17 | - (void)test {
18 | NSLog(@"备用实现者提供了test方法的实现");
19 | }
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/runtime/runtime/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // runtime
4 | //
5 | // Created by 张星宇 on 16/1/2.
6 | // Copyright © 2016年 张星宇. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "MethodForwardTest.h"
12 | #import "MethodSwizzlingTest.h"
13 |
14 | int main(int argc, const char * argv[]) {
15 | @autoreleasepool {
16 | MethodForwardTest *methodForward = [[MethodForwardTest alloc] init];
17 | [methodForward test]; // test 方法只有定义没有实现,需要进行消息转发
18 |
19 | MethodSwizzlingTest *methodSwizzling = [[MethodSwizzlingTest alloc] init];
20 | [methodSwizzling test]; // 演示Method Swizzling的实现
21 | }
22 | return 0;
23 | }
24 |
25 |
--------------------------------------------------------------------------------