├── .gitignore ├── DTcoreTextDemo ├── ZSTest.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── ZSTest │ ├── AppDelegate │ │ ├── AppDelegate.h │ │ └── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── BaseFiles │ │ ├── BaseNavigationController.h │ │ ├── BaseNavigationController.m │ │ ├── BaseViewController.h │ │ └── BaseViewController.m │ ├── Info.plist │ ├── Resource │ │ ├── Jsons │ │ │ └── TestData.json │ │ └── image.xcassets │ │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── TestFiles │ │ ├── DTCoreDTextTools │ │ │ ├── ZSDTCoreTextButton.h │ │ │ ├── ZSDTCoreTextButton.m │ │ │ ├── ZSDTCoreTextCell.h │ │ │ ├── ZSDTCoreTextCell.m │ │ │ ├── ZSDTCoreTextTools.h │ │ │ ├── ZSDTLazyImageView.h │ │ │ └── ZSDTLazyImageView.m │ │ ├── TestCoreTextLabelController.h │ │ ├── TestCoreTextLabelController.m │ │ ├── TestCoreTextViewController.h │ │ ├── TestCoreTextViewController.m │ │ ├── TestTableViewController.h │ │ ├── TestTableViewController.m │ │ ├── TestViewController.h │ │ ├── TestViewController.m │ │ └── TestViewController.xib │ ├── ThirdParty │ │ ├── DTCoreText.framework │ │ │ ├── DTCoreText │ │ │ ├── Headers │ │ │ │ ├── DTAccessibilityElement.h │ │ │ │ ├── DTAccessibilityViewProxy.h │ │ │ │ ├── DTAnchorHTMLElement.h │ │ │ │ ├── DTAttributedLabel.h │ │ │ │ ├── DTAttributedTextCell.h │ │ │ │ ├── DTAttributedTextContentView.h │ │ │ │ ├── DTAttributedTextView.h │ │ │ │ ├── DTBreakHTMLElement.h │ │ │ │ ├── DTCSSListStyle.h │ │ │ │ ├── DTCSSStylesheet.h │ │ │ │ ├── DTColor+Compatibility.h │ │ │ │ ├── DTColorFunctions.h │ │ │ │ ├── DTCompatibility.h │ │ │ │ ├── DTCoreText.h │ │ │ │ ├── DTCoreTextConstants.h │ │ │ │ ├── DTCoreTextFontCollection.h │ │ │ │ ├── DTCoreTextFontDescriptor.h │ │ │ │ ├── DTCoreTextFunctions.h │ │ │ │ ├── DTCoreTextGlyphRun.h │ │ │ │ ├── DTCoreTextLayoutFrame+Cursor.h │ │ │ │ ├── DTCoreTextLayoutFrame.h │ │ │ │ ├── DTCoreTextLayoutFrameAccessibilityElementGenerator.h │ │ │ │ ├── DTCoreTextLayoutLine.h │ │ │ │ ├── DTCoreTextLayouter.h │ │ │ │ ├── DTCoreTextMacros.h │ │ │ │ ├── DTCoreTextParagraphStyle.h │ │ │ │ ├── DTDictationPlaceholderTextAttachment.h │ │ │ │ ├── DTDictationPlaceholderView.h │ │ │ │ ├── DTHTMLAttributedStringBuilder.h │ │ │ │ ├── DTHTMLElement.h │ │ │ │ ├── DTHTMLParserNode.h │ │ │ │ ├── DTHTMLParserTextNode.h │ │ │ │ ├── DTHTMLWriter.h │ │ │ │ ├── DTHorizontalRuleHTMLElement.h │ │ │ │ ├── DTIframeTextAttachment.h │ │ │ │ ├── DTImage+HTML.h │ │ │ │ ├── DTImageTextAttachment.h │ │ │ │ ├── DTLazyImageView.h │ │ │ │ ├── DTLinkButton.h │ │ │ │ ├── DTListItemHTMLElement.h │ │ │ │ ├── DTObjectTextAttachment.h │ │ │ │ ├── DTStylesheetHTMLElement.h │ │ │ │ ├── DTTextAttachment.h │ │ │ │ ├── DTTextAttachmentHTMLElement.h │ │ │ │ ├── DTTextBlock.h │ │ │ │ ├── DTTextHTMLElement.h │ │ │ │ ├── DTVideoTextAttachment.h │ │ │ │ ├── DTWebVideoView.h │ │ │ │ ├── NSAttributedString+DTCoreText.h │ │ │ │ ├── NSAttributedString+HTML.h │ │ │ │ ├── NSAttributedString+SmallCaps.h │ │ │ │ ├── NSAttributedStringRunDelegates.h │ │ │ │ ├── NSCharacterSet+HTML.h │ │ │ │ ├── NSCoder+DTCompatibility.h │ │ │ │ ├── NSDictionary+DTCoreText.h │ │ │ │ ├── NSMutableAttributedString+HTML.h │ │ │ │ ├── NSMutableString+HTML.h │ │ │ │ ├── NSScanner+HTML.h │ │ │ │ ├── NSString+CSS.h │ │ │ │ ├── NSString+HTML.h │ │ │ │ ├── NSString+Paragraphs.h │ │ │ │ └── UIFont+DTCoreText.h │ │ │ ├── Info.plist │ │ │ ├── Modules │ │ │ │ └── module.modulemap │ │ │ └── _CodeSignature │ │ │ │ └── CodeResources │ │ ├── DTFoundation.framework │ │ │ ├── DTFoundation │ │ │ ├── Headers │ │ │ │ ├── DTASN1Parser.h │ │ │ │ ├── DTASN1Serialization.h │ │ │ │ ├── DTActionSheet.h │ │ │ │ ├── DTActivityTitleView.h │ │ │ │ ├── DTAlertView.h │ │ │ │ ├── DTAnimatedGIF.h │ │ │ │ ├── DTAsyncFileDeleter.h │ │ │ │ ├── DTBase64Coding.h │ │ │ │ ├── DTBlockFunctions.h │ │ │ │ ├── DTCompatibility.h │ │ │ │ ├── DTCoreGraphicsUtils.h │ │ │ │ ├── DTCustomColoredAccessory.h │ │ │ │ ├── DTExtendedFileAttributes.h │ │ │ │ ├── DTFolderMonitor.h │ │ │ │ ├── DTFoundation.h │ │ │ │ ├── DTFoundationConstants.h │ │ │ │ ├── DTHTMLParser.h │ │ │ │ ├── DTLog.h │ │ │ │ ├── DTObjectBlockExecutor.h │ │ │ │ ├── DTPieProgressIndicator.h │ │ │ │ ├── DTProgressHUD.h │ │ │ │ ├── DTReachability.h │ │ │ │ ├── DTSidePanelController.h │ │ │ │ ├── DTSidePanelControllerSegue.h │ │ │ │ ├── DTSidePanelPanGestureRecognizer.h │ │ │ │ ├── DTSmartPagingScrollView.h │ │ │ │ ├── DTTiledLayerWithoutFade.h │ │ │ │ ├── DTVersion.h │ │ │ │ ├── DTWeakSupport.h │ │ │ │ ├── NSArray+DTError.h │ │ │ │ ├── NSData+DTCrypto.h │ │ │ │ ├── NSDictionary+DTError.h │ │ │ │ ├── NSFileWrapper+DTCopying.h │ │ │ │ ├── NSMutableArray+DTMoving.h │ │ │ │ ├── NSObject+DTRuntime.h │ │ │ │ ├── NSString+DTFormatNumbers.h │ │ │ │ ├── NSString+DTPaths.h │ │ │ │ ├── NSString+DTURLEncoding.h │ │ │ │ ├── NSString+DTUtilities.h │ │ │ │ ├── NSURL+DTAppLinks.h │ │ │ │ ├── NSURL+DTComparing.h │ │ │ │ ├── NSURL+DTUnshorten.h │ │ │ │ ├── UIApplication+DTNetworkActivity.h │ │ │ │ ├── UIColor+DTDebug.h │ │ │ │ ├── UIImage+DTFoundation.h │ │ │ │ ├── UIView+DTActionHandlers.h │ │ │ │ ├── UIView+DTDebug.h │ │ │ │ ├── UIView+DTFoundation.h │ │ │ │ ├── UIViewController+DTSidePanelController.h │ │ │ │ └── UIWebView+DTFoundation.h │ │ │ ├── Info.plist │ │ │ ├── Modules │ │ │ │ └── module.modulemap │ │ │ └── _CodeSignature │ │ │ │ └── CodeResources │ │ └── SDWebImage │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ └── SDWebImage │ │ │ ├── NSData+ImageContentType.h │ │ │ ├── NSData+ImageContentType.m │ │ │ ├── NSImage+WebCache.h │ │ │ ├── NSImage+WebCache.m │ │ │ ├── SDImageCache.h │ │ │ ├── SDImageCache.m │ │ │ ├── SDImageCacheConfig.h │ │ │ ├── SDImageCacheConfig.m │ │ │ ├── SDWebImageCompat.h │ │ │ ├── SDWebImageCompat.m │ │ │ ├── SDWebImageDecoder.h │ │ │ ├── SDWebImageDecoder.m │ │ │ ├── SDWebImageDownloader.h │ │ │ ├── SDWebImageDownloader.m │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ ├── SDWebImageDownloaderOperation.m │ │ │ ├── SDWebImageManager.h │ │ │ ├── SDWebImageManager.m │ │ │ ├── SDWebImageOperation.h │ │ │ ├── SDWebImagePrefetcher.h │ │ │ ├── SDWebImagePrefetcher.m │ │ │ ├── UIButton+WebCache.h │ │ │ ├── UIButton+WebCache.m │ │ │ ├── UIImage+GIF.h │ │ │ ├── UIImage+GIF.m │ │ │ ├── UIImage+MultiFormat.h │ │ │ ├── UIImage+MultiFormat.m │ │ │ ├── UIImageView+HighlightedWebCache.h │ │ │ ├── UIImageView+HighlightedWebCache.m │ │ │ ├── UIImageView+WebCache.h │ │ │ ├── UIImageView+WebCache.m │ │ │ ├── UIView+WebCache.h │ │ │ ├── UIView+WebCache.m │ │ │ ├── UIView+WebCacheOperation.h │ │ │ └── UIView+WebCacheOperation.m │ ├── ZSTest.pch │ └── main.m ├── ZSTestTests │ ├── Info.plist │ └── ZSTestTests.m └── ZSTestUITests │ ├── Info.plist │ └── ZSTestUITests.m ├── README.md └── Screenshots ├── DTcoreTextDemoImg1.png ├── DTcoreTextDemoImg2.png ├── DTcoreTextDemoImg3.png └── DTcoreTextDemoImg5.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/AppDelegate/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Test 4 | // 5 | // Created by zhoushuai on 16/3/7. 6 | // Copyright © 2016年 zhoushuai. 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 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/AppDelegate/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Test 4 | // 5 | // Created by zhoushuai on 16/3/7. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "BaseNavigationController.h" 11 | #import "TestViewController.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | //拿到设备屏幕的大小 22 | CGRect rect = [UIScreen mainScreen].bounds; 23 | //创建一个window 24 | self.window = [[UIWindow alloc] initWithFrame:rect]; 25 | self.window.backgroundColor = [UIColor orangeColor]; 26 | //把当前的window作为程序的主window显示出来 27 | [self.window makeKeyAndVisible]; 28 | 29 | TestViewController *VC = [[TestViewController alloc] init]; 30 | BaseNavigationController *NVC = [[BaseNavigationController alloc] initWithRootViewController:VC]; 31 | self.window.rootViewController = NVC; 32 | return YES; 33 | } 34 | 35 | - (void)applicationWillResignActive:(UIApplication *)application { 36 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 37 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 38 | } 39 | 40 | - (void)applicationDidEnterBackground:(UIApplication *)application { 41 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 42 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 43 | } 44 | 45 | - (void)applicationWillEnterForeground:(UIApplication *)application { 46 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 47 | } 48 | 49 | - (void)applicationDidBecomeActive:(UIApplication *)application { 50 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 51 | } 52 | 53 | - (void)applicationWillTerminate:(UIApplication *)application { 54 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/BaseFiles/BaseNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseNavigationController.h 3 | // zstest 4 | // 5 | // Created by zhoushuai on 16/1/26. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BaseNavigationController : UINavigationController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/BaseFiles/BaseNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseNavigationController.m 3 | // zstest 4 | // 5 | // Created by zhoushuai on 16/1/26. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import "BaseNavigationController.h" 10 | 11 | @interface BaseNavigationController () 12 | 13 | @end 14 | 15 | @implementation BaseNavigationController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | /* 28 | #pragma mark - Navigation 29 | 30 | // In a storyboard-based application, you will often want to do a little preparation before navigation 31 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 32 | // Get the new view controller using [segue destinationViewController]. 33 | // Pass the selected object to the new view controller. 34 | } 35 | */ 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/BaseFiles/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // zstest 4 | // 5 | // Created by zhoushuai on 16/1/26. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BaseViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/BaseFiles/BaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.m 3 | // zstest 4 | // 5 | // Created by zhoushuai on 16/1/26. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface BaseViewController () 12 | 13 | @end 14 | 15 | @implementation BaseViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | self.view.backgroundColor = [UIColor whiteColor]; 20 | self.navigationController.navigationBar.translucent = NO; 21 | } 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | /* 29 | #pragma mark - Navigation 30 | 31 | // In a storyboard-based application, you will often want to do a little preparation before navigation 32 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 33 | // Get the new view controller using [segue destinationViewController]. 34 | // Pass the selected object to the new view controller. 35 | } 36 | */ 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/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 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/Resource/image.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/DTCoreDTextTools/ZSDTCoreTextButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCoreTextHandlerButton.h 3 | // MyCoreTextDemo 4 | // 5 | // Created by Bjmsp on 2018/1/24. 6 | // Copyright © 2018年 ZJ. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger,DTButtonUrlType){ 12 | DTCoreTextUrlType_unKnown, 13 | DTCoreTextUrlType_Http, 14 | DTCoreTextUrlType_Tel, 15 | DTCoreTextUrlType_Mail, 16 | }; 17 | 18 | 19 | //自定义的Button,用于处理富文本中的a标签处理 20 | @interface ZSDTCoreTextButton : UIButton 21 | 22 | @property (nonatomic, copy) NSString *url; 23 | @property (nonatomic, copy) NSString *identifier; 24 | @property (nonatomic, assign) DTButtonUrlType urlType; 25 | /** 26 | 类方法创建Button 27 | 28 | @param url a标签链接 29 | @param identifier a标签的ID标识,唯一 30 | @param frame a标签所在位置 31 | @return 返回一个用于响应的Button 32 | */ 33 | + (ZSDTCoreTextButton *)getButtonWithURL:(NSString *)url 34 | withIdentifier:(NSString *)identifier 35 | frame:(CGRect)frame; 36 | 37 | 38 | //打开链接 39 | + (void)openWebPage:(NSString *)url; 40 | 41 | //拨打电话 42 | + (void)dailPhoneNum:(NSString *)phoneNum; 43 | 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/DTCoreDTextTools/ZSDTCoreTextButton.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // DTCoreTextHandlerButton.m 4 | // MyCoreTextDemo 5 | // 6 | // Created by Bjmsp on 2018/1/24. 7 | // Copyright © 2018年 ZJ. All rights reserved. 8 | // 9 | 10 | #import "ZSDTCoreTextButton.h" 11 | @implementation ZSDTCoreTextButton 12 | 13 | #pragma mark - Life Cycle 14 | + (ZSDTCoreTextButton *)getButtonWithURL:(NSString *)url 15 | withIdentifier:(NSString *)identifier 16 | frame:(CGRect)frame{ 17 | ZSDTCoreTextButton *button = [[ZSDTCoreTextButton alloc] initWithFrame:frame]; 18 | button.url = url; 19 | button.identifier = identifier; 20 | [button addTarget:button action:@selector(onBtnClick:) forControlEvents:UIControlEventAllEvents]; 21 | return button; 22 | } 23 | 24 | - (DTButtonUrlType)urlType{ 25 | if ([_url hasPrefix:@"http"]) { 26 | return DTCoreTextUrlType_Http; 27 | }else if([_url hasPrefix:@"tel"]){ 28 | return DTCoreTextUrlType_Tel; 29 | }else if([_url hasPrefix:@"mailto"]){ 30 | return DTCoreTextUrlType_Mail; 31 | } 32 | return DTCoreTextUrlType_unKnown; 33 | } 34 | 35 | 36 | #pragma mark - private Methods 37 | -(void)onBtnClick:(ZSDTCoreTextButton *)btn{ 38 | switch (btn.urlType) { 39 | case DTCoreTextUrlType_Http:{ 40 | [ZSDTCoreTextButton openWebPage:btn.url]; 41 | break; 42 | } 43 | case DTCoreTextUrlType_Tel:{ 44 | NSString *phoneNum = [[btn.url componentsSeparatedByString:@":"] lastObject]; 45 | [ZSDTCoreTextButton dailPhoneNum:phoneNum]; 46 | break; 47 | } 48 | case DTCoreTextUrlType_Mail:{ 49 | break; 50 | } 51 | default: 52 | break; 53 | } 54 | } 55 | 56 | 57 | #pragma mark - Public Methods 58 | //打开链接 59 | + (void)openWebPage:(NSString *)url{ 60 | [[UIApplication sharedApplication ] openURL:[NSURL URLWithString:url]]; 61 | } 62 | 63 | //拨打电话 64 | + (void)dailPhoneNum:(NSString *)phoneNum{ 65 | NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",phoneNum]; 66 | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]; 67 | } 68 | 69 | 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/DTCoreDTextTools/ZSDTCoreTextCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZSDTCoreTextCell.h 3 | // ZSTest 4 | // 5 | // Created by Bjmsp on 2018/1/25. 6 | // Copyright © 2018年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZSDTCoreTextCell : DTAttributedTextCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/DTCoreDTextTools/ZSDTCoreTextCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZSDTCoreTextCell.m 3 | // ZSTest 4 | // 5 | // Created by Bjmsp on 2018/1/25. 6 | // Copyright © 2018年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import "ZSDTCoreTextCell.h" 10 | 11 | @implementation ZSDTCoreTextCell 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | } 16 | 17 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 18 | [super setSelected:selected animated:animated]; 19 | } 20 | 21 | - (void)setHTMLString:(NSString *)html{ 22 | [super setHTMLString:html]; 23 | [self setNeedsLayout]; 24 | } 25 | 26 | -(void)layoutSubviews{ 27 | [super layoutSubviews]; 28 | // CGRect frame = CGRectMake(0, 50, self.attributedTextContextView.bounds.size.width, self.attributedTextContextView.bounds.size.height); 29 | // self.attributedTextContextView.frame = frame; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/DTCoreDTextTools/ZSDTCoreTextTools.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZSDTCoreTextHeader.h 3 | // ZSTest 4 | // 5 | // Created by Bjmsp on 2018/1/25. 6 | // Copyright © 2018年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #ifndef ZSDTCoreTextHeader_h 10 | #define ZSDTCoreTextHeader_h 11 | 12 | //获取屏幕的大小 13 | #define ZSToolScreenWidth [UIScreen mainScreen].bounds.size.width 14 | #define ZSToolScreenHeight [UIScreen mainScreen].bounds.size.height 15 | 16 | #import 17 | #import 18 | #import "ZSDTLazyImageView.h" 19 | #import "ZSDTCoreTextButton.h" 20 | #import "ZSDTCoreTextCell.h" 21 | 22 | #endif /* ZSDTCoreTextHeader_h */ 23 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/DTCoreDTextTools/ZSDTLazyImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZSDTLazyImageView.h 3 | // ZSTest 4 | // 5 | // Created by Bjmsp on 2018/1/25. 6 | // Copyright © 2018年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZSDTLazyImageView : DTLazyImageView 12 | 13 | @property(nonatomic,weak) DTAttributedTextContentView *textContentView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/DTCoreDTextTools/ZSDTLazyImageView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZSDTLazyImageView.m 3 | // ZSTest 4 | // 5 | // Created by Bjmsp on 2018/1/25. 6 | // Copyright © 2018年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import "ZSDTLazyImageView.h" 10 | 11 | @implementation ZSDTLazyImageView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/TestCoreTextLabelController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestNormalViewViewController.h 3 | // ZSTest 4 | // 5 | // Created by Bjmsp on 2018/1/25. 6 | // Copyright © 2018年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestCoreTextLabelController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/TestCoreTextViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestCoreTextViewController.h 3 | // ZSTest 4 | // 5 | // Created by Bjmsp on 2018/1/25. 6 | // Copyright © 2018年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestCoreTextViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/TestTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestTableViewController.h 3 | // ZSTest 4 | // 5 | // Created by Bjmsp on 2018/1/25. 6 | // Copyright © 2018年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestTableViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/TestViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.h 3 | // Test 4 | // 5 | // Created by zhoushuai on 16/3/7. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestViewController :BaseViewController 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/TestFiles/TestViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestViewController.m 3 | // Test 4 | // 5 | // Created by zhoushuai on 16/3/7. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | 10 | #import "TestViewController.h" 11 | #import "TestCoreTextLabelController.h" 12 | #import "TestCoreTextViewController.h" 13 | #import "TestTableViewController.h" 14 | 15 | @interface TestViewController () 16 | 17 | @end 18 | 19 | @implementation TestViewController 20 | 21 | #pragma mark - Life Cycle 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | self.title = @"测试"; 25 | } 26 | 27 | 28 | #pragma mark - Respond To Events 29 | - (IBAction)TestDTcoreTextBtnClick:(UIButton *)sender { 30 | switch (sender.tag - 100) { 31 | case 1:{ 32 | 33 | TestCoreTextLabelController *testCoreTextLabelVC = [[TestCoreTextLabelController alloc] init]; 34 | [self.navigationController pushViewController:testCoreTextLabelVC animated:YES]; 35 | break; 36 | } 37 | case 2:{ 38 | TestCoreTextViewController *testCoreTextViewVC = [[TestCoreTextViewController alloc] init]; 39 | [self.navigationController pushViewController:testCoreTextViewVC animated:YES]; 40 | break; 41 | } 42 | case 3:{ 43 | TestTableViewController *testTabelVC = [[TestTableViewController alloc] init]; 44 | [self.navigationController pushViewController:testTabelVC animated:YES]; 45 | break; 46 | } 47 | default: 48 | break; 49 | } 50 | } 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/DTCoreText: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuyubeichen/DTCoreTextDemo/829c86e3c83628cf3096b1737ad7054f53ffe058/DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/DTCoreText -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTAccessibilityElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTAccessibilityElement.h 3 | // DTCoreText 4 | // 5 | // Created by Austen Green on 3/13/13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | A UIAccessibilityElement subclass that automatically converts its local accessibilityFrame to screen coordinates. 13 | */ 14 | @interface DTAccessibilityElement : UIAccessibilityElement 15 | /** 16 | The frame for the accessibility element in terms of the receiver's superview. 17 | */ 18 | @property (nonatomic, assign) CGRect localCoordinateAccessibilityFrame; 19 | 20 | /** 21 | The point for activating accessibility events in terms of the receiver's superview. 22 | */ 23 | @property (nonatomic, assign) CGPoint localCoordinateAccessibilityActivationPoint; 24 | 25 | /** 26 | The designated initializer. This class should be initialized with a UIView as its accessibility container. 27 | @param parentView The logical superview for the onscreen element the receiver represents. 28 | @returns Returns an initialized DTAccessibilityElement */ 29 | 30 | - (id)initWithParentView:(UIView *)parentView; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTAccessibilityViewProxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTAccessibilityViewProxy.h 3 | // DTCoreText 4 | // 5 | // Created by Austen Green on 5/6/13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DTTextAttachment.h" 11 | 12 | @protocol DTAccessibilityViewProxyDelegate; 13 | 14 | /** 15 | UIView proxy for DTAttributedTextContentView custom subviews for text attachments. 16 | */ 17 | 18 | @interface DTAccessibilityViewProxy : NSProxy 19 | /** 20 | The delegate for the proxy 21 | */ 22 | @property (nonatomic, unsafe_unretained, readonly) id delegate; 23 | 24 | /** 25 | The text attachment represented by the proxy 26 | */ 27 | @property (nonatomic, strong, readonly) DTTextAttachment *textAttachment; 28 | 29 | /** 30 | Creates a text attachment proxy for use with the VoiceOver system. 31 | @param textAttachment The that will be represented by a view. 32 | @param delegate An object conforming to that will provide a view when needed by the proxy. 33 | @returns A new proxy object 34 | */ 35 | 36 | - (id)initWithTextAttachment:(DTTextAttachment *)textAttachment delegate:(id)delegate; 37 | 38 | @end 39 | 40 | /** 41 | Protocol to provide custom views for accessibility elements representing a DTTextAttachment. 42 | */ 43 | @protocol DTAccessibilityViewProxyDelegate 44 | @required 45 | /** 46 | Provides a view for an attachment, e.g. an imageView for images 47 | 48 | @param attachment The that the requested view should represent 49 | @param proxy The frame that the view should use to fit on top of the space reserved for the attachment. 50 | @returns The sender requesting the view. 51 | */ 52 | 53 | - (UIView *)viewForTextAttachment:(DTTextAttachment *)attachment proxy:(DTAccessibilityViewProxy *)proxy; 54 | @end -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTAnchorHTMLElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLElementA.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 21.03.13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTHTMLElement.h" 10 | 11 | /** 12 | Specialized subclass of that represents a hyperlink. 13 | */ 14 | @interface DTAnchorHTMLElement : DTHTMLElement 15 | 16 | /** 17 | Foreground text color of the receiver when highlighted 18 | */ 19 | @property (nonatomic, strong) DTColor *highlightedTextColor; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTAttributedLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTAttributedLabel.h 3 | // DTCoreText 4 | // 5 | // Created by Brian Kenny on 1/17/13. 6 | // Copyright (c) 2013 Cocoanetics.com. All rights reserved. 7 | // 8 | 9 | #import "DTAttributedTextContentView.h" 10 | 11 | /** 12 | A Rich Text replacement for `UILabel`. It inherits from and as such you can also set the delegate to provide custom subviews i.e. for images or hyperlinks. 13 | 14 | Contrary to DTAttributedTextContentView the intrinsicContentSize is only as wide as the text content. To shrink the DTAttributedLabel to that call -sizeToFit. 15 | */ 16 | 17 | @interface DTAttributedLabel : DTAttributedTextContentView 18 | 19 | /** 20 | @name Setting Attributes 21 | */ 22 | 23 | /** 24 | The number of lines to display in the receiver 25 | */ 26 | @property(nonatomic, assign) NSInteger numberOfLines; 27 | 28 | /** 29 | The line break mode of the receiver 30 | */ 31 | @property(nonatomic, assign) NSLineBreakMode lineBreakMode; 32 | 33 | /** 34 | The string to append to the visible string in case a truncation occurs 35 | */ 36 | @property(nonatomic, strong) NSAttributedString *truncationString; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTAttributedTextCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTAttributedTextCell.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 8/4/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTAttributedTextContentView.h" 10 | #import 11 | 12 | /** 13 | This class represents a tableview cell that contains an attributed text as its content. 14 | */ 15 | @interface DTAttributedTextCell : UITableViewCell 16 | 17 | /** 18 | @name Creating Cells 19 | */ 20 | 21 | /** 22 | Creates a tableview cell with a given reuse identifier. 23 | @param reuseIdentifier The reuse identifier to use for the cell 24 | @returns A prepared cell 25 | */ 26 | - (id)initWithReuseIdentifier:(NSString *)reuseIdentifier; 27 | 28 | /** 29 | @name Setting Attributed Content 30 | */ 31 | 32 | /** 33 | The attributed string content of the receiver 34 | */ 35 | @property (nonatomic, strong) NSAttributedString *attributedString; 36 | 37 | /** 38 | A delegate implementing DTAttributedTextContentViewDelegate to provide custom subviews for images and links. 39 | */ 40 | @property (nonatomic, DT_WEAK_PROPERTY) IBOutlet id textDelegate; 41 | 42 | /** 43 | This method allows to set HTML text directly as content of the receiver. 44 | 45 | This will be converted to an attributed string. 46 | @param html The HTML string to set as the receiver's text content 47 | */ 48 | - (void)setHTMLString:(NSString *)html; 49 | 50 | /** 51 | This method allows to set HTML text directly as content of the receiver. 52 | 53 | This will be converted to an attributed string. 54 | @param html The HTML string to set as the receiver's text content 55 | @param options The options used for rendering the HTML 56 | */ 57 | - (void) setHTMLString:(NSString *)html options:(NSDictionary*) options; 58 | 59 | 60 | /** 61 | @name Getting Information 62 | */ 63 | 64 | /** 65 | Determines the row height that is needed in a specific table view to show the entire text content. 66 | 67 | The table view is necessary because from this the method can know the style. Also the accessory type needs to be set before calling this method because this reduces the available space. 68 | @note This value is only useful for table views with variable row height. 69 | @param tableView The table view to determine the height for. 70 | */ 71 | - (CGFloat)requiredRowHeightInTableView:(UITableView *)tableView; 72 | 73 | /** 74 | Determines whether the cells built-in contentView is allowed to dictate the size available for text. If active then attributedTextContextView's height always matches the cell height. 75 | 76 | Set this to `YES` for use in fixed row height table views, leave it `NO` for flexible row height table views. 77 | */ 78 | @property (nonatomic, assign) BOOL hasFixedRowHeight; 79 | 80 | /** 81 | The attributed text content view that the receiver uses to display the attributed text content. 82 | */ 83 | @property (nonatomic, readonly) DTAttributedTextContentView *attributedTextContextView; 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTBreakHTMLElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLElementBR.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 26.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTHTMLElement.h" 10 | 11 | /** 12 | Specialized subclass of that represents a line break. 13 | */ 14 | 15 | @interface DTBreakHTMLElement : DTHTMLElement 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTCSSStylesheet.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCSSStylesheet.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 9/5/11. 6 | // Copyright (c) 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DTHTMLElement; 12 | 13 | /** 14 | This class represents a CSS style sheet used for specifying formatting for certain CSS selectors. 15 | 16 | It supports matching styles by class, by id or by tag name. Hierarchy matching is not supported yet. 17 | */ 18 | @interface DTCSSStylesheet : NSObject 19 | 20 | 21 | /** 22 | @name Creating Stylesheets 23 | */ 24 | 25 | /** 26 | Creates the default stylesheet. 27 | 28 | This stylesheet is based on the standard styles that Webkit provides for these tags. This stylesheet is loaded from an embedded copy of default.css. 29 | */ 30 | + (DTCSSStylesheet *)defaultStyleSheet; 31 | 32 | 33 | /** 34 | Creates a stylesheet with a given style block 35 | 36 | @param css The CSS string for the style block 37 | */ 38 | - (id)initWithStyleBlock:(NSString *)css; 39 | 40 | 41 | /** 42 | @name Working with CSS Style Blocks 43 | */ 44 | 45 | 46 | /** 47 | Parses a style block string and adds the found style rules to the receiver. 48 | 49 | @param css The CSS string for the style block 50 | */ 51 | - (void)parseStyleBlock:(NSString *)css; 52 | 53 | 54 | /** 55 | Merges styles from given stylesheet into the receiver 56 | 57 | @param stylesheet the stylesheet to merge 58 | */ 59 | - (void)mergeStylesheet:(DTCSSStylesheet *)stylesheet; 60 | 61 | 62 | /** 63 | @name Accessing Style Information 64 | */ 65 | 66 | /** 67 | Returns a dictionary that contains the merged style for a given element and the applicable style rules from the receiver. 68 | 69 | @param element The HTML element. 70 | @param matchedSelectors The CSS selectors that caused a match 71 | @param ignoreInlineStyle If `YES` then the inline styles of the element will be ignored and only the receiver's styles used 72 | @returns The merged style dictionary containing only styles which selector matches the element 73 | */ 74 | - (NSDictionary *)mergedStyleDictionaryForElement:(DTHTMLElement *)element matchedSelectors:(NSSet * __autoreleasing*)matchedSelectors ignoreInlineStyle:(BOOL)ignoreInlineStyle; 75 | 76 | /** 77 | Returns a dictionary of the styles of the receiver 78 | */ 79 | - (NSDictionary *)styles; 80 | 81 | /** 82 | Returns an ordered (by declaration) set of the selectors for all of the styles. 83 | */ 84 | - (NSArray *)orderedSelectors; 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTColor+Compatibility.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTColor+Compatibility.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 1/9/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #if TARGET_OS_IPHONE 12 | 13 | #import 14 | 15 | /** 16 | Implementations of methods on NSColor/UIColor which are missing on the other platform. 17 | */ 18 | @interface UIColor (HTML) 19 | 20 | 21 | /** 22 | A quick method to return the alpha component of this UIColor by using the CGColorGetAlpha method. 23 | @returns The floating point alpha value of this UIColor. 24 | */ 25 | - (CGFloat)alphaComponent; 26 | 27 | @end 28 | 29 | #else 30 | 31 | /** 32 | Methods used to work with HTML representations of colors. 33 | */ 34 | @interface NSColor (HTML) 35 | 36 | 37 | /** 38 | Return a string hexadecimal representation of this NSColor. Splits the color into components with CGColor methods, re-maps them from percentages in the range 0-255, and returns the RGB color (alpha is stripped) in a six character string. 39 | @returns A CSS hexadecimal NSString specifying this NSColor. 40 | */ 41 | //- (NSString *)htmlHexString; 42 | 43 | #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_7 44 | /** 45 | Converts a CGColorRef into an NSColor by placing each component into an NSColor and pending on the component count to return a grayscale or rgb color. If there are not 2 (grayscale) or 4 (rgba) components the color is from an unsupported color space and nil is returned. 46 | @param cgColor The CGColorRef to convert 47 | @returns An NSColor of this CGColorRef 48 | */ 49 | + (NSColor *)colorWithCGColor:(CGColorRef)cgColor; 50 | 51 | /** 52 | Converts an NSColor into a CGColorRef. 53 | @returns A CGColorRef of this NSColor 54 | */ 55 | - (CGColorRef)CGColor DT_RETURNS_INNER_POINTER; 56 | #endif 57 | 58 | @end 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTColorFunctions.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTColorFunctions.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 9/9/13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | @class DTColor; 10 | 11 | /** 12 | Takes a CSS color string ('333', 'F9FFF9'), determines the RGB values used, and returns a UIColor object of that color. 13 | For each part of the RGB color those numbers for that color are converted to a number using a category on NSString. Then that number is divided by the maximum value, 15 for 3 character strings and 255 for 6 character strings, making the color a percentage and within the range 0.0 and 1.0 that UIColor uses. 14 | @param hexString A CSS hexadecimal color string of length 6 or 3. 15 | @returns A UIColor object generated from the hexadecimal color string with alpha 1.0. 16 | */ 17 | DTColor *DTColorCreateWithHexString(NSString *hexString); 18 | 19 | 20 | /** 21 | Takes an English string representing a color and maps it to a numeric RGB value as declared by the HTML and CSS specifications (see http://www.w3schools.com/html/html_colornames.asp). Also accepts CSS `#` hexadecimal colors, `rgba`, and `rgb` and does the right thing returning a corresponding UIColor. 22 | If a color begins with a `#` we know that it is a hexadecimal color and send it to colorWithHexString:. If the string is an `rgba()` color declaration the comma delimited r, g, b, and a values are made into percentages and then made into a UIColor which is returned. If the string is an `rgb()` color declaration the same process happens except with an alpha of 1.0. 23 | The last case is that the color string is not a numeric declaration `#`, nor a `rgba` or `rgb` declaration so the CSS color value matching the English string is found in a lookup dictionary and then passed to colorWithHexString: which will make a UIColor out of the hexadecimal string. 24 | @param name The CSS color string that we want to map from a name into an RGB color. 25 | @returns A UIColor object representing the name parameter as numeric values declared by the HTML and CSS specifications, a `rgba()` color, or a `rgb()` color. 26 | */ 27 | DTColor *DTColorCreateWithHTMLName(NSString *name); 28 | 29 | 30 | /** 31 | Return a string hexadecimal representation of this UIColor. Splits the color into components with CGColor methods, re-maps them from percentages to the range 0-255, and depending on the number of components returns a grayscale (repeating string of two characters) or color RGB (alpha is stripped) six character string. In the event of a non-2 or non-4 component color nil is returned as it is from an unsupported color space. 32 | @returns A CSS hexadecimal NSString specifying this UIColor. 33 | */ 34 | NSString *DTHexStringFromDTColor(DTColor *color); 35 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTCompatibility.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCompatibility.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Letterer on 09.04.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #pragma mark - iOS 10 | 11 | #if TARGET_OS_IPHONE 12 | 13 | // Compatibility Aliases 14 | #define DTColor UIColor 15 | #define DTImage UIImage 16 | #define DTFont UIFont 17 | 18 | // Edge Insets 19 | #define DTEdgeInsets UIEdgeInsets 20 | #define DTEdgeInsetsMake(top, left, bottom, right) UIEdgeInsetsMake(top, left, bottom, right) 21 | 22 | // NS-style text attributes are possible with iOS SDK 6.0 or higher 23 | #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_5_1 24 | #define DTCORETEXT_SUPPORT_NS_ATTRIBUTES 1 25 | #endif 26 | 27 | // NSParagraphStyle supports tabs as of iOS SDK 7.0 or higher 28 | #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1 29 | #define DTCORETEXT_SUPPORT_NSPARAGRAPHSTYLE_TABS 1 30 | #endif 31 | 32 | // iOS before 5.0 has leak in CoreText replacing attributes 33 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 34 | #define DTCORETEXT_NEEDS_ATTRIBUTE_REPLACEMENT_LEAK_FIX 1 35 | #endif 36 | 37 | // iOS 7 bug (rdar://14684188) workaround, can be removed once this bug is fixed 38 | #if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1 39 | #define DTCORETEXT_FIX_14684188 1 40 | #endif 41 | 42 | // constant for checking for iOS 6 43 | #define DTNSFoundationVersionNumber_iOS_6_0 992.00 44 | 45 | // constant for checking for iOS 7 46 | #define DTNSFoundationVersionNumber_iOS_7_0 1047.00 47 | 48 | 49 | // runtime-check if NS-style attributes are allowed 50 | static inline BOOL DTCoreTextModernAttributesPossible() 51 | { 52 | #if DTCORETEXT_SUPPORT_NS_ATTRIBUTES 53 | if (floor(NSFoundationVersionNumber) >= DTNSFoundationVersionNumber_iOS_6_0) 54 | { 55 | return YES; 56 | } 57 | #endif 58 | return NO; 59 | } 60 | 61 | // runtime-check if CoreText draws underlines 62 | static inline BOOL DTCoreTextDrawsUnderlinesWithGlyphs() 63 | { 64 | if (floor(NSFoundationVersionNumber) >= DTNSFoundationVersionNumber_iOS_7_0) 65 | { 66 | return YES; 67 | } 68 | 69 | return NO; 70 | } 71 | 72 | #if TARGET_CPU_ARM64 || TARGET_CPU_X86_64 73 | #define DTNSNumberFromCGFloat(x) [NSNumber numberWithDouble:x] 74 | #else 75 | #define DTNSNumberFromCGFloat(x) [NSNumber numberWithFloat:x] 76 | #endif 77 | 78 | #endif 79 | 80 | 81 | #pragma mark - Mac 82 | 83 | 84 | #if !TARGET_OS_IPHONE 85 | 86 | // Compatibility Aliases 87 | #define DTColor NSColor 88 | #define DTImage NSImage 89 | #define DTFont NSFont 90 | 91 | // Edge Insets 92 | #define DTEdgeInsets NSEdgeInsets 93 | #define DTEdgeInsetsMake(top, left, bottom, right) NSEdgeInsetsMake(top, left, bottom, right) 94 | 95 | // Mac supports NS-Style Text Attributes since 10.0 96 | #define DTCORETEXT_SUPPORT_NS_ATTRIBUTES 1 97 | #define DTCORETEXT_SUPPORT_NSPARAGRAPHSTYLE_TABS 1 98 | 99 | // theoretically MacOS before 10.8 might have a leak in CoreText replacing attributes 100 | #if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7 101 | #define DTCORETEXT_NEEDS_ATTRIBUTE_REPLACEMENT_LEAK_FIX 1 102 | #endif 103 | 104 | // NSValue has sizeValue on Mac, CGSizeValue on iOS 105 | #define CGSizeValue sizeValue 106 | 107 | // String functions named differently on Mac 108 | static inline NSString *NSStringFromCGRect(const CGRect rect) 109 | { 110 | return NSStringFromRect(NSRectFromCGRect(rect)); 111 | } 112 | 113 | static inline NSString *NSStringFromCGSize(const CGSize size) 114 | { 115 | return NSStringFromSize(NSSizeFromCGSize(size)); 116 | } 117 | 118 | static inline NSString *NSStringFromCGPoint(const CGPoint point) 119 | { 120 | return NSStringFromPoint(NSPointFromCGPoint(point)); 121 | } 122 | 123 | // runtime-check if NS-style attributes are allowed 124 | static inline BOOL DTCoreTextModernAttributesPossible() 125 | { 126 | return YES; 127 | } 128 | 129 | // runtime-check if CoreText draws underlines 130 | static inline BOOL DTCoreTextDrawsUnderlinesWithGlyphs() 131 | { 132 | return NO; 133 | } 134 | 135 | #define DTNSNumberFromCGFloat(x) [NSNumber numberWithDouble:x] 136 | #endif 137 | 138 | // this enables generic ceil, floor, abs, round functions that work for 64 and 32 bit 139 | #include 140 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTCoreText.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if TARGET_OS_IPHONE 4 | #import 5 | #elif TARGET_OS_MAC 6 | #import 7 | #endif 8 | 9 | // global constants 10 | #import "DTCoreTextMacros.h" 11 | #import "DTCoreTextConstants.h" 12 | #import "DTCompatibility.h" 13 | 14 | #import "DTColor+Compatibility.h" 15 | #import "DTImage+HTML.h" 16 | 17 | // common utilities 18 | #if TARGET_OS_IPHONE 19 | #import "DTCoreTextFunctions.h" 20 | #endif 21 | 22 | #import "DTColorFunctions.h" 23 | 24 | // common classes 25 | #import "DTCSSListStyle.h" 26 | #import "DTTextBlock.h" 27 | #import "DTCSSStylesheet.h" 28 | #import "DTCoreTextFontDescriptor.h" 29 | #import "DTCoreTextParagraphStyle.h" 30 | #import "DTHTMLAttributedStringBuilder.h" 31 | #import "DTHTMLElement.h" 32 | #import "DTAnchorHTMLElement.h" 33 | #import "DTBreakHTMLElement.h" 34 | #import "DTListItemHTMLElement.h" 35 | #import "DTHorizontalRuleHTMLElement.h" 36 | #import "DTStylesheetHTMLElement.h" 37 | #import "DTTextAttachmentHTMLElement.h" 38 | #import "DTTextHTMLElement.h" 39 | #import "DTHTMLWriter.h" 40 | #import "NSCharacterSet+HTML.h" 41 | #import "NSCoder+DTCompatibility.h" 42 | #import "NSDictionary+DTCoreText.h" 43 | #import "NSAttributedString+HTML.h" 44 | #import "NSAttributedString+SmallCaps.h" 45 | #import "NSAttributedString+DTCoreText.h" 46 | #import "NSMutableAttributedString+HTML.h" 47 | #import "NSMutableString+HTML.h" 48 | #import "NSScanner+HTML.h" 49 | #import "NSString+CSS.h" 50 | #import "NSString+HTML.h" 51 | #import "NSString+Paragraphs.h" 52 | 53 | // parsing classes 54 | #import "DTHTMLParserNode.h" 55 | #import "DTHTMLParserTextNode.h" 56 | 57 | // text attachment cluster 58 | #import "DTTextAttachment.h" 59 | #import "DTDictationPlaceholderTextAttachment.h" 60 | #import "DTIframeTextAttachment.h" 61 | #import "DTImageTextAttachment.h" 62 | #import "DTObjectTextAttachment.h" 63 | #import "DTVideoTextAttachment.h" 64 | 65 | // These classes only work with UIKit on iOS 66 | #if TARGET_OS_IPHONE 67 | 68 | #import "DTLazyImageView.h" 69 | #import "DTLinkButton.h" 70 | #import "DTWebVideoView.h" 71 | #import "NSAttributedStringRunDelegates.h" 72 | 73 | #import "DTAttributedLabel.h" 74 | #import "DTAttributedTextCell.h" 75 | #import "DTAttributedTextContentView.h" 76 | #import "DTAttributedTextView.h" 77 | #import "DTCoreTextFontCollection.h" 78 | #import "DTCoreTextGlyphRun.h" 79 | #import "DTCoreTextLayoutFrame.h" 80 | #import "DTCoreTextLayoutFrame+Cursor.h" 81 | #import "DTCoreTextLayoutLine.h" 82 | #import "DTCoreTextLayouter.h" 83 | 84 | #import "DTDictationPlaceholderView.h" 85 | 86 | #import "UIFont+DTCoreText.h" 87 | 88 | #import "DTAccessibilityElement.h" 89 | #import "DTAccessibilityViewProxy.h" 90 | #import "DTCoreTextLayoutFrameAccessibilityElementGenerator.h" 91 | 92 | #endif 93 | 94 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTCoreTextFontCollection.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCoreTextFontCollection.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 5/23/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | 10 | 11 | @class DTCoreTextFontDescriptor; 12 | 13 | /** 14 | Class representing a collection of fonts 15 | */ 16 | 17 | @interface DTCoreTextFontCollection : NSObject 18 | 19 | /** 20 | @name Creating Font Collections 21 | */ 22 | 23 | /** 24 | Creates a font collection with all available fonts on the system 25 | */ 26 | + (DTCoreTextFontCollection *)availableFontsCollection; 27 | 28 | /** 29 | @name Getting Information about Font Collections 30 | */ 31 | 32 | /** 33 | The font family names that occur in the receiver's list of fonts 34 | */ 35 | - (NSArray *)fontFamilyNames; 36 | 37 | /** 38 | The font descriptors describing all fonts in the receiver's font collection 39 | */ 40 | - (NSArray *)fontDescriptors; 41 | 42 | /** 43 | @name Searching for Fonts 44 | */ 45 | 46 | /** 47 | The font descriptor describing a font in the receiver's collection that matches a given descriptor 48 | @param descriptor The font descriptor to search for 49 | @returns The first found font descriptor in the font collection 50 | */ 51 | - (DTCoreTextFontDescriptor *)matchingFontDescriptorForFontDescriptor:(DTCoreTextFontDescriptor *)descriptor; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTCoreTextFunctions.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCoreTextFunctions.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 21.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTCompatibility.h" 10 | 11 | #if TARGET_OS_IPHONE 12 | 13 | #import 14 | 15 | /** 16 | Creates a CTFont from a UIFont 17 | @param font The `UIFont` 18 | @returns The matching CTFont 19 | */ 20 | CTFontRef DTCTFontCreateWithUIFont(UIFont *font); 21 | #endif 22 | 23 | /** 24 | Converts an NSLineBreakMode into CoreText line truncation type 25 | */ 26 | CTLineTruncationType DTCTLineTruncationTypeFromNSLineBreakMode(NSLineBreakMode lineBreakMode); 27 | 28 | /** 29 | Rounds the passed value according to the specified content scale. 30 | 31 | With contentScale 1 the results are identical to roundf, with Retina content scale 2 the results are multiples of 0.5. 32 | */ 33 | CGFloat DTRoundWithContentScale(CGFloat value, CGFloat contentScale); 34 | 35 | /** 36 | Rounds up the passed value according to the specified content scale. 37 | 38 | With contentScale 1 the results are identical to roundf, with Retina content scale 2 the results are multiples of 0.5. 39 | */ 40 | CGFloat DTCeilWithContentScale(CGFloat value, CGFloat contentScale); 41 | 42 | /** 43 | Rounds down the passed value according to the sspecifiedcontent scale. 44 | 45 | With contentScale 1 the results are identical to roundf, with Retina content scale 2 the results are multiples of 0.5. 46 | */ 47 | CGFloat DTFloorWithContentScale(CGFloat value, CGFloat contentScale); 48 | 49 | #pragma mark - Alignment Conversion 50 | 51 | #if DTCORETEXT_SUPPORT_NS_ATTRIBUTES 52 | /** 53 | Converts from NSTextAlignment to CTTextAligment 54 | */ 55 | CTTextAlignment DTNSTextAlignmentToCTTextAlignment(NSTextAlignment nsTextAlignment); 56 | 57 | /** 58 | Converts from CTTextAlignment to NSTextAligment 59 | */ 60 | NSTextAlignment DTNSTextAlignmentFromCTTextAlignment(CTTextAlignment ctTextAlignment); 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTCoreTextLayoutFrame+Cursor.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCoreTextLayoutFrame+Cursor.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 10.07.13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTCoreTextLayoutFrame.h" 10 | 11 | /** 12 | The **Cursor** category extends DTCoreTextLayoutFrame for working with a caret and determine the string index of touch coordinates. 13 | */ 14 | 15 | @interface DTCoreTextLayoutFrame (Cursor) 16 | 17 | /** 18 | Determines the closest string index to a point in the receiver's frame. 19 | 20 | This can be used to find the cursor position to position an input caret at. 21 | @param point The point 22 | @returns The resulting string index 23 | */ 24 | - (NSInteger)closestCursorIndexToPoint:(CGPoint)point; 25 | 26 | /** 27 | The rectangle to draw a caret for a given index 28 | @param index The string index for which to determine a cursor frame 29 | @returns The cursor rectangle 30 | */ 31 | - (CGRect)cursorRectAtIndex:(NSInteger)index; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTCoreTextLayoutFrameAccessibilityElementGenerator.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCoreTextLayoutFrameAccessibilityElementGenerator.h 3 | // DTCoreText 4 | // 5 | // Created by Austen Green on 3/13/13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DTAccessibilityElement.h" 11 | 12 | @class DTCoreTextLayoutFrame, DTTextAttachment; 13 | 14 | /** 15 | A block that provides accessibility information for the passed text attachments 16 | */ 17 | typedef id(^DTAttachmentViewProvider)(DTTextAttachment *textAttachment); 18 | 19 | /** 20 | Generates an array of objects conforming to the UIAccessibility informal protocol based on a . 21 | */ 22 | @interface DTCoreTextLayoutFrameAccessibilityElementGenerator : NSObject 23 | 24 | /** 25 | The designated initializer. The DTAttachmentViewProvider block may be used to provide custom subviews in place of a static accessibility element. 26 | @param frame The to generate accessibility elements for. 27 | @param view The logical superview of the elements - the view that owns the local coordinate system for drawing the frame. 28 | @param block A callback block which takes a object and returns an object that conforms to the UIAccessibility informal protocol. 29 | @returns Returns an array of objects conforming to the UIAccessibility informal protocol, suitable for presentation for the VoiceOver system. 30 | */ 31 | 32 | - (NSArray *)accessibilityElementsForLayoutFrame:(DTCoreTextLayoutFrame *)frame view:(UIView *)view attachmentViewProvider:(DTAttachmentViewProvider)block; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTCoreTextLayouter.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCoreTextLayouter.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 1/24/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | 10 | 11 | #if TARGET_OS_IPHONE 12 | #import 13 | #elif TARGET_OS_MAC 14 | #import 15 | #endif 16 | 17 | #import "DTCoreTextLayoutFrame.h" 18 | #import "DTCoreTextLayoutLine.h" 19 | #import "DTCoreTextGlyphRun.h" 20 | 21 | /** 22 | This class owns an attributed string and is able to create layoutFrames for certain ranges in this string. Optionally it caches these layout frames. 23 | */ 24 | @interface DTCoreTextLayouter : NSObject 25 | 26 | /** 27 | @name Creating a Layouter 28 | */ 29 | 30 | /** 31 | Designated Initializer. Creates a new Layouter with an attributed string 32 | @param attributedString The `NSAttributedString` to layout for 33 | @returns An initialized layouter 34 | */ 35 | - (id)initWithAttributedString:(NSAttributedString *)attributedString; 36 | 37 | 38 | /** 39 | @name Creating Layout Frames 40 | */ 41 | 42 | /** 43 | Creates a layout frame with a given rectangle and string range. The layouter fills the layout frame with as many lines as fit. You can query [DTCoreTextLayoutFrame visibleStringRange] for the range the fits and create another layout frame that continues the text from there to create multiple pages, for example for an e-book. 44 | @param frame The rectangle to fill with text 45 | @param range The string range to fill, pass {0,0} for the entire string (as much as fits) 46 | */ 47 | - (DTCoreTextLayoutFrame *)layoutFrameWithRect:(CGRect)frame range:(NSRange)range; 48 | 49 | /** 50 | If set to `YES` then the receiver will cache layout frames generated with layoutFrameWithRect:range: for a given rect 51 | */ 52 | @property (nonatomic, assign) BOOL shouldCacheLayoutFrames; 53 | 54 | 55 | /** 56 | @name Getting Information 57 | */ 58 | 59 | /** 60 | The attributed string that the layouter currently owns 61 | */ 62 | @property (nonatomic, strong) NSAttributedString *attributedString; 63 | 64 | /** 65 | The internal framesetter of the receiver 66 | */ 67 | @property (nonatomic, readonly) CTFramesetterRef framesetter; 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTCoreTextMacros.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCoreTextMacros.h 3 | // DTCoreText 4 | // 5 | // Created by Jean-Charles BERTIN on 5/28/14. 6 | // Copyright (c) 2014 Axinoe. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #ifndef DT_RETURNS_INNER_POINTER 12 | #if __has_attribute(objc_returns_inner_pointer) 13 | #define DT_RETURNS_INNER_POINTER __attribute__((objc_returns_inner_pointer)) 14 | #else 15 | #define DT_RETURNS_INNER_POINTER 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTDictationPlaceholderTextAttachment.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTDictationPlaceholderTextAttachment.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 06.02.13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTTextAttachment.h" 10 | 11 | /** 12 | This is a special subclass of DTTextAttachment used to represent the dictation placeholder. 13 | 14 | When encountering such an element DTAttributedTextContentView does not call the delegate to provide a subclass but automatically creates and adds a DTDictationPlaceholderView. 15 | */ 16 | 17 | @interface DTDictationPlaceholderTextAttachment : DTTextAttachment 18 | 19 | /** 20 | The string that inserting the dictation placeholder replaced, used for Undoing 21 | */ 22 | @property (nonatomic, retain) NSAttributedString *replacedAttributedString; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTDictationPlaceholderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTDictationPlaceholderView.h 3 | // DTRichTextEditor 4 | // 5 | // Created by Oliver Drobnik on 05.02.13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | A dictation placeholder to display in editors between the time the recording is complete until a recognized response is received. 13 | */ 14 | 15 | @interface DTDictationPlaceholderView : UIView 16 | 17 | /** 18 | Creates an appropriately sized DTDictationPlaceholderView with 3 animated purple dots 19 | */ 20 | + (DTDictationPlaceholderView *)placeholderView; 21 | 22 | /** 23 | The context of the receiver. This can be any object, for example the selection range to replace with the dictation result text 24 | */ 25 | @property (nonatomic, strong) id context; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTHTMLAttributedStringBuilder.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLAttributedStringBuilder.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 21.01.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DTHTMLElement; 12 | 13 | /** 14 | The block that gets executed whenever an element is flushed to the output string 15 | */ 16 | typedef void(^DTHTMLAttributedStringBuilderWillFlushCallback)(DTHTMLElement *); 17 | 18 | 19 | /** 20 | Class for building an `NSAttributedString` from an HTML document. 21 | */ 22 | @interface DTHTMLAttributedStringBuilder : NSObject 23 | 24 | /** 25 | @name Creating an Attributed String Builder 26 | */ 27 | 28 | /** 29 | Initializes and returns a new `NSAttributedString` object from the HTML contained in the given object and base URL. 30 | 31 | Options can be: 32 | 33 | - DTMaxImageSize: the maximum CGSize that a text attachment can fill 34 | - DTDefaultFontFamily: the default font family to use instead of Times New Roman 35 | - DTDefaultFontName: the default font face to use instead of Times New Roman 36 | - DTDefaultFontSize: the default font size to use instead of 12 37 | - DTDefaultTextColor: the default text color 38 | - DTDefaultLinkColor: the default color for hyperlink text 39 | - DTDefaultLinkDecoration: the default decoration for hyperlinks 40 | - DTDefaultLinkHighlightColor: the color to show while the hyperlink is highlighted 41 | - DTDefaultTextAlignment: the default text alignment for paragraphs 42 | - DTDefaultLineHeightMultiplier: The multiplier for line heights 43 | - DTDefaultFirstLineHeadIndent: The default indent for left margin on first line 44 | - DTDefaultHeadIndent: The default indent for left margin except first line 45 | - DTDefaultListIndent: The amount by which lists are indented 46 | - DTDefaultStyleSheet: The default style sheet to use 47 | - DTUseiOS6Attributes: use iOS 6 attributes for building (UITextView compatible) 48 | - DTWillFlushBlockCallBack: a block to be executed whenever content is flushed to the output string 49 | - DTIgnoreInlineStylesOption: All inline style information is being ignored and only style blocks used 50 | 51 | @param data The data in HTML format from which to create the attributed string. 52 | @param options Specifies how the document should be loaded. Contains values described in NSAttributedString(HTML). 53 | @param docAttributes Currently not in use. 54 | @returns Returns an initialized object, or `nil` if the data can’t be decoded. 55 | */ 56 | - (id)initWithHTML:(NSData *)data options:(NSDictionary *)options documentAttributes:(NSDictionary * __autoreleasing*)docAttributes; 57 | 58 | 59 | /** 60 | @name Generating Attributed Strings 61 | */ 62 | 63 | /** 64 | Creates the attributed string when called the first time. 65 | @returns An `NSAttributedString` representing the HTML document passed in the initializer. 66 | */ 67 | - (NSAttributedString *)generatedAttributedString; 68 | 69 | 70 | /** 71 | This block is called before the element is written to the output attributed string 72 | */ 73 | @property (nonatomic, copy) DTHTMLAttributedStringBuilderWillFlushCallback willFlushCallback; 74 | 75 | /** 76 | Setting this property to `YES` causes the tree of parse nodes to be preserved until the end of the generation process. This allows to output the HTML structure of the document for debugging. 77 | */ 78 | @property (nonatomic, assign) BOOL shouldKeepDocumentNodeTree; 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTHTMLParserNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLParserNode.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 26.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DTHTMLParserTextNode; 12 | 13 | /** 14 | This class represents one node in an HTML DOM tree. 15 | */ 16 | @interface DTHTMLParserNode : NSObject 17 | { 18 | NSDictionary *_attributes; 19 | } 20 | 21 | /** 22 | Designated initializer 23 | @param name The element name 24 | @param attributes The attributes dictionary 25 | @returns An initialized parser node. 26 | */ 27 | - (id)initWithName:(NSString *)name attributes:(NSDictionary *)attributes; 28 | 29 | /** 30 | The name of the receiver 31 | */ 32 | @property (nonatomic, copy) NSString *name; 33 | 34 | /** 35 | The attributes of the receiver. 36 | */ 37 | @property (nonatomic, copy) NSDictionary *attributes; 38 | 39 | /** 40 | A weak link to the parent node of the receiver 41 | */ 42 | @property (nonatomic, DT_WEAK_PROPERTY) DTHTMLParserNode *parentNode; 43 | 44 | /** 45 | The child nodes of the receiver 46 | */ 47 | @property (nonatomic, readonly) NSArray *childNodes; 48 | 49 | /** 50 | Adds a child node to the receiver. 51 | @param childNode The child node to be appended to the list of children 52 | */ 53 | - (void)addChildNode:(DTHTMLParserNode *)childNode; 54 | 55 | /** 56 | Removes a child node from the receiver 57 | @param childNode The child node to remove 58 | */ 59 | - (void)removeChildNode:(DTHTMLParserNode *)childNode; 60 | 61 | /** 62 | Removes all child nodes from the receiver 63 | */ 64 | - (void)removeAllChildNodes; 65 | 66 | /** 67 | Hierarchy representation of the receiver including all attributes and children 68 | */ 69 | - (NSString *)debugDescription; 70 | 71 | /** 72 | Concatenated contents of all text nodes 73 | */ 74 | - (NSString *)text; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTHTMLParserTextNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLParserTextNode.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 26.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTHTMLParserNode.h" 10 | 11 | /** 12 | Specialized sub class of that represents text inside a node 13 | */ 14 | @interface DTHTMLParserTextNode : DTHTMLParserNode 15 | 16 | /** 17 | Designated initializer with the characters that make up the text. 18 | @param characters The characters of the string 19 | @returns The initialized text node 20 | */ 21 | - (id)initWithCharacters:(NSString *)characters; 22 | 23 | /** 24 | Returns the receivers character contents 25 | */ 26 | @property (nonatomic, readonly) NSString *characters; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTHTMLWriter.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLWriter.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 23.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | /** 10 | Class to generate HTML from `NSAttributedString` instances. 11 | */ 12 | @interface DTHTMLWriter : NSObject 13 | 14 | /** 15 | @name Creating an HTML Writer 16 | */ 17 | 18 | /** 19 | Creates a writer with a given `NSAttributedString` as input 20 | @param attributedString An attributed string 21 | */ 22 | - (id)initWithAttributedString:(NSAttributedString *)attributedString; 23 | 24 | /** 25 | @name Generating HTML 26 | */ 27 | 28 | /** 29 | Generates a HTML representation of the attributed string 30 | @returns The generated string 31 | */ 32 | - (NSString *)HTMLString; 33 | 34 | 35 | /** 36 | Generates a HTML fragment representation of the attributed string including inlined styles and no html or head elements 37 | @returns The generated string 38 | */ 39 | - (NSString *)HTMLFragment; 40 | 41 | /** 42 | @name Properties 43 | */ 44 | 45 | /** 46 | If specified then all absolute font sizes (px) will be divided by this value. This is useful if you specified a text size multiplier when converting HTML to the attributed string you are processing. 47 | */ 48 | @property (nonatomic, assign) CGFloat textScale; 49 | 50 | /** 51 | If YES, preserve whitespaces in HTML by using "Apple-converted-space". Default YES. 52 | */ 53 | @property (nonatomic, assign) BOOL useAppleConvertedSpace; 54 | 55 | /** 56 | The attributed string that the writer is processing. 57 | */ 58 | @property (nonatomic, readonly) NSAttributedString *attributedString; 59 | 60 | 61 | /** 62 | The HTML element tag name to use for paragraphs. Defaults to @"p". 63 | */ 64 | @property (nonatomic, strong) NSString *paragraphTagName; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTHorizontalRuleHTMLElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLElementHR.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 26.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTHTMLElement.h" 10 | 11 | /** 12 | Specialized subclass of that deals with list items. 13 | */ 14 | 15 | @interface DTHorizontalRuleHTMLElement : DTHTMLElement 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTIframeTextAttachment.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTTextAttachmentIframe.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 22.04.13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTTextAttachment.h" 10 | 11 | /** 12 | A specialized subclass in the DTTextAttachment class cluster to represent an IFRAME 13 | */ 14 | 15 | @interface DTIframeTextAttachment : DTTextAttachment 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTImage+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTImage+HTML.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 1/9/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #if TARGET_OS_IPHONE 10 | 11 | #import 12 | 13 | /** 14 | Category used to have the same method available for unit testing on Mac on iOS. 15 | */ 16 | @interface UIImage (HTML) 17 | 18 | /** 19 | Retrieve the NSData representation of a UIImage. Used to encode UIImages in DTTextAttachments. 20 | 21 | @returns The NSData representation of the UIImage instance receiving this message. Convenience method for UIImagePNGRepresentation(). 22 | */ 23 | - (NSData *)dataForPNGRepresentation; 24 | 25 | @end 26 | 27 | #else 28 | 29 | /** 30 | Category used to have the same method available for unit testing on Mac on iOS. 31 | */ 32 | @interface NSImage (HTML) 33 | 34 | 35 | /** 36 | Retrieve the NSData representation of a NSImage. 37 | 38 | @returns The NSData representation of the NSImage instance receiving this message. 39 | */ 40 | - (NSData *)dataForPNGRepresentation; 41 | 42 | @end 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTImageTextAttachment.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTTextAttachmentImage.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 22.04.13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTTextAttachment.h" 10 | 11 | @class DTImage; 12 | 13 | /** 14 | A specialized subclass in the DTTextAttachment class cluster to represent an embedded image 15 | */ 16 | 17 | @interface DTImageTextAttachment : DTTextAttachment 18 | 19 | /** 20 | The designated initializer which will be called by [DTTextAttachment textAttachmentWithElement:options:] for image attachments. 21 | @param element A DTHTMLElement that must have a valid tag name and should have a size. Any element attributes are copied to the text attachment's elements. 22 | @param options An NSDictionary of options. Used to specify the max image size with the key DTMaxImageSize. 23 | */ 24 | - (id)initWithElement:(DTHTMLElement *)element options:(NSDictionary *)options; 25 | 26 | /** 27 | @name Alternate Representations 28 | */ 29 | 30 | /** 31 | Retrieves a string which is in the format "data:image/png;base64,%@" with this DTTextAttachment's content's data representation encoded in Base64 string encoding. For image contents only. 32 | @returns A Base64 encoded string of the png data representation of this text attachment's image contents. 33 | */ 34 | - (NSString *)dataURLRepresentation; 35 | 36 | /** 37 | The image represented by the receiver 38 | */ 39 | @property (nonatomic, strong) DTImage *image; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTLazyImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTLazyImageView.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 5/20/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DTLazyImageView; 12 | 13 | // Notifications 14 | extern NSString * const DTLazyImageViewWillStartDownloadNotification; 15 | extern NSString * const DTLazyImageViewDidFinishDownloadNotification; 16 | 17 | /** 18 | Protocol for delegates of to inform them about the downloaded image dimensions. 19 | */ 20 | @protocol DTLazyImageViewDelegate 21 | @optional 22 | 23 | /** 24 | Method that informs the delegate about the image size so that it can re-layout text. 25 | @param lazyImageView The image view 26 | @param size The image size that is now known 27 | */ 28 | - (void)lazyImageView:(DTLazyImageView *)lazyImageView didChangeImageSize:(CGSize)size; 29 | @end 30 | 31 | /** 32 | This `UIImageView` subclass lazily loads an image from a URL and informs a delegate once the size of the image is known. 33 | */ 34 | 35 | @interface DTLazyImageView : UIImageView 36 | 37 | /** 38 | @name Providing Content 39 | */ 40 | 41 | /** 42 | The URL of the remote image 43 | */ 44 | @property (nonatomic, strong) NSURL *url; 45 | 46 | /** 47 | The URL Request that is to be used for downloading the image. If this is left `nil` the a new URL Request will be created 48 | */ 49 | @property (nonatomic, strong) NSMutableURLRequest *urlRequest; 50 | 51 | /** 52 | @name Getting Information 53 | */ 54 | 55 | /** 56 | Set to `YES` to support progressive display of progressive downloads 57 | */ 58 | @property (nonatomic, assign) BOOL shouldShowProgressiveDownload; 59 | 60 | /** 61 | The delegate, conforming to , to inform when the image dimensions were determined 62 | */ 63 | @property (nonatomic, DT_WEAK_PROPERTY) id delegate; 64 | 65 | 66 | /** 67 | @name Cancelling Download 68 | */ 69 | 70 | /** 71 | Cancels the image downloading 72 | */ 73 | - (void)cancelLoading; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTLinkButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTLinkButton.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 1/16/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | /** 10 | Constant for highlighting notification 11 | */ 12 | 13 | extern NSString *DTLinkButtonDidHighlightNotification; 14 | 15 | /** 16 | A button that corresponds to a hyperlink. 17 | 18 | Multiple parts of the same hyperlink synchronize their looks through the guid. You can show link text in a different color for normal and highlighted mode by setting the button images for these states. 19 | */ 20 | @interface DTLinkButton : UIButton 21 | 22 | 23 | /** 24 | The URL that this button corresponds to. 25 | */ 26 | @property (nonatomic, copy) NSURL *URL; 27 | 28 | 29 | /** 30 | The unique identifier (GUID) that all parts of the same hyperlink have in common. 31 | */ 32 | @property (nonatomic, copy) NSString *GUID; 33 | 34 | 35 | /** 36 | The minimum size that the receiver should respond on hits with. Adjusts the bounds if they are smaller than the passed size. 37 | */ 38 | @property (nonatomic, assign) CGSize minimumHitSize; 39 | 40 | 41 | /** 42 | A Boolean value that determines whether tapping the button causes it to show a gray rounded rectangle. Default is YES. 43 | */ 44 | @property(nonatomic) BOOL showsTouchWhenHighlighted; 45 | 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTListItemHTMLElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLElementLI.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 27.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTHTMLElement.h" 10 | 11 | /** 12 | Specialized subclass of that deals with list items. 13 | */ 14 | @interface DTListItemHTMLElement : DTHTMLElement 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTObjectTextAttachment.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTObjectTextAttachment.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 22.04.13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTTextAttachment.h" 10 | 11 | /** 12 | A specialized subclass in the DTTextAttachment class cluster to represent an generic object 13 | */ 14 | 15 | @interface DTObjectTextAttachment : DTTextAttachment 16 | 17 | /** 18 | The DTHTMLElement child nodes of the receiver. This array is only used for object tags at the moment. 19 | */ 20 | @property (nonatomic, strong) NSArray *childNodes; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTStylesheetHTMLElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLElementStylesheet.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 29.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTHTMLElement.h" 10 | 11 | @class DTCSSStylesheet; 12 | 13 | /** 14 | This is a specialized subclass of representing a style block. 15 | */ 16 | @interface DTStylesheetHTMLElement : DTHTMLElement 17 | 18 | /** 19 | Parses the text children and assembles the resulting stylesheet. 20 | */ 21 | - (DTCSSStylesheet *)stylesheet; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTTextAttachmentHTMLElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLElementAttachment.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 26.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTHTMLElement.h" 10 | 11 | /** 12 | Specialized subclass of for dealing with instances, e.g. images. 13 | */ 14 | 15 | @interface DTTextAttachmentHTMLElement : DTHTMLElement 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTTextBlock.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTTextBlock.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 04.03.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTCompatibility.h" 10 | 11 | /** 12 | Class that represents a block of text with attributes like padding or a background color. 13 | */ 14 | @interface DTTextBlock : NSObject 15 | 16 | /** 17 | The space to be applied between the layouted text and the edges of the receiver 18 | */ 19 | @property (nonatomic, assign) DTEdgeInsets padding; 20 | 21 | 22 | /** 23 | The background color to paint behind the text in the receiver 24 | */ 25 | @property (nonatomic, strong) DTColor *backgroundColor; 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTTextHTMLElement.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTHTMLElementText.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 26.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTHTMLElement.h" 10 | 11 | /** 12 | Specialized subclass of that deals with text. It represents a text node. The text inside a DTHTMLElement can consist of any number of such text nodes. 13 | */ 14 | 15 | @interface DTTextHTMLElement : DTHTMLElement 16 | 17 | /** 18 | The text content of the element. 19 | */ 20 | @property (nonatomic, strong) NSString *text; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTVideoTextAttachment.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTTextAttachmentVideo.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 22.04.13. 6 | // Copyright (c) 2013 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTTextAttachment.h" 10 | 11 | /** 12 | A specialized subclass in the DTTextAttachment class cluster to represent an embedded video 13 | */ 14 | 15 | @interface DTVideoTextAttachment : DTTextAttachment 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/DTWebVideoView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTWebVideoView.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 8/5/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DTWebVideoView; 12 | @class DTTextAttachment; 13 | 14 | /** 15 | Protocol for delegates of 16 | */ 17 | @protocol DTWebVideoViewDelegate 18 | 19 | @optional 20 | 21 | /** 22 | Asks the delegate if an external URL may be opened 23 | @param videoView The web video view 24 | @param url The external URL that is asked to be opened 25 | @returns `YES` if the app may be left to open the external URL 26 | */ 27 | 28 | - (BOOL)videoView:(DTWebVideoView *)videoView shouldOpenExternalURL:(NSURL *)url; 29 | 30 | @end 31 | 32 | 33 | /** 34 | The class represents a custom subview for use in to represent an embedded video. 35 | 36 | Embedded videos work by loading the video URL in a UIWebView which iOS then replaces with the built-in media player view. The URL of the embed script depends on the service and needs to be added to the webView:shouldStartLoadWithRequest:navigationType:. You want to allow the URL for the embed script, but disallow all other requests which for example occur if a user taps on the YouTube logo. If you were to allow this type of navigation then the YouTube website would be loaded in the video view. For these scenarios there is the videoView:shouldOpenExternalURL: method in DTWebVideoViewDelegate. If you respond with `YES` (which is default if the method is not implemented) then the URL will be opened in Safari. 37 | 38 | To add additional video services please add them in the mentioned location and submit a pull request for the addition. 39 | */ 40 | @interface DTWebVideoView : UIView 41 | 42 | /** 43 | The delegate of the video view 44 | */ 45 | @property (nonatomic, DT_WEAK_PROPERTY) id delegate; 46 | 47 | /** 48 | The text attachment representing an embedded video. 49 | */ 50 | @property (nonatomic, strong) DTTextAttachment *attachment; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSAttributedString+DTCoreText.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedString+DTCoreText.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 2/1/12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | @class DTCSSListStyle; 10 | @class DTTextBlock; 11 | 12 | /** 13 | Convenience Methods that mimics similar methods available on Mac 14 | */ 15 | @interface NSAttributedString (DTCoreText) 16 | 17 | /** 18 | @name Working with Text Attachments 19 | */ 20 | 21 | /** 22 | Retrieves the DTTextAttachment objects that match the given predicate. 23 | 24 | With this method you can for example find all images that have a certain URL. 25 | 26 | @param predicate The predicate to apply for filtering or `nil` to not filter by attachment 27 | @param theClass The class that attachments need to have, or `nil` for all attachments regardless of class 28 | @returns The filtered array of attachments 29 | */ 30 | - (NSArray *)textAttachmentsWithPredicate:(NSPredicate *)predicate class:(Class)theClass; 31 | 32 | /** 33 | @name Calculating Ranges 34 | */ 35 | 36 | 37 | /** 38 | Returns the index of the item at the given location within the list. 39 | 40 | @param list The text list. 41 | @param location The location of the item. 42 | @returns Returns the index within the list. 43 | */ 44 | - (NSInteger)itemNumberInTextList:(DTCSSListStyle *)list atIndex:(NSUInteger)location; 45 | 46 | 47 | /** 48 | Returns the range of the given text list that contains the given location. 49 | 50 | @param list The text list. 51 | @param location The location in the text. 52 | @returns The range of the given text list containing the location. 53 | */ 54 | - (NSRange)rangeOfTextList:(DTCSSListStyle *)list atIndex:(NSUInteger)location; 55 | 56 | /** 57 | Returns the range of the given text block that contains the given location. 58 | 59 | @param textBlock The text block. 60 | @param location The location in the text. 61 | @returns The range of the given text block containing the location. 62 | */ 63 | - (NSRange)rangeOfTextBlock:(DTTextBlock *)textBlock atIndex:(NSUInteger)location; 64 | 65 | /** 66 | Returns the range of the given href anchor. 67 | 68 | @param anchorName The name of the anchor. 69 | @returns The range of the given anchor. 70 | */ 71 | - (NSRange)rangeOfAnchorNamed:(NSString *)anchorName; 72 | 73 | /** 74 | Returns the range of the hyperlink at the given index. 75 | 76 | @param location The location to query 77 | @param URL The URL that is found at this location or `NULL` if this is not needed 78 | @returns The range of the given hyperlink. 79 | */ 80 | - (NSRange)rangeOfLinkAtIndex:(NSUInteger)location URL:(NSURL * __autoreleasing*)URL; 81 | 82 | /** 83 | Returns the range of a field at the given index. 84 | 85 | @param location The location of the field 86 | @returns The range of the field. If there is no field at this location it returns {NSNotFound, 0}. 87 | */ 88 | - (NSRange)rangeOfFieldAtIndex:(NSUInteger)location; 89 | 90 | #ifndef COVERAGE 91 | // exclude method from coverage testing, those are just convenience methods 92 | 93 | /** 94 | @name Converting to Other Representations 95 | */ 96 | 97 | /** 98 | Encodes the receiver into a generic HTML representation. 99 | 100 | @returns An HTML string. 101 | */ 102 | - (NSString *)htmlString; 103 | 104 | 105 | /** 106 | Encodes the receiver into a generic HTML fragment representation. Styles are inlined and no html or head tags are included. 107 | 108 | @returns An HTML string. 109 | */ 110 | - (NSString *)htmlFragment; 111 | 112 | /** 113 | Converts the receiver into plain text. 114 | 115 | This is different from the `string` method of `NSAttributedString` by also erasing placeholders for text attachments. 116 | 117 | @returns The receiver converted to plain text. 118 | */ 119 | - (NSString *)plainTextString; 120 | 121 | #endif 122 | 123 | /** 124 | @name Creating Special Attributed Strings 125 | */ 126 | 127 | 128 | /** 129 | Create a prefix for a paragraph in a list 130 | 131 | @param listCounter The value for the list item. 132 | @param listStyle The list style 133 | @param listIndent The amount in px to indent the list 134 | @param attributes The attribute dictionary for the text to be prefixed 135 | @returns An attributed string with the list prefix 136 | */ 137 | + (NSAttributedString *)prefixForListItemWithCounter:(NSUInteger)listCounter listStyle:(DTCSSListStyle *)listStyle listIndent:(CGFloat)listIndent attributes:(NSDictionary *)attributes; 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSAttributedString+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedString+HTML.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 1/9/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | @class NSAttributedString; 10 | 11 | /** 12 | Methods for generating an `NSAttributedString` from HTML data. Those methods exist on Mac but have not been ported (publicly) to iOS. This project aims to remedy this. 13 | 14 | For a list of available options to pass to any of these methods please refer to [DTHTMLAttributedStringBuilder initWithHTML:options:documentAttributes:]. 15 | */ 16 | 17 | @interface NSAttributedString (HTML) 18 | 19 | /** 20 | @name Creating an NSAttributedString 21 | */ 22 | 23 | /** 24 | Initializes and returns a new `NSAttributedString` object from the HTML contained in the given object and base URL. 25 | @param data The data in HTML format from which to create the attributed string. 26 | @param docAttributes Currently not in used. 27 | @returns Returns an initialized object, or `nil` if the data can’t be decoded. 28 | @see [DTHTMLAttributedStringBuilder initWithHTML:options:documentAttributes:] for a list of available options 29 | */ 30 | - (id)initWithHTMLData:(NSData *)data documentAttributes:(NSDictionary * __autoreleasing*)docAttributes; 31 | 32 | /** 33 | Initializes and returns a new `NSAttributedString` object from the HTML contained in the given object and base URL. 34 | @param data The data in HTML format from which to create the attributed string. 35 | @param baseURL An `NSURL` that represents the base URL for all links within the HTML. 36 | @param docAttributes Currently not in used. 37 | @returns Returns an initialized object, or `nil` if the data can’t be decoded. 38 | @see [DTHTMLAttributedStringBuilder initWithHTML:options:documentAttributes:] for a list of available options 39 | */ 40 | - (id)initWithHTMLData:(NSData *)data baseURL:(NSURL *)baseURL documentAttributes:(NSDictionary * __autoreleasing*)docAttributes; 41 | 42 | /** 43 | Initializes and returns a new `NSAttributedString` object from the HTML contained in the given object and base URL. 44 | 45 | @param data The data in HTML format from which to create the attributed string. 46 | @param options Specifies how the document should be loaded. 47 | @param docAttributes Currently not in used. 48 | @returns Returns an initialized object, or `nil` if the data can’t be decoded. 49 | @see [DTHTMLAttributedStringBuilder initWithHTML:options:documentAttributes:] for a list of available options 50 | */ 51 | - (id)initWithHTMLData:(NSData *)data options:(NSDictionary *)options documentAttributes:(NSDictionary * __autoreleasing*)docAttributes; 52 | 53 | 54 | /** 55 | @name Working with Custom HTML Attributes 56 | */ 57 | 58 | /** 59 | Retrieves the dictionary of custom HTML attributes active at the given string index 60 | @param index The string index to query 61 | @returns The custom HTML attributes dictionary or `nil` if there aren't any at this index 62 | */ 63 | - (NSDictionary *)HTMLAttributesAtIndex:(NSUInteger)index; 64 | 65 | /** 66 | Retrieves the range that an attribute with a given name is active for, beginning with the passed index 67 | 68 | Since a custom HTML attribute can occur in multiple individual attribute dictionaries this extends the range from the passed index outwards until the full range of the custom HTML attribute has been found. Those range extensions have to have an identical value, as established by comparing them to the value of the custom attribute at the index with isEqual: 69 | @param name The name of the custom attribute to remove 70 | @param index The string index to query 71 | @returns The custom HTML attributes dictionary or `nil` if there aren't any at this index 72 | */ 73 | - (NSRange)rangeOfHTMLAttribute:(NSString *)name atIndex:(NSUInteger)index; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSAttributedString+SmallCaps.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedString+SmallCaps.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 31.01.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | /** 10 | Methods that generated an attributed string with Small Caps, even if the used fonts don't support them natively. 11 | 12 | This category works equally for Mac and iOS attributed strings. 13 | */ 14 | 15 | @interface NSAttributedString (SmallCaps) 16 | 17 | /** 18 | Creates an `NSAttributedString` from the given text and attributes and synthesizes small caps. On iPad there is only one font that has native small caps, for all other fonts the small caps are synthesized by reducing the font size for all lowercase characters. 19 | 20 | @param text The string to convert into an attributed string 21 | @param attributes A dictionary with attributes for the attributed string 22 | @returns An attributed string with synthesized small caps. 23 | */ 24 | + (NSAttributedString *)synthesizedSmallCapsAttributedStringWithText:(NSString *)text attributes:(NSDictionary *)attributes; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSAttributedStringRunDelegates.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSAttributedStringRunDelegates.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver on 14.01.11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #if TARGET_OS_IPHONE 10 | #import 11 | #elif TARGET_OS_MAC 12 | #import 13 | #endif 14 | 15 | void embeddedObjectDeallocCallback(void *context); 16 | CGFloat embeddedObjectGetAscentCallback(void *context); 17 | CGFloat embeddedObjectGetDescentCallback(void *context); 18 | CGFloat embeddedObjectGetWidthCallback(void *context); 19 | CTRunDelegateRef createEmbeddedObjectRunDelegate(id obj); 20 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSCharacterSet+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSCharacterSet+HTML.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 1/15/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | Category on NSCharacterSet to create character sets frequently used and relevant to HTML and CSS string manipulations. Each character set is only initialized once. 13 | */ 14 | @interface NSCharacterSet (HTML) 15 | 16 | /** 17 | @name HTML Character Sets 18 | */ 19 | 20 | 21 | /** 22 | Creates an alpha-numeric character set, appropriate for tag names. 23 | @returns An NSCharacterSet with alpha-numeric characters. a-Z, 0-9. 24 | */ 25 | + (NSCharacterSet *)tagNameCharacterSet; 26 | 27 | 28 | /** 29 | Creates an alpha-numeric character set just as tagNameCharacterSet does but also with colon, dash, and underscore characters, appropriate for tag attribute names. 30 | @returns An NSCharacterSet with alpha-numeric characters and colon :, dash -, and underscore _'. 31 | */ 32 | + (NSCharacterSet *)tagAttributeNameCharacterSet; 33 | 34 | 35 | /** 36 | Creates a characterset of all whitespace and newline characters that can be ignored between HTML tags 37 | @returns An NSCharacterSet of ignorable characters 38 | */ 39 | + (NSCharacterSet *)ignorableWhitespaceCharacterSet; 40 | 41 | /** 42 | Creates a character set with the apostrophe character ' (used as single quote agnostic of direction) and double quote character " (agnostic of direction). 43 | @returns An NSCharacterSet with the single quote and double quote characters: ', ". 44 | */ 45 | + (NSCharacterSet *)quoteCharacterSet; 46 | 47 | 48 | /** 49 | Creates a character set with the characters forward slash / and closing angle bracket aka greater than sign >, then forms the union of this character set with the [whitespace character set](https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSCharacterSet_Class/Reference/Reference.html) which includes space, tab, newline, and nextline characters. Useful to find the end of an attribute. 50 | @returns An NSCharacterSet with the forward slash, closing angle bracket characters, tab, space, newline, and nextline characters. 51 | */ 52 | + (NSCharacterSet *)nonQuotedAttributeEndCharacterSet; 53 | 54 | 55 | /** 56 | @name CSS Character Sets 57 | */ 58 | 59 | /** 60 | Creates an alpha-numeric character set just as tagNameCharacterSet does but also with the dash and underscore characters. Does not contain the colon character because it will mess up parsing of CSS style attributes. Useful for CSS attribute names. 61 | @returns An NSCharacterSet with alpha-numeric characters, dash, and underscore characters. 62 | */ 63 | + (NSCharacterSet *)cssStyleAttributeNameCharacterSet; 64 | 65 | 66 | /** 67 | Characterset of characters that make up units in CSS values 68 | @returns An NSCharacterSet 69 | */ 70 | + (NSCharacterSet *)cssLengthValueCharacterSet; 71 | 72 | 73 | /** 74 | Characterset of characters that make up units in CSS lengths 75 | @returns An NSCharacterSet 76 | */ 77 | + (NSCharacterSet *)cssLengthUnitCharacterSet; 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSCoder+DTCompatibility.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSCoder+DTCompatibility.h 3 | // DTCoreText 4 | // 5 | // Created by Ryan Johnson on 14/02/19. 6 | // Copyright (c) 2014 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSCoder (DTCompatibility) 12 | 13 | #if !TARGET_OS_IPHONE 14 | - (void)encodeCGSize:(CGSize)size forKey:(NSString *)key; 15 | - (CGSize)decodeCGSizeForKey:(NSString *)key; 16 | #endif 17 | 18 | - (void)encodeDTEdgeInsets:(DTEdgeInsets)insets forKey:(NSString *)key; 19 | - (DTEdgeInsets)decodeDTEdgeInsetsForKey:(NSString *)key; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSDictionary+DTCoreText.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+DTRichText.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 7/21/11. 6 | // Copyright 2011 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import "DTCompatibility.h" 10 | 11 | @class DTCoreTextParagraphStyle; 12 | @class DTCoreTextFontDescriptor; 13 | 14 | /** 15 | Convenience methods for editors dealing with Core Text attribute dictionaries. 16 | */ 17 | @interface NSDictionary (DTCoreText) 18 | 19 | /** 20 | @name Getting State information 21 | */ 22 | 23 | /** 24 | Whether the font in the receiver's attributes is bold. 25 | @returns `YES` if the text has a bold trait 26 | */ 27 | - (BOOL)isBold; 28 | 29 | /** 30 | Whether the font in the receiver's attributes is italic. 31 | @returns `YES` if the text has an italic trait 32 | */ 33 | - (BOOL)isItalic; 34 | 35 | /** 36 | Whether the receiver's attributes contains underlining. 37 | @returns `YES` if the text is underlined 38 | */ 39 | - (BOOL)isUnderline; 40 | 41 | /** 42 | Whether the receiver's attributes contains strike-through. 43 | @returns `YES` if the text is strike-through 44 | */ 45 | - (BOOL)isStrikethrough; 46 | 47 | /** 48 | Whether the receiver's attributes contain a DTTextAttachment 49 | @returns `YES` if there is an attachment 50 | */ 51 | - (BOOL)hasAttachment; 52 | 53 | /** 54 | The header level of the receiver 55 | @returns The header level (1-6) or 0 if no header level is set 56 | */ 57 | - (NSUInteger)headerLevel; 58 | 59 | /** 60 | @name Getting Style Information 61 | */ 62 | 63 | /** 64 | Retrieves the DTCoreTextParagraphStyle from the receiver's attributes. This supports both `CTParagraphStyle` as well as `NSParagraphStyle` as a possible representation of the text's paragraph style. 65 | @returns The paragraph style 66 | */ 67 | - (DTCoreTextParagraphStyle *)paragraphStyle; 68 | 69 | /** 70 | Retrieves the DTCoreTextFontDescriptor from the receiver's attributes. This supports both `CTFont` as well as `UIFont` as a possible representation of the text's font. 71 | @returns The font descriptor 72 | */ 73 | - (DTCoreTextFontDescriptor *)fontDescriptor; 74 | 75 | /** 76 | Retrieves the foreground color. On iOS as UIColor, on Mac as NSColor. This supports both the CT as well as the NS/UIKit method of specifying the color. If no foreground color is defined in the receiver then black is assumed. 77 | @returns The platform-specific color defined for the foreground 78 | */ 79 | - (DTColor *)foregroundColor; 80 | 81 | /** 82 | Retrieves the background color. On iOS as UIColor, on Mac as NSColor. This supports both the DT as well as the NS/UIKit method of specifying the color. If no background color is defined in the receiver then `nil` is returned 83 | @returns The platform-specific color defined for the background, or `nil` if none is defined 84 | */ 85 | - (DTColor *)backgroundColor; 86 | 87 | /** 88 | The text kerning value 89 | @returns the kerning value 90 | */ 91 | - (CGFloat)kerning; 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSMutableAttributedString+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableAttributedString+HTML.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 4/14/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import "DTCoreTextConstants.h" 10 | 11 | @class DTCoreTextParagraphStyle, DTCoreTextFontDescriptor; 12 | 13 | /** 14 | Methods for appending `NSString` instances to mutable attributed strings 15 | */ 16 | @interface NSMutableAttributedString (HTML) 17 | 18 | /** 19 | Appends a string with the same attributes as this string to this string. 20 | 21 | If the last character of the receiver contains a placeholder for a it is removed from the appended string. Also fields (e.g. list prefixes) are not extended 22 | @param string The string to be appended to this string. */ 23 | - (void)appendString:(NSString *)string; 24 | 25 | /** 26 | Appends a string with a given paragraph style and font to this string. 27 | @param string The string to be appended to this string. 28 | @param paragraphStyle Paragraph style to be attributed to the appended string. 29 | @param fontDescriptor Font descriptor to be attributed to the appended string. */ 30 | - (void)appendString:(NSString *)string withParagraphStyle:(DTCoreTextParagraphStyle *)paragraphStyle fontDescriptor:(DTCoreTextFontDescriptor *)fontDescriptor; 31 | 32 | /** 33 | Adds the paragraph terminator `\n` and makes sure that the previous font and paragraph styles extend to include it 34 | */ 35 | - (void)appendEndOfParagraph; 36 | 37 | /** 38 | @name Working with Custom HTML Attributes 39 | */ 40 | 41 | /** 42 | Adds the custom HTML attributes with the given value on the given range, optionally replacing occurrences of an attribute with the same name. 43 | @param name The name of the custom HTML attribute 44 | @param value The value to set for the custom attribute 45 | @param range The range to add the custom attribute for 46 | @param replaceExisting `YES` if ranges that have an attribute with the same name should be replaced. With `NO` the attribute is only added for ranges where there is no attribute with the given name 47 | */ 48 | - (void)addHTMLAttribute:(NSString *)name value:(id)value range:(NSRange)range replaceExisting:(BOOL)replaceExisting; 49 | 50 | /** 51 | Adds the custom HTML attributes with the given value from the given range. 52 | @param name The name of the custom HTML attribute 53 | @param range The range to add the custom attribute for 54 | */ 55 | - (void)removeHTMLAttribute:(NSString *)name range:(NSRange)range; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSMutableString+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableString+HTML.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 01.02.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | 10 | /** 11 | Categories needed for modifying mutable strings, as needed for DTCoreText. 12 | */ 13 | @interface NSMutableString (HTML) 14 | 15 | /** 16 | Removes the trailing whitespace from the receiver. 17 | */ 18 | - (void)removeTrailingWhitespace; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSScanner+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSScanner+HTML.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 1/12/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | @class DTColor; 10 | 11 | /** 12 | Extensions for NSScanner to deal with HTML-specific parsing, primarily CSS-related things 13 | */ 14 | @interface NSScanner (HTML) 15 | 16 | /** 17 | @name Working with CSS 18 | */ 19 | 20 | /** 21 | Scans for a CSS attribute used in CSS style sheets 22 | @param name An optional output parameter that will contain the name of the scanned attribute if successful 23 | @param value An optional output parameter that will contain the value of the scanned attribute if successful. This value may be a string or an array. 24 | @returns `YES` if an URL String could be scanned 25 | */ 26 | - (BOOL)scanCSSAttribute:(NSString * __autoreleasing*)name value:(id __autoreleasing*)value; 27 | 28 | 29 | /** 30 | Scans for URLs used in CSS style sheets 31 | @param urlString An optional output parameter that will contain the scanned URL string if successful 32 | @returns `YES` if an URL String could be scanned 33 | */ 34 | - (BOOL)scanCSSURL:(NSString * __autoreleasing*)urlString; 35 | 36 | 37 | /** 38 | Scans for a typical HTML color, typically either #FFFFFF, rgb(255,255,255) or a HTML color name. 39 | @param color An optional output parameter that will contain the scanned color if successful 40 | @returns `YES` if a color could be scanned 41 | */ 42 | - (BOOL)scanHTMLColor:(DTColor * __autoreleasing*)color; 43 | 44 | /** 45 | Scans for a typical HTML color, typically either #FFFFFF, rgb(255,255,255) or a HTML color name. 46 | @param color An optional output parameter that will contain the scanned color if successful 47 | @param name An optional output parameter that will contain the HTML color string 48 | @returns `YES` if a color could be scanned 49 | */ 50 | - (BOOL)scanHTMLColor:(DTColor * __autoreleasing*)color HTMLName:(NSString * __autoreleasing*)name; 51 | 52 | @end 53 | 54 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSString+CSS.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+CSS.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 31.01.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | @class DTColor; 10 | 11 | /** 12 | Methods to make dealing with CSS strings easier. Extract shadows from this string, extract CSS styles found in this string, extract the pixel size of a CSS measurement relative to the current text size, and extract the CSS pixel measurement of this string. 13 | */ 14 | @interface NSString (CSS) 15 | 16 | /** 17 | Examine a string for all CSS styles that are applied to it and return a dictionary of those styles. Implemented using scanCSSAttribute: which is defined in NSScanner+HTML.h. 18 | @returns A dictionary of strings containing the CSS styles which are applied to this string. 19 | */ 20 | - (NSDictionary *)dictionaryOfCSSStyles; 21 | 22 | /** 23 | Determines if the receiver contains a CSS length value, that is a number with optional period and unit (em, pt, px). 24 | @returns `YES` if this is a CSS length value 25 | */ 26 | - (BOOL)isCSSLengthValue; 27 | 28 | /** 29 | Calculates a pixel-based length from the receiver based on the current text size in pixels. Used in DTHTMLElement. 30 | @param textSize The current size which the CSS size is relative to. 31 | @param textScale The factor by which absolute sizes are scaled. Set to 1.0f to keep the original value. 32 | @returns A float that is the textSize 33 | */ 34 | - (CGFloat)pixelSizeOfCSSMeasureRelativeToCurrentTextSize:(CGFloat)textSize textScale:(CGFloat)textScale; 35 | 36 | /** 37 | Decodes edge inset values from the CSS attribute string. This is used for margin and padding which might have varying number of elements. 38 | @param textSize The current size which the CSS size is relative to. 39 | @param textScale The factor by which absolute sizes are scaled. Set to 1.0f to keep the original value. 40 | @returns The edge insets that this describes 41 | */ 42 | - (DTEdgeInsets)DTEdgeInsetsRelativeToCurrentTextSize:(CGFloat)textSize textScale:(CGFloat)textScale; 43 | 44 | /** 45 | Parse CSS shadow styles, consisting of color, blur, and offset, out of this string. The input string must be comma delimited in the format: ? ? where the third length and the color are not required per CSS shadows. To calculate the sizes of the blur and offset pixelSizeOfCSSMeasureRelativeToCurrentTextSize is used. Used in DTHTMLElement. 46 | @param textSize In order to determine the shadow offset we need what text size it will be displayed at. 47 | @param color Used if no shadow attribute color is found. 48 | @returns An array of dictionaries, each of which is a shadow consisting of color, blur, and offset keys value pairs. 49 | */ 50 | - (NSArray *)arrayOfCSSShadowsWithCurrentTextSize:(CGFloat)textSize currentColor:(DTColor *)color; 51 | 52 | /** 53 | Decodes a content attribute which might contained unicode sequences. 54 | */ 55 | - (NSString *)stringByDecodingCSSContentAttribute; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSString+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+HTML.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 1/9/11. 6 | // Copyright 2011 Drobnik.com. All rights reserved. 7 | // 8 | 9 | /** 10 | Methods for making HTML strings easier and quicker to handle. 11 | */ 12 | @interface NSString (HTML) 13 | 14 | /** 15 | Extract the numbers from this string and return them as an NSUInteger. 16 | @returns An NSUInteger of the number characters in this string. 17 | */ 18 | - (NSUInteger)integerValueFromHex; 19 | 20 | 21 | /** 22 | Test whether or not this string is numeric only. 23 | @returns If this string consists only of numeric characters 0-9. 24 | */ 25 | - (BOOL)isNumeric; 26 | 27 | /** 28 | Test whether the entire receiver consists of only whitespace characters. 29 | @returns `YES` if the receiver only has whitespace and newline characters 30 | */ 31 | - (BOOL)isIgnorableWhitespace; 32 | 33 | /** 34 | Read through this string and store the numbers included, then divide them by 100 giving a percentage. 35 | @returns The numbers contained in this string, as a percentage. 36 | */ 37 | - (float)percentValue; 38 | 39 | 40 | /** 41 | Return a copy of this string with all whitespace characters replaced by space characters. 42 | @returns A copy of this string with only space characters for whitespace. 43 | */ 44 | - (NSString *)stringByNormalizingWhitespace; 45 | 46 | 47 | /** 48 | Determines if the first character of this string is in the parameter characterSet. 49 | @param characterSet The character set to compare the first character of this string against. 50 | @returns If the first character of this string is in character set. 51 | */ 52 | - (BOOL)hasPrefixCharacterFromSet:(NSCharacterSet *)characterSet; 53 | 54 | 55 | /** 56 | Determines if the last character of this string is in the parameter characterSet. 57 | @param characterSet The character set to compare the last character of this string against. 58 | @returns If the last character of this string is in the character set. 59 | */ 60 | - (BOOL)hasSuffixCharacterFromSet:(NSCharacterSet *)characterSet; 61 | 62 | 63 | /** 64 | Convert a string into a proper HTML string by converting special characters into HTML entities. For example: an ellipsis `…` is represented by the entity `…` in order to display it correctly across text encodings. 65 | @returns A string containing HTML that now uses proper HTML entities. 66 | */ 67 | - (NSString *)stringByAddingHTMLEntities; 68 | 69 | 70 | /** 71 | Convert a string from HTML entities into correct character representations using UTF8 encoding. For example: an ellipsis entity represented by `…` is converted into `…`. 72 | @returns A string without HTML entities, instead having the actual characters formerly represented by HTML entities. 73 | */ 74 | - (NSString *)stringByReplacingHTMLEntities; 75 | 76 | 77 | /** 78 | Replaces occurrences of more two or more spaces with a range of alternating non-breaking space and regular space. It also encloses these parts with a span of class 'Apple-converted-space' 79 | */ 80 | - (NSString *)stringByAddingAppleConvertedSpace; 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/NSString+Paragraphs.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Paragraphs.h 3 | // DTRichTextEditor 4 | // 5 | // Created by Oliver Drobnik on 11/11/11. 6 | // Copyright (c) 2011 Cocoanetics. All rights reserved. 7 | // 8 | 9 | 10 | /** 11 | Methods simplifying dealing with text that is in paragraphs. 12 | 13 | The character used to separate paragraphs from each other is '\n'. 14 | */ 15 | @interface NSString (Paragraphs) 16 | 17 | /** 18 | Extends the given range such that it contains only full paragraphs. 19 | 20 | @param range The string range 21 | @param parBegIndex An optional output parameter that is filled with the beginning index of the extended range 22 | @param parEndIndex An optional output parameter that is filled with the ending index of the extended range 23 | @returns The extended string range 24 | */ 25 | - (NSRange)rangeOfParagraphsContainingRange:(NSRange)range parBegIndex:(NSUInteger *)parBegIndex parEndIndex:(NSUInteger *)parEndIndex; 26 | 27 | 28 | /** 29 | Determines if the given index is the first character of a new paragraph. 30 | 31 | This is done by examining the string, index 0 or characters following a newline are considered to be a first character of a new paragraph. 32 | @param index The index to examine 33 | @returns `YES` if the given index is the first character of a new paragraph, `NO` otherwise 34 | */ 35 | - (BOOL)indexIsAtBeginningOfParagraph:(NSUInteger)index; 36 | 37 | /** 38 | Returns the string range of the paragraph with the given index. 39 | 40 | @param index The paragraph index to inspect 41 | @returns The string range of the paragraph 42 | */ 43 | - (NSRange)rangeOfParagraphAtIndex:(NSUInteger)index; 44 | 45 | 46 | /** 47 | Counts the number of paragraphs in the receiver 48 | @returns The number of paragraph characters (\n) in the receiver 49 | */ 50 | - (NSUInteger)numberOfParagraphs; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Headers/UIFont+DTCoreText.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIFont+DTCoreText.h 3 | // DTCoreText 4 | // 5 | // Created by Oliver Drobnik on 11.12.12. 6 | // Copyright (c) 2012 Drobnik.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | Methods to translate from `CTFont` to `UIFont` 13 | */ 14 | 15 | @interface UIFont (DTCoreText) 16 | 17 | /** 18 | Creates a UIFont that matches the provided CTFont. 19 | @param ctFont a `CTFontRef` 20 | @returns The matching UIFont 21 | */ 22 | + (UIFont *)fontWithCTFont:(CTFontRef)ctFont; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuyubeichen/DTCoreTextDemo/829c86e3c83628cf3096b1737ad7054f53ffe058/DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Info.plist -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTCoreText.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module DTCoreText { 2 | umbrella header "DTCoreText.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/DTFoundation: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuyubeichen/DTCoreTextDemo/829c86e3c83628cf3096b1737ad7054f53ffe058/DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/DTFoundation -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTASN1Serialization.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTASN1Serialization.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 3/9/13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import "DTASN1Parser.h" 10 | 11 | /** 12 | Convenience factory for deserializing ASN.1 data 13 | */ 14 | @interface DTASN1Serialization : NSObject 15 | 16 | /** 17 | Creates an object from ASN.1 data 18 | @param data The ASN.1 data 19 | @returns The deserialized object or `nil` if an error occured 20 | */ 21 | + (nullable id)objectWithData:(nonnull NSData *)data; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTActionSheet.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTActionSheet.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 08.06.12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | // the block to execute when an option button is tapped 13 | typedef void (^DTActionSheetBlock)(void); 14 | 15 | /** 16 | Extends UIActionSheet with support for blocks. 17 | */ 18 | 19 | #if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 20 | 21 | @interface DTActionSheet : UIActionSheet 22 | 23 | /** 24 | Initializes the action sheet using the specified title. 25 | @param title The title 26 | */ 27 | - (instancetype)initWithTitle:(NSString *)title; 28 | 29 | /** 30 | Adds a custom button to the action sheet. 31 | @param title The title of the new button. 32 | @param block The block to execute when the button is tapped. 33 | @returns The index of the new button. Button indices start at 0 and increase in the order they are added. 34 | */ 35 | - (NSInteger)addButtonWithTitle:(NSString *)title block:(DTActionSheetBlock)block; 36 | 37 | /** 38 | Adds a custom destructive button to the action sheet. 39 | 40 | Since there can only be one destructive button a previously marked destructive button becomes a normal button. 41 | @param title The title of the new button. 42 | @param block The block to execute when the button is tapped. 43 | @returns The index of the new button. Button indices start at 0 and increase in the order they are added. 44 | */ 45 | - (NSInteger)addDestructiveButtonWithTitle:(NSString *)title block:(DTActionSheetBlock)block; 46 | 47 | /** 48 | Adds a custom cancel button to the action sheet. 49 | 50 | Since there can only be one cancel button a previously marked cancel button becomes a normal button. 51 | @param title The title of the new button. 52 | @param block The block to execute when the button is tapped. 53 | @returns The index of the new button. Button indices start at 0 and increase in the order they are added. 54 | */ 55 | - (NSInteger)addCancelButtonWithTitle:(NSString *)title block:(DTActionSheetBlock)block; 56 | 57 | /** 58 | Adds a custom cancel button to the action sheet. 59 | 60 | Since there can only be one cancel button a previously marked cancel button becomes a normal button. 61 | @param title The title of the new button. 62 | @returns The index of the new button. Button indices start at 0 and increase in the order they are added. 63 | */ 64 | - (NSInteger)addCancelButtonWithTitle:(NSString *)title; 65 | 66 | /** 67 | * Use the actionSheetDelegate when you want to to receive UIActionSheetDelegate messages. 68 | */ 69 | @property (nonatomic, DT_WEAK_PROPERTY) id actionSheetDelegate; 70 | 71 | @end 72 | #endif 73 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTActivityTitleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTActivityTitleView.h 3 | // DTFoundation 4 | // 5 | // Created by Rene Pirringer on 12.09.12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Alternative view for showing titles with a configurable activity indicator 11 | instead of default title view in navigationItem. 12 | */ 13 | @interface DTActivityTitleView : UIView 14 | 15 | /** 16 | Title that is shown 17 | */ 18 | @property (nonatomic, copy) NSString *title; 19 | 20 | /** 21 | When busy is set to YES the activity indicator starts spinning 22 | When set to NO the activity indicator stops spinning 23 | */ 24 | @property (nonatomic, assign) BOOL busy; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTAlertView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTAlertView.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 11/22/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 13 | 14 | // the block to execute when an alert button is tapped 15 | typedef void (^DTAlertViewBlock)(void); 16 | 17 | /** 18 | Extends UIAlertView with support for blocks. 19 | */ 20 | 21 | @interface DTAlertView : UIAlertView 22 | 23 | /** 24 | * Initializes the alert view. Add buttons and their blocks afterwards. 25 | @param title The alert title 26 | @param message The alert message 27 | */ 28 | - (id)initWithTitle:(NSString *)title message:(NSString *)message; 29 | 30 | /** 31 | Adds a button to the alert view 32 | 33 | @param title The title of the new button. 34 | @param block The block to execute when the button is tapped. 35 | @returns The index of the new button. Button indices start at 0 and increase in the order they are added. 36 | */ 37 | - (NSInteger)addButtonWithTitle:(NSString *)title block:(DTAlertViewBlock)block; 38 | 39 | /** 40 | Same as above, but for a cancel button. 41 | @param title The title of the cancel button. 42 | @param block The block to execute when the button is tapped. 43 | @returns The index of the new button. Button indices start at 0 and increase in the order they are added. 44 | */ 45 | - (NSInteger)addCancelButtonWithTitle:(NSString *)title block:(DTAlertViewBlock)block; 46 | 47 | /** 48 | Set a block to be run on alertViewCancel:. 49 | @param block The block to execute. 50 | */ 51 | - (void)setCancelBlock:(DTAlertViewBlock)block; 52 | 53 | 54 | /** 55 | * Use the alertViewDelegate when you want to to receive UIAlertViewDelegate messages. 56 | */ 57 | @property (nonatomic, DT_WEAK_PROPERTY) id alertViewDelegate; 58 | 59 | @end 60 | #endif 61 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTAnimatedGIF.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTAnimatedGIF.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 7/2/14. 6 | // Copyright (c) 2014 Cocoanetics. All rights reserved. 7 | // 8 | 9 | 10 | /** 11 | Loads an animated GIF from file, compatible with UIImageView 12 | */ 13 | UIImage *DTAnimatedGIFFromFile(NSString *path); 14 | 15 | /** 16 | Loads an animated GIF from data, compatible with UIImageView 17 | */ 18 | UIImage *DTAnimatedGIFFromData(NSData *data); 19 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTAsyncFileDeleter.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTAsyncFileDeleter.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 2/10/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** This class deletes large amounts of files asynchronously. You should use the sharedInstance to get an instance. On iOS this automatically starts a background task if the app is suspended so that file deletion can complete. 10 | */ 11 | 12 | @interface DTAsyncFileDeleter : NSObject 13 | 14 | /**------------------------------------------------------------------------------------- 15 | @name Creating A File Deleter 16 | --------------------------------------------------------------------------------------- 17 | */ 18 | 19 | /** Creates a shared file deleter. 20 | */ 21 | + (DTAsyncFileDeleter *)sharedInstance; 22 | 23 | /**------------------------------------------------------------------------------------- 24 | @name Asynchronous Operations 25 | --------------------------------------------------------------------------------------- 26 | */ 27 | 28 | /** Blocks execution of the current thread until the receiver finishes. 29 | */ 30 | - (void)waitUntilFinished; 31 | 32 | 33 | /** Removes the file or directory at the specified path and immediately returns. 34 | 35 | This method moves the given item to a temporary name which is an instant operation. It then schedules an asynchronous background operation to actually remove the item. 36 | 37 | @param path A path string indicating the file or directory to remove. If the path specifies a directory, the contents of that directory are recursively removed. 38 | */ 39 | - (void)removeItemAtPath:(NSString *)path; 40 | 41 | 42 | /** Removes the file or directory at the specified URL. 43 | 44 | This method moves the given item to a temporary name which is an instant operation. It then schedules an asynchronous background operation to actually remove the item. 45 | 46 | @param URL A file URL specifying the file or directory to remove. If the URL specifies a directory, the contents of that directory are recursively removed. 47 | */ 48 | - (void)removeItemAtURL:(NSURL *)URL; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTBase64Coding.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTBase64Coding.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 04.03.13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Utility class for encoding and decoding data in base64 format. 11 | 12 | This was formerly a category on `NSData` but since Matt Gallagher's category has become so enormously popular people where reporting more and more conflicts. Thus we decided to move it into a properly named class. 13 | 14 | Since all methods are class methods you never need to actually initialize it, doing so will raises a `DTAbstractClassException`. 15 | */ 16 | 17 | @interface DTBase64Coding : NSObject 18 | 19 | /** 20 | Encoding and Decoding 21 | */ 22 | 23 | /** 24 | Encodes data as base64 string. 25 | @param data The data to encode 26 | @returns The encoded string 27 | */ 28 | + (NSString *)stringByEncodingData:(NSData *)data; 29 | 30 | /** 31 | Encodes data as base64 string. 32 | @param string The string with data encoded in base64 format 33 | @returns data The decoded data 34 | */ 35 | + (NSData *)dataByDecodingString:(NSString *)string; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTBlockFunctions.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTBlockFunctions.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 02.10.13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Block Utility Methods 11 | */ 12 | 13 | /** 14 | Performs a block synchronous if execution is currently on the main thread or dispatches it asynchronously if not 15 | @param block The block to execute 16 | */ 17 | void DTBlockPerformSyncIfOnMainThreadElseAsync(void (^block)(void)); 18 | 19 | /** 20 | Performs a block synchronous on the main thread regardless of the current thread 21 | @param block The block to execute 22 | */ 23 | void DTBlockPerformSyncOnMainThread(void (^block)(void)); 24 | 25 | 26 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTCompatibility.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCompatibility.h 3 | // DTFoundation 4 | // 5 | // Created by Rene Pirringer on 30.07.15. 6 | // Copyright (c) 2015 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #if __IPHONE_OS_VERSION_MAX_ALLOWED > 80400 12 | #define DT_SUPPORTED_INTERFACE_ORIENTATIONS_RETURN_TYPE UIInterfaceOrientationMask 13 | #else 14 | #define DT_SUPPORTED_INTERFACE_ORIENTATIONS_RETURN_TYPE NSUInteger 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTCoreGraphicsUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCoreGraphicsUtils.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 7/18/10. 6 | // Copyright 2010 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | Various CoreGraphics-related utility functions 13 | */ 14 | 15 | /** 16 | Promotes value to CGFloat type. 17 | */ 18 | #define CGFloat_(__x) ((CGFloat) (__x)) 19 | 20 | /** 21 | Calculates a size that fits an original size into a different size preserving the aspect ratio. 22 | */ 23 | CGSize DTCGSizeThatFitsKeepingAspectRatio(CGSize originalSize, CGSize sizeToFit); 24 | 25 | /** 26 | Calculates a size that fits an original size into a different size preserving the aspect ratio and filling the target size. 27 | */ 28 | CGSize DTCGSizeThatFillsKeepingAspectRatio(CGSize originalSize, CGSize sizeToFit); 29 | 30 | /** 31 | Replacement for buggy CGSizeMakeWithDictionaryRepresentation 32 | @param dict The dictionary containing an encoded `CGSize` 33 | @param size The `CGSize` to decode from the dictionary 34 | @see http://www.cocoanetics.com/2012/09/radar-cgrectmakewithdictionaryrepresentation/ 35 | */ 36 | BOOL DTCGSizeMakeWithDictionaryRepresentation(NSDictionary *dict, CGSize *size); 37 | 38 | /** 39 | Replacement for buggy CGSizeCreateDictionaryRepresentation 40 | @param size The `CGSize` to encode in the returned dictionary 41 | @see http://www.cocoanetics.com/2012/09/radar-cgrectmakewithdictionaryrepresentation/ 42 | */ 43 | NSDictionary *DTCGSizeCreateDictionaryRepresentation(CGSize size); 44 | 45 | /** 46 | Replacement for buggy CGRectMakeWithDictionaryRepresentation 47 | @param dict The dictionary containing an encoded `CGRect` 48 | @param rect The `CGRect` to decode from the dictionary 49 | @see http://www.cocoanetics.com/2012/09/radar-cgrectmakewithdictionaryrepresentation/ 50 | */ 51 | BOOL DTCGRectMakeWithDictionaryRepresentation(NSDictionary *dict, CGRect *rect); 52 | 53 | /** 54 | Replacement for buggy CGRectCreateDictionaryRepresentation 55 | @param rect The `CGRect` to encode in the returned dictionary 56 | @see http://www.cocoanetics.com/2012/09/radar-cgrectmakewithdictionaryrepresentation/ 57 | */ 58 | NSDictionary *DTCGRectCreateDictionaryRepresentation(CGRect rect); 59 | 60 | /** 61 | Convenience method to find the center of a CGRect. Uses CGRectGetMidX and CGRectGetMidY. 62 | @returns The point which is the center of rect. 63 | */ 64 | CGPoint DTCGRectCenter(CGRect rect); 65 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTCustomColoredAccessory.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTCustomColoredAccessory.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 2/10/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Constant used by DTCustomColoredAccessory to specify the type of accessory. 11 | */ 12 | typedef NS_ENUM(NSUInteger, DTCustomColoredAccessoryType) 13 | { 14 | /** 15 | An accessoring pointing to the right side 16 | */ 17 | DTCustomColoredAccessoryTypeRight = 0, 18 | 19 | /** 20 | An accessoring pointing to the left side 21 | */ 22 | DTCustomColoredAccessoryTypeLeft, 23 | 24 | /** 25 | An accessoring pointing upwards 26 | */ 27 | DTCustomColoredAccessoryTypeUp, 28 | 29 | /** 30 | An accessoring pointing downwards 31 | */ 32 | DTCustomColoredAccessoryTypeDown, 33 | 34 | /** 35 | A front square drawn on top of a back square with the back square offset up and to the right 36 | */ 37 | DTCustomColoredAccessoryTypeSquare 38 | 39 | }; 40 | 41 | /** 42 | An accessory control that can be used instead of the standard disclosure indicator in a `UITableView`. See the DTCustomColoredAccessoryType for supported styles. 43 | */ 44 | 45 | @interface DTCustomColoredAccessory : UIControl 46 | 47 | /**------------------------------------------------------------------------------------- 48 | @name Creating A Custom-Colored Accessory 49 | --------------------------------------------------------------------------------------- 50 | */ 51 | 52 | /** 53 | Creates a custom-colored right disclosure indicator accessory with a given color 54 | @param color The color to use 55 | */ 56 | + (DTCustomColoredAccessory *)accessoryWithColor:(UIColor *)color; 57 | 58 | /** 59 | Creates a custom-colored accessory with a given color and type 60 | @param color The color to use 61 | @param type The DTCustomColoredAccessoryType to use 62 | */ 63 | + (DTCustomColoredAccessory *)accessoryWithColor:(UIColor *)color type:(DTCustomColoredAccessoryType)type; 64 | 65 | /** 66 | Creates a custom-colored square on top of a square with offset 67 | @param color The color to use 68 | @param backgroundColor The backgroundColor to use 69 | */ 70 | + (DTCustomColoredAccessory *)squareAccessoryWithColor:(UIColor *)color backgroundColor:(UIColor *)backgroundColor; 71 | 72 | /**------------------------------------------------------------------------------------- 73 | @name Properties 74 | --------------------------------------------------------------------------------------- 75 | */ 76 | 77 | /** 78 | The color to draw the accessory in 79 | */ 80 | @property (nonatomic, retain) UIColor *accessoryColor; 81 | 82 | /** 83 | The color to draw the accessory in while highlighted 84 | */ 85 | @property (nonatomic, retain) UIColor *highlightedColor; 86 | /** 87 | The color to draw the front square of the square accessory in while not highlighted 88 | */ 89 | @property (nonatomic, retain) UIColor *frontSquareAccessoryColor; 90 | /** 91 | The color to draw the back square of the square accessory in while not highlighted 92 | */ 93 | @property (nonatomic, retain) UIColor *backSquareAccessoryColor; 94 | 95 | /** 96 | The DTCustomColoredAccessoryType of the accessory. 97 | */ 98 | @property (nonatomic, assign) DTCustomColoredAccessoryType type; 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTExtendedFileAttributes.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTExtendedFileAttributes.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 3/6/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | This class provides read/write access to extended file attributes of a file or folder. It wraps the standard xattr Posix functions to do that. 11 | 12 | Because the file system does not keep track of the data types saved in extended attributes this API so far reads and writes strings. 13 | */ 14 | @interface DTExtendedFileAttributes : NSObject 15 | 16 | 17 | /** 18 | @name Creating an Extended File Attribute Manager 19 | */ 20 | 21 | 22 | /** 23 | Creates an Extended File Attribute Manager. 24 | 25 | @param path The file path 26 | */ 27 | - (id)initWithPath:(NSString *)path; 28 | 29 | 30 | /** 31 | @name Reading/Writing Extended Attributes 32 | */ 33 | 34 | /** 35 | Removes an extended file attribute from the receiver. 36 | 37 | @param attribute The name of the attribute. 38 | @returns `YES` if successful. 39 | */ 40 | - (BOOL)removeAttribute:(NSString *)attribute; 41 | 42 | 43 | /** 44 | Sets the value of an extended file attribute for the receiver. 45 | 46 | If the value is `nil` then this is the same as calling . 47 | 48 | @param value The string to save for this attribute. 49 | @param attribute The name of the attribute. 50 | @returns `YES` if successful. 51 | */ 52 | - (BOOL)setValue:(NSString *)value forAttribute:(NSString *)attribute; 53 | 54 | 55 | /** 56 | Gets the value of an extended file attribute from the receiver. 57 | 58 | @param attribute The name of the attribute. 59 | @returns The string for the value or `nil` if the value is not set. 60 | */ 61 | - (NSString *)valueForAttribute:(NSString *)attribute; 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTFolderMonitor.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTFolderMonitor.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 05.08.13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | // The block to execute if a monitored folder changes 10 | typedef void (^DTFolderMonitorBlock) (void); 11 | 12 | /** 13 | Class for monitoring changes on a folder. This can be used to monitor the application documents folder for changes in the files there if the user adds or removes files via iTunes file sharing. 14 | */ 15 | 16 | @interface DTFolderMonitor : NSObject 17 | 18 | /** 19 | @name Creating a Folder Monitor 20 | */ 21 | 22 | /** 23 | Creates a new DTFolderMonitor to watch the folder at the given URL. Whenever there is a change on this folder the block is executed. 24 | 25 | The URL must be a file URL. Both the URL and the block parameter are mandatory. The block is being dispatched on a background queue. 26 | 27 | @param URL The monitored folder URL 28 | @param block The block to execute if the folder is being modified 29 | @returns The instantiated monitor in suspended mode. Call -startMonitoring to start monitoring. 30 | */ 31 | + (DTFolderMonitor *)folderMonitorForURL:(NSURL *)URL block:(DTFolderMonitorBlock)block; 32 | 33 | 34 | /** 35 | @name Starting/Stopping Monitoring 36 | */ 37 | 38 | /** 39 | Start monitoring the folder. A monitor can be started and stopped multiple times. 40 | */ 41 | - (void)startMonitoring; 42 | 43 | /** 44 | Stop monitoring the folder. A monitor can be started and stopped multiple times. 45 | */ 46 | - (void)stopMonitoring; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTFoundation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Main aggregate header for 'DTFoundation' 3 | // 4 | 5 | // Global System Headers 6 | // this prevents problems if you include DTFoundation.h in your PCH file but are missing these other system frameworks 7 | 8 | #import 9 | 10 | #if TARGET_OS_IPHONE 11 | #import 12 | #else 13 | #import 14 | #import 15 | #endif 16 | 17 | 18 | #pragma mark - Universal 19 | 20 | // Constants 21 | #import "DTFoundationConstants.h" 22 | 23 | // Functions 24 | #import "DTBlockFunctions.h" 25 | 26 | // Headers 27 | #import "DTWeakSupport.h" 28 | 29 | // Categories 30 | #import "NSArray+DTError.h" 31 | #import "NSData+DTCrypto.h" 32 | #import "NSDictionary+DTError.h" 33 | #import "NSFileWrapper+DTCopying.h" 34 | #import "NSMutableArray+DTMoving.h" 35 | #import "NSString+DTFormatNumbers.h" 36 | #import "NSString+DTUtilities.h" 37 | #import "NSString+DTPaths.h" 38 | #import "NSString+DTURLEncoding.h" 39 | #import "NSURL+DTComparing.h" 40 | #import "NSURL+DTUnshorten.h" 41 | 42 | // Core Graphics 43 | #import "DTCoreGraphicsUtils.h" 44 | 45 | // Runtime 46 | #import "DTObjectBlockExecutor.h" 47 | #import "NSObject+DTRuntime.h" 48 | 49 | // Classes 50 | #import "DTAsyncFileDeleter.h" 51 | #import "DTBase64Coding.h" 52 | #import "DTExtendedFileAttributes.h" 53 | #import "DTFolderMonitor.h" 54 | #import "DTLog.h" 55 | #import "DTVersion.h" 56 | 57 | #import "DTHTMLParser.h" 58 | 59 | // DTASN1 60 | 61 | #import "DTASN1Parser.h" 62 | #import "DTASN1Serialization.h" 63 | 64 | // Reachability 65 | #import "DTReachability.h" 66 | 67 | 68 | #pragma mark - iOS 69 | 70 | #if TARGET_OS_IPHONE 71 | 72 | // BlocksAdditions 73 | #import "DTActionSheet.h" 74 | #import "DTAlertView.h" 75 | #import "UIView+DTActionHandlers.h" 76 | #import "DTProgressHUD.h" 77 | 78 | // Debug 79 | #import "UIColor+DTDebug.h" 80 | #import "UIView+DTDebug.h" 81 | 82 | // DTSidePanel 83 | #import "DTSidePanelController.h" 84 | #import "UIViewController+DTSidePanelController.h" 85 | #import "DTSidePanelPanGestureRecognizer.h" 86 | #import "DTSidePanelControllerSegue.h" 87 | 88 | // Misc 89 | #import "DTTiledLayerWithoutFade.h" 90 | #import "DTActivityTitleView.h" 91 | #import "DTCustomColoredAccessory.h" 92 | #import "DTPieProgressIndicator.h" 93 | #import "DTSmartPagingScrollView.h" 94 | #import "UIApplication+DTNetworkActivity.h" 95 | #import "UIImage+DTFoundation.h" 96 | #import "NSURL+DTAppLinks.h" 97 | #import "UIView+DTFoundation.h" 98 | #import "UIWebView+DTFoundation.h" 99 | 100 | #import "DTAnimatedGIF.h" 101 | 102 | #endif 103 | 104 | 105 | #pragma mark - OSX 106 | 107 | #if !TARGET_OS_IPHONE 108 | 109 | #import "DTScrollView.h" 110 | #import "NSDocument+DTFoundation.h" 111 | #import "NSImage+DTUtilities.h" 112 | #import "NSValue+DTConversion.h" 113 | #import "NSView+DTAutoLayout.h" 114 | #import "NSWindowController+DTPanelControllerPresenting.h" 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTFoundationConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTFoundationConstants.h 3 | // DTFoundation 4 | // 5 | // Created by Stefan Gugarel on 10/18/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | 10 | // string constant for NSError domain 11 | extern NSString * const DTFoundationErrorDomain; -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTObjectBlockExecutor.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTObjectBlockExecutor.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 12.02.13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | This class is used by [NSObject addDeallocBlock:] to execute blocks on dealloc 11 | */ 12 | 13 | @interface DTObjectBlockExecutor : NSObject 14 | 15 | /** 16 | Convenience method to create a block executor with a deallocation block 17 | @param block The block to execute when the created receiver is being deallocated 18 | */ 19 | + (id)blockExecutorWithDeallocBlock:(void(^)())block; 20 | 21 | /** 22 | Block to execute when dealloc of the receiver is called 23 | */ 24 | @property (nonatomic, copy) void (^deallocBlock)(); 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTPieProgressIndicator.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTPieProgressIndicator.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 16.05.12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | A Progress indicator shaped like a pie chart. If you don't specify a color then the current tintColor is used. This is useful when using it as a subview of a UIVisualEffectsView with vibrancy effect. Then all subviews using tintColor have the vibrancy applied. 11 | */ 12 | 13 | @interface DTPieProgressIndicator : UIView 14 | 15 | /** 16 | The progress in percent 17 | */ 18 | @property (nonatomic, assign) float progressPercent; 19 | 20 | /** 21 | The color of the pie 22 | */ 23 | @property (nonatomic, strong) UIColor *color; 24 | 25 | /** 26 | Creates a pie progress indicator of the correct size 27 | */ 28 | + (DTPieProgressIndicator *)pieProgressIndicator; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTSidePanelControllerSegue.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTSidePanelControllerSeque.h 3 | // DTFoundation 4 | // 5 | // Created by René Swoboda on 09/07/14. 6 | // Copyright (c) 2014 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DTSidePanelController; 12 | 13 | /** 14 | A segue for setting the DTSidePanelController panel ViewController via storyboard. 15 | */ 16 | @interface DTSidePanelControllerSegue : UIStoryboardSegue 17 | 18 | /** 19 | The DTSidePanelController for the segue. 20 | */ 21 | @property (DT_WEAK_PROPERTY, nonatomic) DTSidePanelController *sidePanelController; 22 | 23 | /** 24 | Returns the position of the sidepanel from the storyboard segue identifier. POSITION(OPTION) e.g.: DTSidePanelCenter(showSettings) 25 | @param identifier the segue identifier 26 | @return the position of the sidepanel (DTSidePanelLeft, DTSidePanelCenter, DTSidePanelRight, DTSidePanelNone) 27 | */ 28 | + (NSString *) getPositionIdentifier:(NSString *)identifier; 29 | 30 | /** 31 | Returns the option for the sidepanel from the storyboard segue identifier. The option can be used to identify the segue in your ViewController and wont be used by the DTSidePanelController. POSITION(OPTION) e.g.: DTSidePanelCenter(showSettings) 32 | @param identifier the segue identifier 33 | @return the option from the segue 34 | */ 35 | + (NSString *) getOptionIdentifier:(NSString *)identifier; 36 | 37 | @end -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTSidePanelPanGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTFoundation 3 | // 4 | // Created by rene on 25.11.13. 5 | // Copyright 2013 Drobnik.com. All rights reserved. 6 | // 7 | // 8 | // 9 | 10 | 11 | #import 12 | #import 13 | 14 | 15 | @interface DTSidePanelPanGestureRecognizer : UIPanGestureRecognizer 16 | @end -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTSmartPagingScrollView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTSmartPagingScrollView.h 3 | // DTSmartPhotoView 4 | // 5 | // Created by Stefan Gugarel on 5/11/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DTSmartPagingScrollView; 12 | 13 | 14 | /** 15 | Protocol for providing pages to 16 | */ 17 | @protocol DTSmartPagingScrollViewDatasource 18 | 19 | /** 20 | The number of pages for the 21 | @param smartPagingScrollView The scroll view asking 22 | @returns The number of pages 23 | */ 24 | - (NSUInteger)numberOfPagesInSmartPagingScrollView:(DTSmartPagingScrollView *)smartPagingScrollView; 25 | 26 | /** 27 | Method to provide UIViews to be used for the pages 28 | 29 | The frame of the passed view will be adjusted to the page size of the scroll view 30 | @param smartPagingScrollView The scroll view asking 31 | @param index The index of the page to provide 32 | @returns The view to use for the given page index. 33 | */ 34 | - (UIView *)smartPagingScrollView:(DTSmartPagingScrollView *)smartPagingScrollView viewForPageAtIndex:(NSUInteger)index; 35 | 36 | @optional 37 | /** 38 | The number of pages for the 39 | @param smartPagingScrollView The scroll view asking 40 | @param index The index of the page 41 | */ 42 | - (void)smartPagingScrollView:(DTSmartPagingScrollView *)smartPagingScrollView didScrollToPageAtIndex:(NSUInteger)index; 43 | 44 | @end 45 | 46 | /** 47 | A scroll view that automatically manages a set of pages 48 | */ 49 | @interface DTSmartPagingScrollView : UIScrollView 50 | 51 | /** 52 | The page data source for the receiver 53 | */ 54 | @property (nonatomic, DT_WEAK_PROPERTY) IBOutlet id pageDatasource; 55 | 56 | /** 57 | The current page index visible on the receiver 58 | */ 59 | @property (nonatomic, assign) NSUInteger currentPageIndex; 60 | 61 | /** 62 | Reloads the pages from the datasource 63 | */ 64 | - (void)reloadData; 65 | 66 | /** 67 | The range of indexes of the currently visible pages 68 | */ 69 | - (NSRange)rangeOfVisiblePages; 70 | 71 | /** 72 | Scroll the receiver to the given page index 73 | @param page The index of the page to move to 74 | @param animated Whether the move should be animated 75 | */ 76 | - (void)scrollToPage:(NSInteger)page animated:(BOOL)animated; 77 | 78 | /** 79 | Get a view for a specified index 80 | @param index The index of the view to retrieve 81 | */ 82 | - (UIView *)viewForIndex:(NSUInteger)index; 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTTiledLayerWithoutFade.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTTiledLayerWithoutFade.h 3 | // DTRichTextEditor 4 | // 5 | // Created by Oliver Drobnik on 8/24/11. 6 | // Copyright 2011 Cocoanetics. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | Simple subclass of `CATiledLayer` that does not fade in drawn tiles. 13 | */ 14 | 15 | @interface DTTiledLayerWithoutFade : CATiledLayer 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/DTWeakSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // DTWeakSupport.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 6/3/13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Useful defines for building code the compiles with zeroing weak references if the deployment target allows it. This is possible from minimum supported iOS 5.0 and OS X 10.7 and above. Note that on OS X 10.7 some AppKit classes do not support having a weak ref, e.g. NSWindowController or NSViewController. 11 | */ 12 | 13 | #import 14 | 15 | #if __has_feature(objc_arc_weak) 16 | 17 | // zeroing weak refs are supported for ivars and properties 18 | #define DT_WEAK_VARIABLE __weak 19 | #define DT_WEAK_PROPERTY weak 20 | 21 | #elif __has_feature(objc_arc) 22 | 23 | /// zeroing weak refs not supported, fall back to unsafe unretained and assigning 24 | #define DT_WEAK_VARIABLE __unsafe_unretained 25 | #define DT_WEAK_PROPERTY assign 26 | 27 | #else 28 | 29 | // define something, as this header might be included in a non-ARC project for using compiled code from an ARC static lib 30 | #define DT_WEAK_VARIABLE 31 | #define DT_WEAK_PROPERTY assign 32 | 33 | #endif -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSArray+DTError.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+error.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 6/15/10. 6 | // Copyright 2010 Drobnik.com. All rights reserved. 7 | // 8 | 9 | /** 10 | A collection of useful additions for `NSArray` to deal with Property Lists and also to get error handling for malformed data. 11 | */ 12 | 13 | @interface NSArray (DTError) 14 | 15 | 16 | /**------------------------------------------------------------------------------------- 17 | @name Property List Error Handling 18 | --------------------------------------------------------------------------------------- 19 | */ 20 | 21 | /** 22 | Creates and returns an array found in a file specified by a given URL. 23 | 24 | @param URL An `NSURL`. The file identified by URL must contain a string representation of a property list whose root object is an array. 25 | @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, pass in `NULL`. 26 | @return A new array that contains the array at path, or `nil` if there is a file error or if the contents of the file are an invalid representation of a array. 27 | */ 28 | + (NSArray *)arrayWithContentsOfURL:(NSURL *)URL error:(NSError **)error; 29 | 30 | 31 | /** 32 | Creates and returns an array found in a file specified by a given path. 33 | 34 | @param path A full or relative pathname. The file identified by path must contain a string representation of a property list whose root object is a dictionary. 35 | @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, pass in `NULL`. 36 | @return A new dictionary that contains the dictionary at path, or `nil` if there is a file error or if the contents of the file are an invalid representation of a dictionary. 37 | */ 38 | + (NSArray *)arrayWithContentsOfFile:(NSString *)path error:(NSError **)error; 39 | 40 | 41 | /** 42 | Creates and returns an array encoded in the given blob of data. 43 | 44 | @param data The data object identified by data must contain a string representation of a property list whose root object is an array. 45 | @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, pass in `NULL`. 46 | @return A new array that contains the decoded array, or `nil` if there is an error or if the contents of the file are an invalid representation of an array. 47 | */ 48 | + (NSArray *)arrayWithContentsOfData:(NSData *)data error:(NSError **)error; 49 | @end 50 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSData+DTCrypto.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+DTCrypto.h 3 | // DTFoundation 4 | // 5 | // Created by Stefan Gugarel on 10/3/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Useful cryptography methods. 11 | */ 12 | 13 | @interface NSData (DTCrypto) 14 | 15 | /**------------------------------------------------------------------------------------- 16 | @name Generating HMAC Hashes 17 | --------------------------------------------------------------------------------------- 18 | */ 19 | 20 | /** 21 | Generates a HMAC from the receiver using the SHA1 algorithm 22 | @param key The encryption key 23 | @returns The encrypted hash 24 | */ 25 | - (NSData *)encryptedDataUsingSHA1WithKey:(NSData *)key; 26 | 27 | 28 | /**------------------------------------------------------------------------------------- 29 | @name Digest Hashes 30 | --------------------------------------------------------------------------------------- 31 | */ 32 | 33 | /** 34 | Generate an MD5 checksum from the receiver 35 | @returns An `NSData` containing the md5 digest. 36 | */ 37 | -(NSData *)dataWithMD5Hash; 38 | 39 | /** 40 | Generate an SHA1 checksum from the receiver 41 | @returns An `NSData` containing the SHA digest. 42 | */ 43 | - (NSData *)dataWithSHA1Hash; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSDictionary+DTError.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+DTError.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 4/16/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | A collection of useful additions for `NSDictionary` to deal with Property Lists and also to get error handling for malformed data. 11 | */ 12 | 13 | @interface NSDictionary (DTError) 14 | 15 | /**------------------------------------------------------------------------------------- 16 | @name Property List Error Handling 17 | --------------------------------------------------------------------------------------- 18 | */ 19 | 20 | /** 21 | Creates and returns a dictionary using the keys and values found in a file specified by a given URL. 22 | 23 | @param URL An URL. The file identified by URL must contain a string representation of a property list whose root object is a dictionary. 24 | @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, pass in `NULL`. 25 | @return A new dictionary that contains the dictionary at path, or `nil` if there is a file error or if the contents of the file are an invalid representation of a dictionary. 26 | */ 27 | + (NSDictionary *)dictionaryWithContentsOfURL:(NSURL *)URL error:(NSError **)error; 28 | 29 | /** 30 | Creates and returns a dictionary using the keys and values found in a file specified by a given path. 31 | 32 | @param path A full or relative pathname. The file identified by path must contain a string representation of a property list whose root object is a dictionary. 33 | @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, pass in `NULL`. 34 | @return A new dictionary that contains the dictionary at path, or `nil` if there is a file error or if the contents of the file are an invalid representation of a dictionary. 35 | */ 36 | + (NSDictionary *)dictionaryWithContentsOfFile:(NSString *)path error:(NSError **)error; 37 | 38 | /** 39 | Creates and returns a dictionary using the keys and values found in the given data. 40 | 41 | @param data The data object identified by data must contain a string representation of a property list whose root object is a dictionary. 42 | @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, pass in `NULL`. 43 | @return A new dictionary that contains the dictionary at path, or `nil` if there is a file error or if the contents of the file are an invalid representation of a dictionary. 44 | */ 45 | + (NSDictionary *)dictionaryWithContentsOfData:(NSData *)data error:(NSError **)error; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSFileWrapper+DTCopying.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSFileWrapper+DTCopying.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 10/19/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Methods for copying file wrappers. 11 | */ 12 | @interface NSFileWrapper (DTCopying) 13 | 14 | /** 15 | Creates a copy of the receiver by deep copying all contained sub filewrappers. 16 | */ 17 | - (NSFileWrapper *)fileWrapperByDeepCopying; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSMutableArray+DTMoving.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSMutableArray+DTMoving.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 9/27/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Methods that add convenient moving methods to `NSMutableArray`. 11 | */ 12 | 13 | @interface NSMutableArray (DTMoving) 14 | 15 | /** 16 | Moves the object at the specified indexes to the new location. 17 | 18 | @param indexes The indexes of the objects to move. 19 | @param idx The index in the mutable array at which to insert the objects. 20 | */ 21 | - (void)moveObjectsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)idx; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSObject+DTRuntime.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+DTRuntime.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 4/25/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Methods to dynamically modify objects at runtime 11 | */ 12 | 13 | @interface NSObject (DTRuntime) 14 | 15 | /**------------------------------------------------------------------------------------- 16 | @name Blocks 17 | --------------------------------------------------------------------------------------- 18 | */ 19 | 20 | /** 21 | Adds a block to be executed as soon as the receiver's memory is deallocated 22 | @param block The block to execute when the receiver is being deallocated 23 | */ 24 | - (void)addDeallocBlock:(void(^)())block; 25 | 26 | /** 27 | Adds a new instance method to a class. All instances of this class will have this method. 28 | 29 | The block captures `self` in the calling context. To allow access to the instance from within the block it is passed as parameter to the block. 30 | @param selectorName The name of the method. 31 | @param block The block to execute for the instance method, a pointer to the instance is passed as the only parameter. 32 | @returns `YES` if the operation was successful 33 | */ 34 | + (BOOL)addInstanceMethodWithSelectorName:(NSString *)selectorName block:(void(^)(id))block; 35 | 36 | /**------------------------------------------------------------------------------------- 37 | @name Method Swizzling 38 | --------------------------------------------------------------------------------------- 39 | */ 40 | 41 | /** 42 | Exchanges two method implementations. After the call methods to the first selector will now go to the second one and vice versa. 43 | @param selector The first method 44 | @param otherSelector The second method 45 | */ 46 | + (void)swizzleMethod:(SEL)selector withMethod:(SEL)otherSelector; 47 | 48 | 49 | /** 50 | Exchanges two class method implementations. After the call methods to the first selector will now go to the second one and vice versa. 51 | @param selector The first method 52 | @param otherSelector The second method 53 | */ 54 | + (void)swizzleClassMethod:(SEL)selector withMethod:(SEL)otherSelector; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSString+DTFormatNumbers.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+DTFormatNumbers.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 11/25/11. 6 | // Copyright (c) 2011 Cocoanetics. All rights reserved. 7 | // 8 | 9 | 10 | /** 11 | A collection of category extensions for `NSString` dealing with the formatting of numbers in special contexts. 12 | */ 13 | 14 | @interface NSString (DTFormatNumbers) 15 | 16 | /**------------------------------------------------------------------------------------- 17 | @name Formatting File Sizes 18 | --------------------------------------------------------------------------------------- 19 | */ 20 | 21 | 22 | /** Formats the passed number as a byte value in a form that is pleasing to the user when displayed next to a progress bar. 23 | 24 | Output numbers are rounded to one decimal place. Bytes are not abbreviated because most users might not be used to B for that. Higher units are kB, MB, GB and TB. 25 | 26 | @param bytes The value of the bytes to be formatted 27 | @return Returns the formatted string. 28 | 29 | */ 30 | + (NSString *)stringByFormattingBytes:(long long)bytes; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSString+DTPaths.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+DTPaths.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 2/15/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | 10 | /** 11 | A collection of useful additions for `NSString` to deal with paths. 12 | */ 13 | 14 | @interface NSString (DTPaths) 15 | 16 | /**------------------------------------------------------------------------------------- 17 | @name Getting Standard Paths 18 | --------------------------------------------------------------------------------------- 19 | */ 20 | 21 | /** Determines the path to the Library/Caches folder in the current application's sandbox. 22 | 23 | The return value is cached on the first call. 24 | 25 | @return The path to the app's Caches folder. 26 | */ 27 | + (NSString *)cachesPath; 28 | 29 | 30 | /** Determines the path to the Documents folder in the current application's sandbox. 31 | 32 | The return value is cached on the first call. 33 | 34 | @return The path to the app's Documents folder. 35 | */ 36 | + (NSString *)documentsPath; 37 | 38 | /**------------------------------------------------------------------------------------- 39 | @name Getting Temporary Paths 40 | --------------------------------------------------------------------------------------- 41 | */ 42 | 43 | /** Determines the path for temporary files in the current application's sandbox. 44 | 45 | The return value is cached on the first call. This value is different in Simulator than on the actual device. In Simulator you get a reference to /tmp wheras on iOS devices it is a special folder inside the application folder. 46 | 47 | @return The path to the app's folder for temporary files. 48 | */ 49 | + (NSString *)temporaryPath; 50 | 51 | 52 | /** Creates a unique filename that can be used for one temporary file or folder. 53 | 54 | The returned string is different on every call. It is created by combining the result from temporaryPath with a unique UUID. 55 | 56 | @return The generated temporary path. 57 | */ 58 | + (NSString *)pathForTemporaryFile; 59 | 60 | 61 | /**------------------------------------------------------------------------------------- 62 | @name Working with Paths 63 | --------------------------------------------------------------------------------------- 64 | */ 65 | 66 | /** Appends or Increments a sequence number in brackets 67 | 68 | If the receiver already has a number suffix then it is incremented. If not then (1) is added. 69 | 70 | @return The incremented path 71 | */ 72 | - (NSString *)pathByIncrementingSequenceNumber; 73 | 74 | 75 | /** Removes a sequence number in brackets 76 | 77 | If the receiver number suffix then it is removed. If not the receiver is returned. 78 | 79 | @return The modified path 80 | */ 81 | - (NSString *)pathByDeletingSequenceNumber; 82 | 83 | 84 | 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSString+DTURLEncoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+DTURLEncoding.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 4/16/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | A collection of useful additions for `NSString` to deal with URL encoding. 11 | */ 12 | 13 | @interface NSString (DTURLEncoding) 14 | 15 | /**------------------------------------------------------------------------------------- 16 | @name Encoding Strings for URLs 17 | --------------------------------------------------------------------------------------- 18 | */ 19 | 20 | 21 | /** Encoding suitable for use in URLs. 22 | 23 | stringByAddingPercentEscapes does not replace serveral characters which are problematics in URLs. 24 | 25 | @return The encoded version of the receiver. 26 | */ 27 | - (NSString *)stringByURLEncoding; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSString+DTUtilities.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+DTUtilities.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 4/16/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | 10 | /** 11 | A collection of utility additions for `NSString`. 12 | */ 13 | 14 | @interface NSString (DTUtilities) 15 | 16 | /**------------------------------------------------------------------------------------- 17 | @name Working with Identifiers 18 | --------------------------------------------------------------------------------------- 19 | */ 20 | 21 | /** Creates a new string that contains a generated UUID. 22 | 23 | @return The path to the app's Caches folder. 24 | */ 25 | + (NSString *)stringWithUUID; 26 | 27 | 28 | /**------------------------------------------------------------------------------------- 29 | @name Working with Checksums 30 | --------------------------------------------------------------------------------------- 31 | */ 32 | 33 | /** creates an MD5 checksum 34 | 35 | @return returns an MD5 hash for the receiver. 36 | */ 37 | - (NSString *)md5Checksum; 38 | 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSURL+DTAppLinks.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+DTAppLinks.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 11/25/11. 6 | // Copyright (c) 2011 Cocoanetics. All rights reserved. 7 | // 8 | 9 | 10 | /** A collection of category extensions for `NSURL` that provide direct access to built-in app capabilities. 11 | 12 | For example: Open the app store on the page for the app 13 | 14 | NSURL *appURL = [NSURL appStoreURLforApplicationIdentifier:@"463623298"]; 15 | [[UIApplication sharedApplication] openURL:appURL]; 16 | */ 17 | 18 | @interface NSURL (DTAppLinks) 19 | 20 | /**------------------------------------------------------------------------------------- 21 | @name Mobile App Store Pages 22 | --------------------------------------------------------------------------------------- 23 | */ 24 | 25 | /** Returns the URL to open the mobile app store on the app's page. 26 | 27 | URL construction as described in [QA1629](https://developer.apple.com/library/ios/#qa/qa2008/qa1629.html). Test and found to be opening the app store app directly even without the itms: or itms-apps: scheme. This kind of URL can also be used to forward a link to the app to non-iOS devices. 28 | 29 | @param identifier The application identifier that gets assigned to a new app when you add it to iTunes Connect. 30 | @return Returns the URL to the direct app store link 31 | */ 32 | + (NSURL *)appStoreURLforApplicationIdentifier:(NSString *)identifier; 33 | 34 | 35 | /** Returns the URL to open the mobile app store on the app's review page. 36 | 37 | The reviews page is a sub-page of the normal app landing page you get with appStoreURLforApplicationIdentifier: 38 | 39 | @param identifier The application identifier that gets assigned to a new app when you add it to iTunes Connect. 40 | @return Returns the URL to the direct app store link 41 | */ 42 | + (NSURL *)appStoreReviewURLForApplicationIdentifier:(NSString *)identifier; 43 | 44 | @end 45 | 46 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSURL+DTComparing.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+DTComparing.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 13.11.12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Category for comparing URLs. 11 | 12 | Contrary to what you might think isEqual: does not work properly in many cases. 13 | */ 14 | 15 | @interface NSURL (DTComparing) 16 | 17 | /** 18 | Compares the receiver with another URL 19 | @param URL another URL 20 | @returns `YES` if the receiver is equivalent with the passed URL 21 | */ 22 | - (BOOL)isEqualToURL:(NSURL *)URL; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/NSURL+DTUnshorten.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+DTUnshorten.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 6/2/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** Method for getting the full length URL for a shortened one. 10 | 11 | For example: 12 | 13 | NSURL *url = [NSURL URLWithString:@"buff.ly/L4uGoza"]; 14 | 15 | [url unshortenWithCompletion:^(NSURL *url) { 16 | NSLog(@"Unshortened: %@", url); 17 | }]; 18 | 19 | */ 20 | 21 | typedef void (^NSURLUnshortenCompletionHandler)(NSURL *); 22 | 23 | @interface NSURL (DTUnshorten) 24 | 25 | /** 26 | Unshortens the receiver and returns the long URL via the completion handler. 27 | 28 | Results are cached and therefore a subsequent call for the same receiver will return instantly if the result is still present in the cache. 29 | @param completion The completion handler 30 | */ 31 | - (void)unshortenWithCompletion:(NSURLUnshortenCompletionHandler)completion; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/UIApplication+DTNetworkActivity.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIApplication+DTNetworkActivity.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 5/21/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Enhancement for `UIApplication` to properly count active network sessions and show the network activity indicator whenever there are more than 0 active sessions. 11 | */ 12 | @interface UIApplication (DTNetworkActivity) 13 | 14 | /** 15 | Increments the number of active network operations 16 | */ 17 | - (void)pushActiveNetworkOperation; 18 | 19 | /** 20 | Decrements the number of active network operations 21 | */ 22 | - (void)popActiveNetworkOperation; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/UIColor+DTDebug.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+DTDebug.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 01.03.13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Helpful extensions for UIColor 11 | */ 12 | @interface UIColor (DTDebug) 13 | 14 | /** 15 | @name Debugging 16 | */ 17 | 18 | /** 19 | Creates a random color. 20 | */ 21 | + (UIColor *)randomColor; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/UIImage+DTFoundation.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+DTFoundation.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 3/8/12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Methods to help with working with images. 11 | */ 12 | @interface UIImage (DTFoundation) 13 | 14 | /** 15 | @name Generating Images 16 | */ 17 | 18 | /** 19 | Creates an image filled with a solid color 20 | @param color The solid color that fills the image 21 | @param size The size of the image 22 | @returns The image filled with given color and given size 23 | */ 24 | + (UIImage *)imageWithSolidColor:(UIColor *)color size:(CGSize)size; 25 | 26 | 27 | /** 28 | Creates an image filled with a tint color using the receiver as image mask. The resulting image ignores the receiver's color values and instead uses the alpha values combined with the passed color. 29 | @param color The color to use for tinting 30 | @returns A new image 31 | */ 32 | - (UIImage *)imageMaskedAndTintedWithColor:(UIColor *)color; 33 | 34 | /** 35 | @name Loading from RemoteURLs 36 | */ 37 | 38 | 39 | /** 40 | Creates and returns an image object synchronously by loading the image data from the specified URL and optionally caching it. 41 | 42 | Useful values for cachePolicy are: 43 | 44 | - NSURLRequestUseProtocolCachePolicy (default) 45 | - NSURLRequestReloadIgnoringLocalCacheData 46 | - NSURLRequestReturnCacheDataElseLoad 47 | - NSURLRequestReturnCacheDataDontLoad 48 | 49 | @param URL The URL to load the image from 50 | @param cachePolicy The cache policy to apply. 51 | @param error An optional output parameter to return an error if the loading fails 52 | @returns The image object for the specified URL, or nil if the method could not load the specified image. 53 | */ 54 | + (UIImage *)imageWithContentsOfURL:(NSURL *)URL cachePolicy:(NSURLRequestCachePolicy)cachePolicy error:(NSError **)error; 55 | 56 | 57 | /** 58 | @name Drawing 59 | */ 60 | 61 | /** 62 | Mimicks the way images are drawn differently by UIImageView based on the set content mode. 63 | @param rect The rectangle to drawn in 64 | @param contentMode The content mode. Note that UIViewContentModeRedraw is treated the same as UIViewContentModeScaleToFill. 65 | */ 66 | - (void)drawInRect:(CGRect)rect withContentMode:(UIViewContentMode)contentMode; 67 | 68 | /** 69 | @name Working with Tiles 70 | */ 71 | 72 | /** 73 | Cuts out a tile at the given row and column 74 | 75 | @param column The index of the column 76 | @param columns The total number of columns 77 | @param row The index of the row 78 | @param rows The total number of rows 79 | @returns The resulting image 80 | */ 81 | - (UIImage *)tileImageAtColumn:(NSUInteger)column ofColumns:(NSUInteger)columns row:(NSUInteger)row ofRows:(NSUInteger)rows; 82 | 83 | /** 84 | Cuts out a tile at the given clip rect relative to the bounds 85 | 86 | @param clipRect The clipping rect to extract 87 | @param bounds The bounds to which the clipRect is relative to 88 | @param scale The image scale 89 | @returns The resulting image 90 | */ 91 | - (UIImage *)tileImageInClipRect:(CGRect)clipRect inBounds:(CGRect)bounds scale:(CGFloat)scale; 92 | 93 | 94 | /** 95 | @name Modifying Images 96 | */ 97 | 98 | /** 99 | Resizes the receiver to the given size. 100 | 101 | @param newSize The target image size 102 | @returns The resulting image 103 | */ 104 | - (UIImage *)imageScaledToSize:(CGSize)newSize; 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/UIView+DTActionHandlers.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DTActionHandlers.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 03.06.12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Methods to add simple block-based actions to UIViews. 11 | */ 12 | 13 | @interface UIView (DTActionHandlers) 14 | 15 | /** 16 | Attaches the given block for a single tap action to the receiver. 17 | @param block The block to execute. 18 | */ 19 | - (void)setTapActionWithBlock:(void (^)(void))block; 20 | 21 | /** 22 | Attaches the given block for a long press action to the receiver. 23 | @param block The block to execute. 24 | */ 25 | - (void)setLongPressActionWithBlock:(void (^)(void))block; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/UIView+DTDebug.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DTDebug.h 3 | // DTFoundation 4 | // 5 | // Created by Stefan Gugarel on 2/8/13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Methods useful for debugging problems with UIView instances. 11 | */ 12 | 13 | @interface UIView (DTDebug) 14 | 15 | /** 16 | @name Main Thread Checking 17 | */ 18 | 19 | /** 20 | Toggles on/off main thread checking on several methods of UIView. 21 | 22 | Currently the following methods are swizzeled and checked: 23 | 24 | - setNeedsDisplay 25 | - setNeedsDisplayInRect: 26 | - setNeedsLayout 27 | 28 | Those are triggered by a variety of methods in UIView, e.g. setBackgroundColor and thus it is not necessary to swizzle all of them. 29 | */ 30 | + (void)toggleViewMainThreadChecking; 31 | 32 | /** 33 | Method that gets called if one of the important methods of UIView is not being called on a main queue. 34 | 35 | Toggle this on/off with . Break on -[UIView methodCalledNotFromMainThread:] to catch it in debugger. 36 | @param methodName Symbolic name of the method being called 37 | */ 38 | - (void)methodCalledNotFromMainThread:(NSString *)methodName; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/UIView+DTFoundation.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+DTFoundation.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 12/23/11. 6 | // Copyright (c) 2011 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** DTFoundation enhancements for `UIView` */ 10 | 11 | @interface UIView (DTFoundation) 12 | 13 | /**--------------------------------------------------------------------------------------- 14 | * @name Getting Snapshot Images 15 | * --------------------------------------------------------------------------------------- 16 | */ 17 | 18 | /** Creates a snapshot of the receiver. 19 | 20 | @return Returns a bitmap image with the same contents and dimensions as the receiver. 21 | */ 22 | - (UIImage *)snapshotImage; 23 | 24 | 25 | /**--------------------------------------------------------------------------------------- 26 | * @name Rounded Corners 27 | * --------------------------------------------------------------------------------------- 28 | */ 29 | 30 | /** Sets the corner attributes of the receiver's layer. 31 | 32 | The advantage of using this method is that you do not need to import the QuartzCore headers just for setting the corners. 33 | @param radius The corner radius. 34 | @param width The width of the border line. 35 | @param color The color to be used for the border line. Can be `nil` to leave it unchanged. 36 | */ 37 | - (void)setRoundedCornersWithRadius:(CGFloat)radius width:(CGFloat)width color:(UIColor *)color; 38 | 39 | 40 | /**--------------------------------------------------------------------------------------- 41 | * @name Shadows 42 | * --------------------------------------------------------------------------------------- 43 | */ 44 | 45 | /** Adds a layer-based shadow to the receiver. 46 | 47 | The advantage of using this method is that you do not need to import the QuartzCore headers just for adding the shadow. 48 | Layer-based shadows are properly combined for views that are on the same superview. This does not add a shadow path, 49 | you should call updateShadowPathToBounds whenever the receiver's bounds change and also after setting the initial frame. 50 | @warn Disables clipping to bounds because this would also clip off the shadow. 51 | @param color The shadow color. Can be `nil` for default black. 52 | @param alpha The alpha value of the shadow. 53 | @param radius The amount that the shadow is blurred. 54 | @param offset The offset of the shadow 55 | @see updateShadowPathToBounds:withDuration: 56 | */ 57 | - (void)addShadowWithColor:(UIColor *)color alpha:(CGFloat)alpha radius:(CGFloat)radius offset:(CGSize)offset; 58 | 59 | 60 | /** sets the shadow path to fit the receiver's bounds. 61 | 62 | This should be called whenever the receiver's bounds change, or else the shadow detaches. 63 | @warn Since this a CALayer property it needs to be explicitly animated, for example in the willRotate ... method of a `UIViewController`. 64 | @param bounds The new bounds of the shadow path 65 | @param duration The animation duration. Specify a duration of 0 to not do an animation 66 | */ 67 | - (void)updateShadowPathToBounds:(CGRect)bounds withDuration:(NSTimeInterval)duration; 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/UIViewController+DTSidePanelController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+DTSidePanelController.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 5/24/13. 6 | // Copyright (c) 2013 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Methods to enhance `UIViewController` for use with DTSidePanelController 11 | */ 12 | 13 | @class DTSidePanelController; 14 | 15 | @interface UIViewController (DTSidePanelController) 16 | 17 | /** 18 | Returns the nearest DTSidePanelController in the view controller hierarchy that is presenting the receiver. 19 | 20 | If it is not embedded in a side panel controller then this property is `nil`. 21 | @returns The side panel controller 22 | */ 23 | - (DTSidePanelController *)sidePanelController; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Headers/UIWebView+DTFoundation.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIWebView+DTFoundation.h 3 | // DTFoundation 4 | // 5 | // Created by Oliver Drobnik on 25.05.12. 6 | // Copyright (c) 2012 Cocoanetics. All rights reserved. 7 | // 8 | 9 | /** 10 | Some convenient functions that can be also achieved if you know JavaScript, but are way more easy to remember like this. 11 | */ 12 | 13 | @interface UIWebView (DTFoundation) 14 | 15 | /** 16 | Getting the current document's title 17 | @returns A string with the document title 18 | */ 19 | - (NSString *)documentTitle; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuyubeichen/DTCoreTextDemo/829c86e3c83628cf3096b1737ad7054f53ffe058/DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Info.plist -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/DTFoundation.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module DTFoundation { 2 | umbrella header "DTFoundation.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Olivier Poitrey rs@dailymotion.com 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 furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | 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 | 21 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | typedef NS_ENUM(NSInteger, SDImageFormat) { 14 | SDImageFormatUndefined = -1, 15 | SDImageFormatJPEG = 0, 16 | SDImageFormatPNG, 17 | SDImageFormatGIF, 18 | SDImageFormatTIFF, 19 | SDImageFormatWebP 20 | }; 21 | 22 | @interface NSData (ImageContentType) 23 | 24 | /** 25 | * Return image format 26 | * 27 | * @param data the input image data 28 | * 29 | * @return the image format as `SDImageFormat` (enum) 30 | */ 31 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/NSData+ImageContentType.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Fabrice Aneche 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "NSData+ImageContentType.h" 11 | 12 | 13 | @implementation NSData (ImageContentType) 14 | 15 | + (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { 16 | if (!data) { 17 | return SDImageFormatUndefined; 18 | } 19 | 20 | uint8_t c; 21 | [data getBytes:&c length:1]; 22 | switch (c) { 23 | case 0xFF: 24 | return SDImageFormatJPEG; 25 | case 0x89: 26 | return SDImageFormatPNG; 27 | case 0x47: 28 | return SDImageFormatGIF; 29 | case 0x49: 30 | case 0x4D: 31 | return SDImageFormatTIFF; 32 | case 0x52: 33 | // R as RIFF for WEBP 34 | if (data.length < 12) { 35 | return SDImageFormatUndefined; 36 | } 37 | 38 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 39 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { 40 | return SDImageFormatWebP; 41 | } 42 | } 43 | return SDImageFormatUndefined; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/NSImage+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_MAC 12 | 13 | #import 14 | 15 | @interface NSImage (WebCache) 16 | 17 | - (CGImageRef)CGImage; 18 | - (NSArray *)images; 19 | - (BOOL)isGIF; 20 | 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/NSImage+WebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "NSImage+WebCache.h" 10 | 11 | #if SD_MAC 12 | 13 | @implementation NSImage (WebCache) 14 | 15 | - (CGImageRef)CGImage { 16 | NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); 17 | CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:NULL hints:nil]; 18 | return cgImage; 19 | } 20 | 21 | - (NSArray *)images { 22 | return nil; 23 | } 24 | 25 | - (BOOL)isGIF { 26 | return NO; 27 | } 28 | 29 | @end 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/SDImageCacheConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDImageCacheConfig.h 3 | // SDWebImage 4 | // 5 | // Created by Bogdan on 09/09/16. 6 | // Copyright © 2016 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface SDImageCacheConfig : NSObject 13 | 14 | /** 15 | * Decompressing images that are downloaded and cached can improve performance but can consume lot of memory. 16 | * Defaults to YES. Set this to NO if you are experiencing a crash due to excessive memory consumption. 17 | */ 18 | @property (assign, nonatomic) BOOL shouldDecompressImages; 19 | 20 | /** 21 | * disable iCloud backup [defaults to YES] 22 | */ 23 | @property (assign, nonatomic) BOOL shouldDisableiCloud; 24 | 25 | /** 26 | * use memory cache [defaults to YES] 27 | */ 28 | @property (assign, nonatomic) BOOL shouldCacheImagesInMemory; 29 | 30 | /** 31 | * The maximum length of time to keep an image in the cache, in seconds 32 | */ 33 | @property (assign, nonatomic) NSInteger maxCacheAge; 34 | 35 | /** 36 | * The maximum size of the cache, in bytes. 37 | */ 38 | @property (assign, nonatomic) NSUInteger maxCacheSize; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/SDImageCacheConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // SDImageCacheConfig.m 3 | // SDWebImage 4 | // 5 | // Created by Bogdan on 09/09/16. 6 | // Copyright © 2016 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import "SDImageCacheConfig.h" 10 | 11 | static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week 12 | 13 | @implementation SDImageCacheConfig 14 | 15 | - (instancetype)init { 16 | if (self = [super init]) { 17 | _shouldDecompressImages = YES; 18 | _shouldDisableiCloud = YES; 19 | _shouldCacheImagesInMemory = YES; 20 | _maxCacheAge = kDefaultCacheMaxCacheAge; 21 | _maxCacheSize = 0; 22 | } 23 | return self; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Jamie Pinkham 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #ifdef __OBJC_GC__ 13 | #error SDWebImage does not support Objective-C Garbage Collection 14 | #endif 15 | 16 | // Apple's defines from TargetConditionals.h are a bit weird. 17 | // Seems like TARGET_OS_MAC is always defined (on all platforms). 18 | // To determine if we are running on OSX, we can only relly on TARGET_OS_IPHONE=0 and all the other platforms 19 | #if !TARGET_OS_IPHONE && !TARGET_OS_IOS && !TARGET_OS_TV && !TARGET_OS_WATCH 20 | #define SD_MAC 1 21 | #else 22 | #define SD_MAC 0 23 | #endif 24 | 25 | // iOS and tvOS are very similar, UIKit exists on both platforms 26 | // Note: watchOS also has UIKit, but it's very limited 27 | #if TARGET_OS_IOS || TARGET_OS_TV 28 | #define SD_UIKIT 1 29 | #else 30 | #define SD_UIKIT 0 31 | #endif 32 | 33 | #if TARGET_OS_IOS 34 | #define SD_IOS 1 35 | #else 36 | #define SD_IOS 0 37 | #endif 38 | 39 | #if TARGET_OS_TV 40 | #define SD_TV 1 41 | #else 42 | #define SD_TV 0 43 | #endif 44 | 45 | #if TARGET_OS_WATCH 46 | #define SD_WATCH 1 47 | #else 48 | #define SD_WATCH 0 49 | #endif 50 | 51 | 52 | #if SD_MAC 53 | #import 54 | #ifndef UIImage 55 | #define UIImage NSImage 56 | #endif 57 | #ifndef UIImageView 58 | #define UIImageView NSImageView 59 | #endif 60 | #ifndef UIView 61 | #define UIView NSView 62 | #endif 63 | #else 64 | #if __IPHONE_OS_VERSION_MIN_REQUIRED != 20000 && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 65 | #error SDWebImage doesn't support Deployment Target version < 5.0 66 | #endif 67 | 68 | #if SD_UIKIT 69 | #import 70 | #endif 71 | #if SD_WATCH 72 | #import 73 | #endif 74 | #endif 75 | 76 | #ifndef NS_ENUM 77 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 78 | #endif 79 | 80 | #ifndef NS_OPTIONS 81 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 82 | #endif 83 | 84 | #if OS_OBJECT_USE_OBJC 85 | #undef SDDispatchQueueRelease 86 | #undef SDDispatchQueueSetterSementics 87 | #define SDDispatchQueueRelease(q) 88 | #define SDDispatchQueueSetterSementics strong 89 | #else 90 | #undef SDDispatchQueueRelease 91 | #undef SDDispatchQueueSetterSementics 92 | #define SDDispatchQueueRelease(q) (dispatch_release(q)) 93 | #define SDDispatchQueueSetterSementics assign 94 | #endif 95 | 96 | extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image); 97 | 98 | typedef void(^SDWebImageNoParamsBlock)(); 99 | 100 | extern NSString *const SDWebImageErrorDomain; 101 | 102 | #ifndef dispatch_main_async_safe 103 | #define dispatch_main_async_safe(block)\ 104 | if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0) {\ 105 | block();\ 106 | } else {\ 107 | dispatch_async(dispatch_get_main_queue(), block);\ 108 | } 109 | #endif 110 | 111 | static int64_t kAsyncTestTimeout = 5; 112 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/SDWebImageCompat.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if !__has_feature(objc_arc) 12 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 13 | #endif 14 | 15 | inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { 16 | if (!image) { 17 | return nil; 18 | } 19 | 20 | #if SD_MAC 21 | return image; 22 | #elif SD_UIKIT || SD_WATCH 23 | if ((image.images).count > 0) { 24 | NSMutableArray *scaledImages = [NSMutableArray array]; 25 | 26 | for (UIImage *tempImage in image.images) { 27 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; 28 | } 29 | 30 | return [UIImage animatedImageWithImages:scaledImages duration:image.duration]; 31 | } 32 | else { 33 | #if SD_WATCH 34 | if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) { 35 | #elif SD_UIKIT 36 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { 37 | #endif 38 | CGFloat scale = 1; 39 | if (key.length >= 8) { 40 | NSRange range = [key rangeOfString:@"@2x."]; 41 | if (range.location != NSNotFound) { 42 | scale = 2.0; 43 | } 44 | 45 | range = [key rangeOfString:@"@3x."]; 46 | if (range.location != NSNotFound) { 47 | scale = 3.0; 48 | } 49 | } 50 | 51 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; 52 | image = scaledImage; 53 | } 54 | return image; 55 | } 56 | #endif 57 | } 58 | 59 | NSString *const SDWebImageErrorDomain = @"SDWebImageErrorDomain"; 60 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) james 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | #import "SDWebImageCompat.h" 12 | 13 | @interface UIImage (ForceDecode) 14 | 15 | + (nullable UIImage *)decodedImageWithImage:(nullable UIImage *)image; 16 | 17 | + (nullable UIImage *)decodedAndScaledDownImageWithImage:(nullable UIImage *)image; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | @protocol SDWebImageOperation 12 | 13 | - (void)cancel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "SDWebImageCompat.h" 11 | 12 | @interface UIImage (GIF) 13 | 14 | /** 15 | * Compatibility method - creates an animated UIImage from an NSData, it will only contain the 1st frame image 16 | */ 17 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 18 | 19 | /** 20 | * Checks if an UIImage instance is a GIF. Will use the `images` array 21 | */ 22 | - (BOOL)isGIF; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/UIImage+GIF.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Laurin Brandner 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import "UIImage+GIF.h" 11 | #import 12 | #import "objc/runtime.h" 13 | #import "NSImage+WebCache.h" 14 | 15 | @implementation UIImage (GIF) 16 | 17 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data { 18 | if (!data) { 19 | return nil; 20 | } 21 | 22 | CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); 23 | 24 | size_t count = CGImageSourceGetCount(source); 25 | 26 | UIImage *staticImage; 27 | 28 | if (count <= 1) { 29 | staticImage = [[UIImage alloc] initWithData:data]; 30 | } else { 31 | // we will only retrieve the 1st frame. the full GIF support is available via the FLAnimatedImageView category. 32 | // this here is only code to allow drawing animated images as static ones 33 | #if SD_WATCH 34 | CGFloat scale = 1; 35 | scale = [WKInterfaceDevice currentDevice].screenScale; 36 | #elif SD_UIKIT 37 | CGFloat scale = 1; 38 | scale = [UIScreen mainScreen].scale; 39 | #endif 40 | 41 | CGImageRef CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); 42 | #if SD_UIKIT || SD_WATCH 43 | UIImage *frameImage = [UIImage imageWithCGImage:CGImage scale:scale orientation:UIImageOrientationUp]; 44 | staticImage = [UIImage animatedImageWithImages:@[frameImage] duration:0.0f]; 45 | #elif SD_MAC 46 | staticImage = [[UIImage alloc] initWithCGImage:CGImage size:NSZeroSize]; 47 | #endif 48 | CGImageRelease(CGImage); 49 | } 50 | 51 | CFRelease(source); 52 | 53 | return staticImage; 54 | } 55 | 56 | - (BOOL)isGIF { 57 | return (self.images != nil); 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | #import "NSData+ImageContentType.h" 11 | 12 | @interface UIImage (MultiFormat) 13 | 14 | + (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; 15 | - (nullable NSData *)sd_imageData; 16 | - (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | /** 16 | * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. 17 | */ 18 | @interface UIImageView (HighlightedWebCache) 19 | 20 | /** 21 | * Set the imageView `highlightedImage` with an `url`. 22 | * 23 | * The download is asynchronous and cached. 24 | * 25 | * @param url The url for the image. 26 | */ 27 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url; 28 | 29 | /** 30 | * Set the imageView `highlightedImage` with an `url` and custom options. 31 | * 32 | * The download is asynchronous and cached. 33 | * 34 | * @param url The url for the image. 35 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 36 | */ 37 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 38 | options:(SDWebImageOptions)options; 39 | 40 | /** 41 | * Set the imageView `highlightedImage` with an `url`. 42 | * 43 | * The download is asynchronous and cached. 44 | * 45 | * @param url The url for the image. 46 | * @param completedBlock A block called when operation has been completed. This block has no return value 47 | * and takes the requested UIImage as first parameter. In case of error the image parameter 48 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 49 | * indicating if the image was retrieved from the local cache or from the network. 50 | * The fourth parameter is the original image url. 51 | */ 52 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 53 | completed:(nullable SDExternalCompletionBlock)completedBlock; 54 | 55 | /** 56 | * Set the imageView `highlightedImage` with an `url` and custom options. 57 | * 58 | * The download is asynchronous and cached. 59 | * 60 | * @param url The url for the image. 61 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 62 | * @param completedBlock A block called when operation has been completed. This block has no return value 63 | * and takes the requested UIImage as first parameter. In case of error the image parameter 64 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 65 | * indicating if the image was retrieved from the local cache or from the network. 66 | * The fourth parameter is the original image url. 67 | */ 68 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 69 | options:(SDWebImageOptions)options 70 | completed:(nullable SDExternalCompletionBlock)completedBlock; 71 | 72 | /** 73 | * Set the imageView `highlightedImage` with an `url` and custom options. 74 | * 75 | * The download is asynchronous and cached. 76 | * 77 | * @param url The url for the image. 78 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 79 | * @param progressBlock A block called while image is downloading 80 | * @note the progress block is executed on a background queue 81 | * @param completedBlock A block called when operation has been completed. This block has no return value 82 | * and takes the requested UIImage as first parameter. In case of error the image parameter 83 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 84 | * indicating if the image was retrieved from the local cache or from the network. 85 | * The fourth parameter is the original image url. 86 | */ 87 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 88 | options:(SDWebImageOptions)options 89 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 90 | completed:(nullable SDExternalCompletionBlock)completedBlock; 91 | 92 | @end 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/UIImageView+HighlightedWebCache.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIImageView+HighlightedWebCache.h" 10 | 11 | #if SD_UIKIT 12 | 13 | #import "UIView+WebCacheOperation.h" 14 | #import "UIView+WebCache.h" 15 | 16 | @implementation UIImageView (HighlightedWebCache) 17 | 18 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url { 19 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; 20 | } 21 | 22 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options { 23 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; 24 | } 25 | 26 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { 27 | [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; 28 | } 29 | 30 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { 31 | [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; 32 | } 33 | 34 | - (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url 35 | options:(SDWebImageOptions)options 36 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 37 | completed:(nullable SDExternalCompletionBlock)completedBlock { 38 | __weak typeof(self)weakSelf = self; 39 | [self sd_internalSetImageWithURL:url 40 | placeholderImage:nil 41 | options:options 42 | operationKey:@"UIImageViewImageOperationHighlighted" 43 | setImageBlock:^(UIImage *image, NSData *imageData) { 44 | weakSelf.highlightedImage = image; 45 | } 46 | progress:progressBlock 47 | completed:completedBlock]; 48 | } 49 | 50 | @end 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/UIView+WebCache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData); 16 | 17 | @interface UIView (WebCache) 18 | 19 | /** 20 | * Get the current image URL. 21 | * 22 | * Note that because of the limitations of categories this property can get out of sync 23 | * if you use setImage: directly. 24 | */ 25 | - (nullable NSURL *)sd_imageURL; 26 | 27 | /** 28 | * Set the imageView `image` with an `url` and optionally a placeholder image. 29 | * 30 | * The download is asynchronous and cached. 31 | * 32 | * @param url The url for the image. 33 | * @param placeholder The image to be set initially, until the image request finishes. 34 | * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. 35 | * @param operationKey A string to be used as the operation key. If nil, will use the class name 36 | * @param setImageBlock Block used for custom set image code 37 | * @param progressBlock A block called while image is downloading 38 | * @note the progress block is executed on a background queue 39 | * @param completedBlock A block called when operation has been completed. This block has no return value 40 | * and takes the requested UIImage as first parameter. In case of error the image parameter 41 | * is nil and the second parameter may contain an NSError. The third parameter is a Boolean 42 | * indicating if the image was retrieved from the local cache or from the network. 43 | * The fourth parameter is the original image url. 44 | */ 45 | - (void)sd_internalSetImageWithURL:(nullable NSURL *)url 46 | placeholderImage:(nullable UIImage *)placeholder 47 | options:(SDWebImageOptions)options 48 | operationKey:(nullable NSString *)operationKey 49 | setImageBlock:(nullable SDSetImageBlock)setImageBlock 50 | progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock 51 | completed:(nullable SDExternalCompletionBlock)completedBlock; 52 | 53 | /** 54 | * Cancel the current download 55 | */ 56 | - (void)sd_cancelCurrentImageLoad; 57 | 58 | #if SD_UIKIT 59 | 60 | #pragma mark - Activity indicator 61 | 62 | /** 63 | * Show activity UIActivityIndicatorView 64 | */ 65 | - (void)sd_setShowActivityIndicatorView:(BOOL)show; 66 | 67 | /** 68 | * set desired UIActivityIndicatorViewStyle 69 | * 70 | * @param style The style of the UIActivityIndicatorView 71 | */ 72 | - (void)sd_setIndicatorStyle:(UIActivityIndicatorViewStyle)style; 73 | 74 | - (BOOL)sd_showActivityIndicatorView; 75 | - (void)sd_addActivityIndicator; 76 | - (void)sd_removeActivityIndicator; 77 | 78 | #endif 79 | 80 | @end 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/UIView+WebCacheOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "SDWebImageManager.h" 14 | 15 | @interface UIView (WebCacheOperation) 16 | 17 | /** 18 | * Set the image load operation (storage in a UIView based dictionary) 19 | * 20 | * @param operation the operation 21 | * @param key key for storing the operation 22 | */ 23 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; 24 | 25 | /** 26 | * Cancel all operations for the current UIView and key 27 | * 28 | * @param key key for identifying the operations 29 | */ 30 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key; 31 | 32 | /** 33 | * Just remove the operations corresponding to the current UIView and key without cancelling them 34 | * 35 | * @param key key for identifying the operations 36 | */ 37 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ThirdParty/SDWebImage/SDWebImage/UIView+WebCacheOperation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import "UIView+WebCacheOperation.h" 10 | 11 | #if SD_UIKIT || SD_MAC 12 | 13 | #import "objc/runtime.h" 14 | 15 | static char loadOperationKey; 16 | 17 | typedef NSMutableDictionary SDOperationsDictionary; 18 | 19 | @implementation UIView (WebCacheOperation) 20 | 21 | - (SDOperationsDictionary *)operationDictionary { 22 | SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey); 23 | if (operations) { 24 | return operations; 25 | } 26 | operations = [NSMutableDictionary dictionary]; 27 | objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | return operations; 29 | } 30 | 31 | - (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { 32 | if (key) { 33 | [self sd_cancelImageLoadOperationWithKey:key]; 34 | if (operation) { 35 | SDOperationsDictionary *operationDictionary = [self operationDictionary]; 36 | operationDictionary[key] = operation; 37 | } 38 | } 39 | } 40 | 41 | - (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { 42 | // Cancel in progress downloader from queue 43 | SDOperationsDictionary *operationDictionary = [self operationDictionary]; 44 | id operations = operationDictionary[key]; 45 | if (operations) { 46 | if ([operations isKindOfClass:[NSArray class]]) { 47 | for (id operation in operations) { 48 | if (operation) { 49 | [operation cancel]; 50 | } 51 | } 52 | } else if ([operations conformsToProtocol:@protocol(SDWebImageOperation)]){ 53 | [(id) operations cancel]; 54 | } 55 | [operationDictionary removeObjectForKey:key]; 56 | } 57 | } 58 | 59 | - (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key { 60 | if (key) { 61 | SDOperationsDictionary *operationDictionary = [self operationDictionary]; 62 | [operationDictionary removeObjectForKey:key]; 63 | } 64 | } 65 | 66 | @end 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/ZSTest.pch: -------------------------------------------------------------------------------- 1 | // 2 | // ZSTest.pch 3 | // ZSTest 4 | // 5 | // Created by zhoushuai on 16/3/9. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #ifndef ZSTest_pch 10 | #define ZSTest_pch 11 | 12 | // Include any system framework and library headers here that should be included in all compilation units. 13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 14 | 15 | 16 | #define MaxRect CGRectMake(15, 30, ZSToolScreenWidth - 15*2, CGFLOAT_HEIGHT_UNKNOWN) 17 | 18 | #import "BaseViewController.h" 19 | #endif /* ZSTest_pch */ 20 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ZSTest 4 | // 5 | // Created by zhoushuai on 16/3/9. 6 | // Copyright © 2016年 zhoushuai. 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 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTestTests/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 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTestTests/ZSTestTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZSTestTests.m 3 | // ZSTestTests 4 | // 5 | // Created by zhoushuai on 16/3/9. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZSTestTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ZSTestTests 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 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTestUITests/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 | -------------------------------------------------------------------------------- /DTcoreTextDemo/ZSTestUITests/ZSTestUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZSTestUITests.m 3 | // ZSTestUITests 4 | // 5 | // Created by zhoushuai on 16/3/9. 6 | // Copyright © 2016年 zhoushuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZSTestUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ZSTestUITests 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## DTCoreTextDemo 2 | DTCoreText是可以将HTML字符串转为为富文本使用的工具,本例提供其基本用法,演示作为Label、ScrollView、Cell的三种用法。 3 | 4 | DTCoreText这个工具很强大,但是相关的资料和博客却很少,所以在总结了很多的用法之后,将其基本的使用集中在这个工程里测试。在使用的时候需要注意: 5 | 6 | 1.html标签的图片链接如果没有自带宽高属性的时候,需要借助DTCoreText的代理先获取宽高再刷新html显示。 7 | 8 | 2.关于html标签的超链接,如果需要响应处理,我们需要自定义Button等控件,这个也是在代理方法中处理的。 9 | 10 | ## 效果图: 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Screenshots/DTcoreTextDemoImg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuyubeichen/DTCoreTextDemo/829c86e3c83628cf3096b1737ad7054f53ffe058/Screenshots/DTcoreTextDemoImg1.png -------------------------------------------------------------------------------- /Screenshots/DTcoreTextDemoImg2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuyubeichen/DTCoreTextDemo/829c86e3c83628cf3096b1737ad7054f53ffe058/Screenshots/DTcoreTextDemoImg2.png -------------------------------------------------------------------------------- /Screenshots/DTcoreTextDemoImg3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuyubeichen/DTCoreTextDemo/829c86e3c83628cf3096b1737ad7054f53ffe058/Screenshots/DTcoreTextDemoImg3.png -------------------------------------------------------------------------------- /Screenshots/DTcoreTextDemoImg5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wuyubeichen/DTCoreTextDemo/829c86e3c83628cf3096b1737ad7054f53ffe058/Screenshots/DTcoreTextDemoImg5.png --------------------------------------------------------------------------------