├── .gitignore ├── README.md ├── Resouce ├── Logo.png ├── Logo.psd ├── MarkImage │ └── 5.5 │ │ ├── Simulator Screen Shot 2016年9月11日 下午12.14.45.png │ │ ├── Simulator Screen Shot 2016年9月29日 下午2.38.45.png │ │ └── Simulator Screen Shot 2016年9月29日 下午2.39.24.png ├── icon.png └── placeHolder │ ├── 1c7279ba65c45247bc61294de1ea4183af6d999d34de-krtw8c_fw658.png │ ├── 2476f29e9b5ffff4145c547c51f25e7f06cb69553837e-bWu4JC_fw658.jpeg │ ├── 404_1.gif │ ├── 49d6c9388eafae077c416cd9d62942d8b6c8035d3a36-zE3AAA_fw658.png │ ├── 5a15af95722b5e664b27a2ec7a7edd36620af2c537cd-6SOOuy_fw658.png │ └── 8344243a16926ba1af058f39954a0ea9a4f5bea19698-1Fh1Qw_fw658.png └── WaterLabel ├── .podfile.swp ├── Capture ├── Base.lproj │ └── MainInterface.storyboard ├── Capture-Header.h ├── Capture.entitlements ├── Info.plist └── ShareViewController.swift ├── Podfile.lock ├── WaterLabel.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── huchunyuan.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── huchunyuan.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── WaterLabel.xcscheme │ └── xcschememanagement.plist ├── WaterLabel.xcworkspace └── contents.xcworkspacedata ├── WaterLabel ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-29.0@2x.png │ │ ├── Icon-29.0@3x.png │ │ ├── Icon-40.0@2x.png │ │ ├── Icon-40.0@3x.png │ │ ├── Icon-60.0@2x.png │ │ └── Icon-60.0@3x.png │ ├── Contents.json │ ├── Icon │ │ ├── Contents.json │ │ ├── add.imageset │ │ │ ├── Contents.json │ │ │ ├── addLabel.png │ │ │ ├── addLabel@2x.png │ │ │ └── addLabel@3x.png │ │ ├── last.imageset │ │ │ ├── Contents.json │ │ │ ├── last.png │ │ │ ├── last@2x.png │ │ │ └── last@3x.png │ │ ├── next.imageset │ │ │ ├── Contents.json │ │ │ ├── next.png │ │ │ ├── next@2x.png │ │ │ └── next@3x.png │ │ ├── refresh.imageset │ │ │ ├── Contents.json │ │ │ ├── refresh.png │ │ │ ├── refresh@2x.png │ │ │ └── refresh@3x.png │ │ └── save.imageset │ │ │ ├── Contents.json │ │ │ ├── save.png │ │ │ ├── save@2x.png │ │ │ └── save@3x.png │ ├── background.imageset │ │ ├── Contents.json │ │ └── background.png │ ├── bannerPlaceHolder.imageset │ │ ├── 8344243a16926ba1af058f39954a0ea9a4f5bea19698-1Fh1Qw_fw658.png │ │ └── Contents.json │ ├── logo.imageset │ │ ├── Contents.json │ │ └── icon.png │ ├── pushClose.imageset │ │ ├── Contents.json │ │ ├── pushClose.png │ │ ├── pushClose@2x.png │ │ └── pushClose@3x.png │ └── success.imageset │ │ ├── Contents.json │ │ ├── success.png │ │ ├── success@2x.png │ │ └── success@3x.png ├── Helper │ └── LeanCloudData.swift ├── Info.plist ├── Macro │ ├── ColorFile.swift │ ├── Header.h │ ├── MarcoFile.swift │ └── RootKey.swift ├── Model │ └── BannerModel.swift ├── Scenes │ ├── AddWaterLabel │ │ ├── Controller │ │ │ └── EditViewController.swift │ │ ├── Model │ │ │ └── EditModel.swift │ │ └── View │ │ │ ├── EditImageView.swift │ │ │ └── WaterMark.swift │ ├── Capture │ │ ├── Controller │ │ │ ├── BeginCaptureViewController.swift │ │ │ └── CaptureViewController.swift │ │ └── Model │ │ │ └── CaptureModel.swift │ ├── DemoViewController.swift │ ├── EditLabel │ │ ├── Controller │ │ │ └── EditLabelViewController.swift │ │ ├── Model │ │ │ └── LabelModel.swift │ │ └── View │ │ │ ├── ColorSelectView.swift │ │ │ ├── EditViewModel.swift │ │ │ ├── FontEditSubView.swift │ │ │ └── SelectView.swift │ ├── Home │ │ ├── Controller │ │ │ ├── HomeViewController.swift │ │ │ └── XYHomeVC.swift │ │ └── View │ │ │ ├── XYHomeCell.swift │ │ │ ├── XYHomePageHeader.swift │ │ │ ├── XYHomeViewExtension.swift │ │ │ └── ZEHomeView.swift │ └── ZEVC │ │ ├── FeedBack │ │ ├── Controller │ │ │ └── ZEFeedBackContoller.swift │ │ ├── Model │ │ │ └── ZEFeedBackModel.swift │ │ └── View │ │ │ ├── ZEFeedBackSubViewClass.swift │ │ │ └── ZEFeedBackView.swift │ │ ├── RegistLogin │ │ ├── Controller │ │ │ ├── ZELoginViewController.swift │ │ │ └── ZERegistController.swift │ │ ├── Model │ │ │ └── ZELoginModel.swift │ │ └── View │ │ │ └── ZELoginView.swift │ │ └── ZEHead.swift ├── StroyBoard │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Vendors │ ├── IGLDropDownMenu │ │ ├── IGLDropDownItem.h │ │ ├── IGLDropDownItem.m │ │ ├── IGLDropDownMenu.h │ │ └── IGLDropDownMenu.m │ ├── MBProgressHUD.h │ ├── MBProgressHUD.m │ ├── NJKWebViewProgress │ │ ├── NJKWebViewProgress.h │ │ ├── NJKWebViewProgress.m │ │ ├── NJKWebViewProgressView.h │ │ └── NJKWebViewProgressView.m │ ├── OffscreenRendering │ │ ├── UIImage+RoundedCorner.h │ │ ├── UIImage+RoundedCorner.m │ │ ├── UIView+RoundedCorner.h │ │ └── UIView+RoundedCorner.m │ ├── PublicProtocol │ │ └── GestureRecognizerProtocl.swift │ ├── SDCycleScrollView │ │ ├── PageControl │ │ │ ├── TAAbstractDotView.h │ │ │ ├── TAAbstractDotView.m │ │ │ ├── TAAnimatedDotView.h │ │ │ ├── TAAnimatedDotView.m │ │ │ ├── TADotView.h │ │ │ ├── TADotView.m │ │ │ ├── TAPageControl.h │ │ │ └── TAPageControl.m │ │ ├── SDCollectionViewCell.h │ │ ├── SDCollectionViewCell.m │ │ ├── SDCycleScrollView.h │ │ ├── SDCycleScrollView.m │ │ ├── UIView+SDExtension.h │ │ └── UIView+SDExtension.m │ ├── ShowString │ │ ├── KLCPopup.h │ │ ├── KLCPopup.m │ │ ├── ShowString.h │ │ └── ShowString.m │ ├── Snapkit │ │ ├── Constraint.swift │ │ ├── ConstraintAttributes.swift │ │ ├── ConstraintConfig.swift │ │ ├── ConstraintConstantTarget.swift │ │ ├── ConstraintDSL.swift │ │ ├── ConstraintDescription.swift │ │ ├── ConstraintInsetTarget.swift │ │ ├── ConstraintInsets.swift │ │ ├── ConstraintItem.swift │ │ ├── ConstraintLayoutGuide.swift │ │ ├── ConstraintLayoutGuideDSL.swift │ │ ├── ConstraintLayoutSupport.swift │ │ ├── ConstraintLayoutSupportDSL.swift │ │ ├── ConstraintMaker.swift │ │ ├── ConstraintMakerEditable.swift │ │ ├── ConstraintMakerExtendable.swift │ │ ├── ConstraintMakerFinalizable.swift │ │ ├── ConstraintMakerPriortizable.swift │ │ ├── ConstraintMakerRelatable.swift │ │ ├── ConstraintMultiplierTarget.swift │ │ ├── ConstraintOffsetTarget.swift │ │ ├── ConstraintPriorityTarget.swift │ │ ├── ConstraintRelatableTarget.swift │ │ ├── ConstraintRelation.swift │ │ ├── ConstraintView+Extensions.swift │ │ ├── ConstraintView.swift │ │ ├── ConstraintViewDSL.swift │ │ ├── Debugging.swift │ │ ├── Info.plist │ │ ├── LayoutConstraint.swift │ │ ├── SnapKit.h │ │ ├── UILayoutGuide+Extensions.swift │ │ └── UILayoutSupport+Extensions.swift │ ├── SwViewCapture │ │ ├── Info.plist │ │ ├── SwViewCapture.h │ │ ├── UIScrollView+SwCapture.swift │ │ ├── UIView+SwCapture.swift │ │ └── WKWebView+SwCapture.swift │ ├── SwiftyJSON │ │ ├── SwiftyJSON.h │ │ └── SwiftyJSON.swift │ ├── TZImagePickerController │ │ ├── TZAssetCell.h │ │ ├── TZAssetCell.m │ │ ├── TZAssetModel.h │ │ ├── TZAssetModel.m │ │ ├── TZImageManager.h │ │ ├── TZImageManager.m │ │ ├── TZImagePickerController.bundle │ │ │ ├── MMVideoPreviewPlay@2x.png │ │ │ ├── MMVideoPreviewPlayHL@2x.png │ │ │ ├── Root.plist │ │ │ ├── TZAlbumCell.xib │ │ │ ├── TZAssetCell.xib │ │ │ ├── TableViewArrow@2x.png │ │ │ ├── VideoSendIcon@2x.png │ │ │ ├── navi_back@2x.png │ │ │ ├── photo_def_photoPickerVc@2x.png │ │ │ ├── photo_def_previewVc@2x.png │ │ │ ├── photo_number_icon@2x.png │ │ │ ├── photo_original_def@2x.png │ │ │ ├── photo_original_sel@2x.png │ │ │ ├── photo_sel_photoPickerVc@2x.png │ │ │ ├── photo_sel_previewVc@2x.png │ │ │ ├── preview_number_icon@2x.png │ │ │ ├── preview_original_def@2x.png │ │ │ └── takePicture@2x.png │ │ ├── TZImagePickerController.h │ │ ├── TZImagePickerController.m │ │ ├── TZPhotoPickerController.h │ │ ├── TZPhotoPickerController.m │ │ ├── TZPhotoPreviewCell.h │ │ ├── TZPhotoPreviewCell.m │ │ ├── TZPhotoPreviewController.h │ │ ├── TZPhotoPreviewController.m │ │ ├── TZVideoPlayerController.h │ │ ├── TZVideoPlayerController.m │ │ ├── UIView+Layout.h │ │ └── UIView+Layout.m │ └── ZEViewKit │ │ ├── ZEAlertView.swift │ │ ├── ZEHud.swift │ │ └── ZEToolBar.swift └── WaterLabel.entitlements └── podfile /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | .DS_Store 6 | 7 | ## Build generated 8 | build/ 9 | DerivedData 10 | 11 | ## Various settings 12 | *.pbxuser 13 | !default.pbxuser 14 | *.mode1v3 15 | !default.mode1v3 16 | *.mode2v3 17 | !default.mode2v3 18 | *.perspectivev3 19 | !default.perspectivev3 20 | xcuserdata 21 | 22 | ## Other 23 | *.xccheckout 24 | *.moved-aside 25 | *.xcuserstate 26 | *.xcscmblueprint 27 | 28 | ## Obj-C/Swift specific 29 | *.hmap 30 | *.ipa 31 | 32 | # CocoaPods 33 | # 34 | # We recommend against adding the Pods directory to your .gitignore. However 35 | # you should judge for yourself, the pros and cons are mentioned at: 36 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 37 | 38 | Pods/ 39 | 40 | # Carthage 41 | # 42 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 43 | # Carthage/Checkouts 44 | 45 | Carthage/Build 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WaterLabel 2 | AppStore地址:https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=1148289486&mt=8 3 | 4 | ### 更新日志 5 | - 1.1: 6 | - [X] 支持iOS8.0 7 | - [X] 水印边框,颜色 8 | - [X] 更流畅的编辑文字 9 | 10 | ### 下一步 11 | - [ ] 登陆/水印缓存到网络 12 | - [ ] 更多的水印类型 13 | 14 | ### 已知问题 15 | - [ ] 水印会往左偏一些.. 16 | - [ ] editView 高度少了 17 | -------------------------------------------------------------------------------- /Resouce/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/Logo.png -------------------------------------------------------------------------------- /Resouce/Logo.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/Logo.psd -------------------------------------------------------------------------------- /Resouce/MarkImage/5.5/Simulator Screen Shot 2016年9月11日 下午12.14.45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/MarkImage/5.5/Simulator Screen Shot 2016年9月11日 下午12.14.45.png -------------------------------------------------------------------------------- /Resouce/MarkImage/5.5/Simulator Screen Shot 2016年9月29日 下午2.38.45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/MarkImage/5.5/Simulator Screen Shot 2016年9月29日 下午2.38.45.png -------------------------------------------------------------------------------- /Resouce/MarkImage/5.5/Simulator Screen Shot 2016年9月29日 下午2.39.24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/MarkImage/5.5/Simulator Screen Shot 2016年9月29日 下午2.39.24.png -------------------------------------------------------------------------------- /Resouce/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/icon.png -------------------------------------------------------------------------------- /Resouce/placeHolder/1c7279ba65c45247bc61294de1ea4183af6d999d34de-krtw8c_fw658.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/placeHolder/1c7279ba65c45247bc61294de1ea4183af6d999d34de-krtw8c_fw658.png -------------------------------------------------------------------------------- /Resouce/placeHolder/2476f29e9b5ffff4145c547c51f25e7f06cb69553837e-bWu4JC_fw658.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/placeHolder/2476f29e9b5ffff4145c547c51f25e7f06cb69553837e-bWu4JC_fw658.jpeg -------------------------------------------------------------------------------- /Resouce/placeHolder/404_1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/placeHolder/404_1.gif -------------------------------------------------------------------------------- /Resouce/placeHolder/49d6c9388eafae077c416cd9d62942d8b6c8035d3a36-zE3AAA_fw658.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/placeHolder/49d6c9388eafae077c416cd9d62942d8b6c8035d3a36-zE3AAA_fw658.png -------------------------------------------------------------------------------- /Resouce/placeHolder/5a15af95722b5e664b27a2ec7a7edd36620af2c537cd-6SOOuy_fw658.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/placeHolder/5a15af95722b5e664b27a2ec7a7edd36620af2c537cd-6SOOuy_fw658.png -------------------------------------------------------------------------------- /Resouce/placeHolder/8344243a16926ba1af058f39954a0ea9a4f5bea19698-1Fh1Qw_fw658.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/Resouce/placeHolder/8344243a16926ba1af058f39954a0ea9a4f5bea19698-1Fh1Qw_fw658.png -------------------------------------------------------------------------------- /WaterLabel/.podfile.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/.podfile.swp -------------------------------------------------------------------------------- /WaterLabel/Capture/Base.lproj/MainInterface.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 | -------------------------------------------------------------------------------- /WaterLabel/Capture/Capture-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Capture-Header.h 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/9/27. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | #ifndef Capture_Header_h 10 | #define Capture_Header_h 11 | #import "MBProgressHUD.h" 12 | #import "NJKWebViewProgress.h" 13 | #import "NJKWebViewProgressView.h" 14 | #import 15 | #endif /* Capture_Header_h */ 16 | -------------------------------------------------------------------------------- /WaterLabel/Capture/Capture.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.WaterMark 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /WaterLabel/Capture/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Capture 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 2.1 21 | CFBundleVersion 22 | 2 23 | NSAppTransportSecurity 24 | 25 | NSAllowsArbitraryLoads 26 | 27 | 28 | NSExtension 29 | 30 | NSExtensionAttributes 31 | 32 | NSExtensionActivationRule 33 | 34 | NSExtensionActivationSupportsText 35 | 36 | NSExtensionActivationSupportsWebPageWithMaxCount 37 | 1 38 | NSExtensionActivationSupportsWebURLWithMaxCount 39 | 1 40 | 41 | 42 | NSExtensionMainStoryboard 43 | MainInterface 44 | NSExtensionPointIdentifier 45 | com.apple.share-services 46 | 47 | NSPhotoLibraryUsageDescription 48 | 是否允许将网页截图存到你的相册中? 49 | 50 | 51 | -------------------------------------------------------------------------------- /WaterLabel/Capture/ShareViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ShareViewController.swift 3 | // Capture 4 | // 5 | // Created by 胡春源 on 16/9/26. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import Foundation 11 | import Social 12 | 13 | class ShareViewController: UIViewController { 14 | var capture:CaptureViewController! 15 | override func viewWillAppear(_ animated: Bool) { 16 | super.viewWillAppear(animated) 17 | let navi = UINavigationController(rootViewController: capture) 18 | self.present(navi, animated: true) { 19 | 20 | } 21 | } 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | 25 | capture = CaptureViewController() 26 | weak var weakSelf = self 27 | capture.dismissBlock = { 28 | weakSelf?.extensionContext?.cancelRequest(withError: NSError(domain: "CustomShareError", code: NSUserCancelledError, userInfo: nil)) 29 | } 30 | getUrl() 31 | } 32 | func getUrl(){ 33 | weak var weakSelf = self 34 | let array = self.extensionContext!.inputItems as NSArray 35 | array.enumerateObjects({ object, index, stop in 36 | let arr = (object as! NSExtensionItem).attachments! as NSArray 37 | arr.enumerateObjects({ object, index, stop in 38 | let itemProvider = object as! NSItemProvider 39 | 40 | if itemProvider.hasItemConformingToTypeIdentifier("public.url") == false { 41 | return 42 | } 43 | itemProvider.loadItem(forTypeIdentifier: "public.url", options: nil, completionHandler: { (item, error) in 44 | if (item as! NSObject).isKind(of: NSURL.self) == false { 45 | return 46 | } 47 | DispatchQueue.main.async { 48 | let str = (item as! URL).absoluteString 49 | CaptureModel.save(str) 50 | let ac = UIAlertController(title: "成功", message: "网址已保存成功,请打开WaterMark进行网页截图", preferredStyle: .alert) 51 | let action = UIAlertAction(title: "确定", style: .default, handler: { (action) in 52 | weakSelf?.extensionContext?.cancelRequest(withError: NSError(domain: "CustomShareError", code: NSUserCancelledError, userInfo: nil)) 53 | }) 54 | ac.addAction(action) 55 | weakSelf?.present(ac, animated: true, completion: nil) 56 | return 57 | } 58 | }) 59 | }) 60 | return 61 | }) 62 | } 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /WaterLabel/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (2.6.3): 3 | - AFNetworking/NSURLConnection (= 2.6.3) 4 | - AFNetworking/NSURLSession (= 2.6.3) 5 | - AFNetworking/Reachability (= 2.6.3) 6 | - AFNetworking/Security (= 2.6.3) 7 | - AFNetworking/Serialization (= 2.6.3) 8 | - AFNetworking/UIKit (= 2.6.3) 9 | - AFNetworking/NSURLConnection (2.6.3): 10 | - AFNetworking/Reachability 11 | - AFNetworking/Security 12 | - AFNetworking/Serialization 13 | - AFNetworking/NSURLSession (2.6.3): 14 | - AFNetworking/Reachability 15 | - AFNetworking/Security 16 | - AFNetworking/Serialization 17 | - AFNetworking/Reachability (2.6.3) 18 | - AFNetworking/Security (2.6.3) 19 | - AFNetworking/Serialization (2.6.3) 20 | - AFNetworking/UIKit (2.6.3): 21 | - AFNetworking/NSURLConnection 22 | - AFNetworking/NSURLSession 23 | - AVOSCloud (3.3.5) 24 | - Bugly (2.3.1) 25 | - LeanCloudSocial (0.0.8): 26 | - AFNetworking (~> 2.0) 27 | - AVOSCloud (~> 3.1) 28 | - SDWebImage (3.8.1): 29 | - SDWebImage/Core (= 3.8.1) 30 | - SDWebImage/Core (3.8.1) 31 | 32 | DEPENDENCIES: 33 | - AVOSCloud 34 | - Bugly 35 | - LeanCloudSocial 36 | - SDWebImage 37 | 38 | SPEC CHECKSUMS: 39 | AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60 40 | AVOSCloud: 1fe170768bee7e05bc3ea86e38d5bddb105cb957 41 | Bugly: c8ece2fa5bdcb404abdd0e07131e8129f580d893 42 | LeanCloudSocial: f7787dfc1559dc47263bbfd37a03c870352ad98a 43 | SDWebImage: 35f9627a3e44b4f292a8a8ce6a531fa488239b91 44 | 45 | COCOAPODS: 0.39.0 46 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel.xcodeproj/project.xcworkspace/xcuserdata/huchunyuan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel.xcodeproj/project.xcworkspace/xcuserdata/huchunyuan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /WaterLabel/WaterLabel.xcodeproj/xcuserdata/huchunyuan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel.xcodeproj/xcuserdata/huchunyuan.xcuserdatad/xcschemes/WaterLabel.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 69 | 70 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel.xcodeproj/xcuserdata/huchunyuan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Capture.xcscheme 8 | 9 | orderHint 10 | 3 11 | 12 | WaterLabel.xcscheme 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 527578C71D99342A00C87172 21 | 22 | primary 23 | 24 | 25 | 52FBD83C1D3DDDD700304651 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/7/19. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 19 | // Override point for customization after application launch. 20 | AVOSCloud.setApplicationId(app_root_id, clientKey: app_root_key) 21 | Bugly.start(withAppId: "edb7ed37bc") 22 | 23 | return true 24 | } 25 | 26 | func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { 27 | let str = url.absoluteString.substring(from: "WM://".endIndex) 28 | CaptureModel.save(str) 29 | 30 | showBegainVC() 31 | return true 32 | } 33 | 34 | func applicationWillResignActive(_ application: UIApplication) { 35 | // 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. 36 | // 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. 37 | } 38 | 39 | func applicationDidEnterBackground(_ application: UIApplication) { 40 | // 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. 41 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 42 | } 43 | 44 | func applicationWillEnterForeground(_ application: UIApplication) { 45 | // 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. 46 | if CaptureModel.needCapture(){ 47 | showBegainVC() 48 | } 49 | } 50 | func showBegainVC(){ 51 | let stroyBoard = UIStoryboard(name: "Main", bundle: nil) 52 | let beginVc = stroyBoard.instantiateViewController(withIdentifier: begainVC) 53 | self.window?.rootViewController?.show(beginVc, sender: nil) 54 | } 55 | 56 | func applicationDidBecomeActive(_ application: UIApplication) { 57 | // 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. 58 | } 59 | 60 | func applicationWillTerminate(_ application: UIApplication) { 61 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 62 | } 63 | 64 | 65 | } 66 | 67 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "size" : "29x29", 15 | "idiom" : "iphone", 16 | "filename" : "Icon-29.0@2x.png", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "size" : "29x29", 21 | "idiom" : "iphone", 22 | "filename" : "Icon-29.0@3x.png", 23 | "scale" : "3x" 24 | }, 25 | { 26 | "size" : "40x40", 27 | "idiom" : "iphone", 28 | "filename" : "Icon-40.0@2x.png", 29 | "scale" : "2x" 30 | }, 31 | { 32 | "size" : "40x40", 33 | "idiom" : "iphone", 34 | "filename" : "Icon-40.0@3x.png", 35 | "scale" : "3x" 36 | }, 37 | { 38 | "size" : "60x60", 39 | "idiom" : "iphone", 40 | "filename" : "Icon-60.0@2x.png", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "size" : "60x60", 45 | "idiom" : "iphone", 46 | "filename" : "Icon-60.0@3x.png", 47 | "scale" : "3x" 48 | } 49 | ], 50 | "info" : { 51 | "version" : 1, 52 | "author" : "xcode" 53 | } 54 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-29.0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-29.0@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-29.0@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-29.0@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-40.0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-40.0@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-40.0@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-40.0@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-60.0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-60.0@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-60.0@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/AppIcon.appiconset/Icon-60.0@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/add.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "addLabel.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "addLabel@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "addLabel@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/add.imageset/addLabel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/add.imageset/addLabel.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/add.imageset/addLabel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/add.imageset/addLabel@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/add.imageset/addLabel@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/add.imageset/addLabel@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/last.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "last.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "last@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "last@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/last.imageset/last.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/last.imageset/last.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/last.imageset/last@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/last.imageset/last@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/last.imageset/last@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/last.imageset/last@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/next.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "next.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "next@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "next@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/next.imageset/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/next.imageset/next.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/next.imageset/next@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/next.imageset/next@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/next.imageset/next@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/next.imageset/next@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/refresh.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "refresh.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "refresh@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "refresh@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/refresh.imageset/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/refresh.imageset/refresh.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/refresh.imageset/refresh@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/refresh.imageset/refresh@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/refresh.imageset/refresh@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/refresh.imageset/refresh@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/save.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "save.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "save@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "save@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/save.imageset/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/save.imageset/save.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/save.imageset/save@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/save.imageset/save@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/Icon/save.imageset/save@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/Icon/save.imageset/save@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "background.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/background.imageset/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/background.imageset/background.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/bannerPlaceHolder.imageset/8344243a16926ba1af058f39954a0ea9a4f5bea19698-1Fh1Qw_fw658.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/bannerPlaceHolder.imageset/8344243a16926ba1af058f39954a0ea9a4f5bea19698-1Fh1Qw_fw658.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/bannerPlaceHolder.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "8344243a16926ba1af058f39954a0ea9a4f5bea19698-1Fh1Qw_fw658.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/logo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "icon.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/logo.imageset/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/logo.imageset/icon.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/pushClose.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "pushClose.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "pushClose@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "pushClose@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/pushClose.imageset/pushClose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/pushClose.imageset/pushClose.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/pushClose.imageset/pushClose@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/pushClose.imageset/pushClose@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/pushClose.imageset/pushClose@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/pushClose.imageset/pushClose@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/success.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "success.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "success@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "success@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/success.imageset/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/success.imageset/success.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/success.imageset/success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/success.imageset/success@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Assets.xcassets/success.imageset/success@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Assets.xcassets/success.imageset/success@3x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Helper/LeanCloudData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LeanCloudData.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/10/2. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | typealias BannerCallBack = (([BannerModel]?) -> ()) 12 | 13 | 14 | class LeanCloudData { 15 | // 获取截图公告 回调两次 16 | func getCaptureString(block:@escaping (_ str:String)->Void){ 17 | let query = self.getQuery(className: "Announcement", cachePolicy: .cacheThenNetwork) 18 | query?.getFirstObjectInBackground({ (obj, error) in 19 | if error != nil{ 20 | return 21 | } 22 | block(obj?.object(forKey: "content") as! String) 23 | }) 24 | } 25 | // 获取运营位数据 26 | func getBanner(block:@escaping BannerCallBack){ 27 | let query = self.getQuery(className: "Banner", cachePolicy: .cacheThenNetwork) 28 | query?.findObjectsInBackground({ (objs, error) in 29 | if error != nil{ 30 | block(nil) 31 | return 32 | } 33 | var banners:[BannerModel] = [] 34 | for obj in objs as! [AVObject] { 35 | let dic = obj.dictionaryForObject() 36 | 37 | let json = JSON(dic) 38 | guard let url = json["url"].string,let imageUrl = json["imageUrl"].string else{ 39 | 40 | continue 41 | } 42 | let banner = BannerModel(url: url, imageUrl: imageUrl) 43 | banners.append(banner) 44 | } 45 | if banners.count == 0 { 46 | block(nil) 47 | return 48 | }else{ 49 | block(banners) 50 | } 51 | }) 52 | } 53 | 54 | func getQuery(className:String!,cachePolicy:AVCachePolicy) -> AVQuery?{ 55 | let query = AVQuery(className: className) 56 | query?.cachePolicy = cachePolicy 57 | return query 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | WaterMark 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 2.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleURLTypes 24 | 25 | 26 | CFBundleURLName 27 | com.lafree.www.watermark 28 | CFBundleURLSchemes 29 | 30 | WM 31 | 32 | 33 | 34 | CFBundleVersion 35 | 2 36 | LSRequiresIPhoneOS 37 | 38 | NSAppTransportSecurity 39 | 40 | NSAllowsArbitraryLoads 41 | 42 | 43 | NSPhotoLibraryUsageDescription 44 | 是否允许将网页截图存到你的相册中? 45 | NSCameraUsageDescription 46 | 是否允许此App访问你的相机? 47 | UILaunchStoryboardName 48 | LaunchScreen 49 | UIMainStoryboardFile 50 | Main 51 | UIRequiredDeviceCapabilities 52 | 53 | armv7 54 | 55 | UIStatusBarHidden 56 | 57 | UISupportedInterfaceOrientations 58 | 59 | UIInterfaceOrientationPortrait 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Macro/ColorFile.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ColorFile.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/8/18. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | let ZEButtomDefultColor = UIColor.init(red: 0/255.0, green: 122/255.0, blue: 255/255.0, alpha: 1) 11 | let titleColorArr:Array<[String:[String:CGFloat]]> = [ 12 | ["黑色":["red":0,"green":0,"blue":0,"alpha":1]], 13 | ["灰色":["red":102,"green":102,"blue":102,"alpha":1]], 14 | ["白色":["red":255,"green":255,"blue":255,"alpha":1]], 15 | ["透明":["red":255,"green":255,"blue":255,"alpha":0]], 16 | ["黄色":["red":255,"green":255,"blue":0,"alpha":1]], 17 | ["绿色":["red":0,"green":255,"blue":0,"alpha":1]], 18 | ["蓝色":["red":0,"green":0,"blue":255,"alpha":1]], 19 | ["红色":["red":255,"green":0,"blue":0,"alpha":1]], 20 | ["紫色":["red":255,"green":0,"blue":255,"alpha":1]], 21 | ] 22 | class ColorFile { 23 | static func colorToDic(_ color:UIColor) -> [String:CGFloat] { 24 | let components = color.cgColor.components 25 | let r = (components?[0])!*255 26 | let g = (components?[1])!*255 27 | let b = (components?[2])!*255 28 | let a = components?[3] 29 | return ["red":r,"green":g,"blue":b,"alpha":a!] 30 | } 31 | static func dicToColor(_ dic:[String:CGFloat]) -> UIColor { 32 | let r = dic["red"]!/255 33 | let g = dic["green"]!/255 34 | let b = dic["blue"]!/255 35 | let a = dic["alpha"]! 36 | return UIColor(red: r, green: g, blue: b, alpha:a) 37 | } 38 | static func colorIsClear(_ color:UIColor) -> Bool { 39 | let components = color.cgColor.components 40 | let a = components?[3] 41 | if a == 0 { 42 | return true 43 | } 44 | return false 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Macro/Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Header.h 3 | // WaterLabel 4 | // 5 | // Created by huchunyuan on 16/1/5. 6 | // Copyright © 2016年 huchunyuan. All rights reserved. 7 | // 8 | 9 | #ifndef Header_h 10 | #define Header_h 11 | 12 | #import "AVOSCloud.h" 13 | 14 | //#import "MLSelectPhotoPickerViewController" 15 | #import "IGLDropDownMenu.h" 16 | #import "UIView+RoundedCorner.h" 17 | #import "TZImageManager.h" 18 | #import "TZImagePickerController.h" 19 | #import "Snapkit.h" 20 | #import "TZImageManager.h" 21 | #import "ShowString.h" 22 | #import "MBProgressHUD.h" 23 | #import "NJKWebViewProgress.h" 24 | #import "NJKWebViewProgressView.h" 25 | #import 26 | #import 27 | #import "SDCycleScrollView.h" 28 | #endif /* Header_h */ 29 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Macro/MarcoFile.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MarcoFile.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/7/17. 6 | // Copyright © 2016年 huchunyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | let screenWidth = UIScreen.main.bounds.width 13 | let screenHeight = UIScreen.main.bounds.height 14 | 15 | 16 | // segueID 17 | let editLabelVCId = "editLabelVC"// 编辑模板页面 18 | let editVCSeugeId = "EditVCSeugeId"// 添加水印页面 19 | let captureSegueId = "webCapture" // 网页截图界面 20 | 21 | let begainVC = "begainVC" 22 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Macro/RootKey.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | //let app_feedback_id = "" 4 | //let app_feedback_key = "" 5 | // 6 | //let app_root_id = "" 7 | //let app_root_key = "" 8 | let app_feedback_id = "byAPhG8u2O18bFaGsgsvqHeb-gzGzoHsz" 9 | let app_feedback_key = "wYCBG0GFI6qcUTO1oRyj4EqP" 10 | 11 | let app_root_id = "MgoAgfkkjEfIFWMKopcbp511-gzGzoHsz" 12 | let app_root_key = "wIyd4W8Mqi4XjroS2uuRJ8CY" 13 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Model/BannerModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BannerModel.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/10/4. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | struct BannerModel { 12 | var url:String 13 | var imageUrl:String 14 | } 15 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/AddWaterLabel/Model/EditModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EditModel.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/7/17. 6 | // Copyright © 2016年 huchunyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension EditViewController { 12 | /** 13 | 通过下标改变当前展示的图片 14 | 15 | - parameter assIndex: 图片下标 16 | */ 17 | func changeImage(_ assIndex:Int){ 18 | 19 | index += assIndex 20 | if index < 0 { 21 | index = assets.count-1 22 | }else if index >= assets.count { 23 | index = 0 24 | } 25 | weak var weakSelf = self 26 | getImage(index) { (image) in 27 | 28 | weakSelf?.imageView.setNewImage(image) 29 | 30 | weakSelf?.imageView.frame.origin.y = screenHeight/2 - weakSelf!.imageView.frame.size.height/2 31 | } 32 | } 33 | /** 34 | 通过下标获取图片 35 | 36 | - parameter assIndex: 图片下标 37 | 38 | - returns: 返回原图 39 | */ 40 | func getImage(_ assIndex:Int,complete:@escaping ((_ image:UIImage) -> ())){ 41 | print(index) 42 | if index < 0 || index >= assets.count { 43 | return 44 | } 45 | TZImageManager().getOriginalPhoto(withAsset: assets[assIndex]) { (image, info) in 46 | complete(image!) 47 | } 48 | } 49 | /** 50 | 添加水印 51 | */ 52 | func save(){ 53 | guard let image = imageView.image else{ 54 | return 55 | } 56 | weak var weakSelf = self 57 | guard let wself = weakSelf else{ 58 | return 59 | } 60 | ZEHud.sharedInstance.view = self.view 61 | ZEHud.sharedInstance.showHud() 62 | 63 | DispatchQueue(label: "addLabel",attributes: []).async { 64 | UIGraphicsBeginImageContext(image.size)// 开始绘制 65 | image.draw(in: CGRect(origin: CGPoint.zero, size: image.size)) 66 | for label in wself.labelArr { // 添加多个水印 67 | let rect = wself.imageView.convert(label.frame, from: nil) 68 | let reScale = 1/wself.imageView.scale 69 | let labelRect = CGRect(x: (rect.origin.x)*reScale, y: (rect.origin.y*reScale), width: rect.size.width*reScale, height: rect.height*reScale) 70 | label.model.text.draw(in: labelRect, withAttributes:label.model.getAttributes(1/wself.imageView.scale)) 71 | } 72 | let imageA = UIGraphicsGetImageFromCurrentImageContext()// 获取图片 73 | UIGraphicsEndImageContext()// 结束绘制 74 | UIImageWriteToSavedPhotosAlbum(imageA!, self, nil, nil)// 保存 75 | DispatchQueue.main.async(execute: { 76 | ZEHud.sharedInstance.hideHud() 77 | ShowString.sharedManager().showStringView("保存成功") 78 | wself.assets.remove(at: wself.index) 79 | wself.changeImage(wself.index) 80 | if weakSelf!.assets.count == 0 { 81 | weakSelf?.perform(#selector(weakSelf?.nodataPop), with: nil, afterDelay: 0.3) 82 | } 83 | }) 84 | } 85 | } 86 | func nodataPop(){ 87 | ZEHud.sharedInstance.showSuccess("所有图片编辑完成") 88 | self.navigationController!.popViewController(animated: true) 89 | } 90 | func refreshUI(){ 91 | weak var weakSelf = self 92 | guard let wself = weakSelf else{ 93 | return 94 | } 95 | UIView.animate(withDuration: 0.3, animations: { 96 | wself.changeImage(0) 97 | }) 98 | for label in labelArr { 99 | label.removeFromSuperview() 100 | } 101 | labelArr = [] 102 | addWaterMark() 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/AddWaterLabel/View/EditImageView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EditImageView.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/7/17. 6 | // Copyright © 2016年 huchunyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | protocol ViewGestureRecognizer{ 11 | 12 | 13 | } 14 | extension UIView:ViewGestureRecognizer{ 15 | func addPan(){ 16 | self.isUserInteractionEnabled = true 17 | let pan = UIPanGestureRecognizer(target: self, action: #selector(pan(_:))) 18 | self.addGestureRecognizer(pan) 19 | } 20 | func pan(_ pan:UIPanGestureRecognizer){ 21 | let point = pan.translation(in: self) 22 | self.transform = self.transform.translatedBy(x: point.x, y: point.y) 23 | pan.setTranslation(.zero, in: self) 24 | } 25 | } 26 | 27 | extension EditImageView{ 28 | func addPinch(){ 29 | self.isUserInteractionEnabled = true 30 | let pinch = UIPinchGestureRecognizer(target: self, action: #selector(pinch(_:))) 31 | self.addGestureRecognizer(pinch) 32 | } 33 | func pinch(_ pinch:UIPinchGestureRecognizer){ 34 | self.transform = self.transform.scaledBy(x: pinch.scale, y: pinch.scale) 35 | print(pinch.scale) 36 | print("变换后比例:"+"\(scale)") 37 | pinch.scale = 1 38 | } 39 | } 40 | class EditImageView: UIImageView { 41 | var scale:CGFloat { 42 | get{ 43 | return frame.width / image!.size.width 44 | } 45 | } 46 | override init(frame: CGRect) { 47 | super.init(frame: frame) 48 | } 49 | func setNewImage(_ newImage:UIImage){ 50 | image = newImage 51 | self.frame.size.width = screenWidth 52 | frame = CGRect(x: 0, y: 0, width: screenWidth, height: newImage.size.height * scale) 53 | } 54 | required init?(coder aDecoder: NSCoder) { 55 | fatalError("init(coder:) has not been implemented") 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/AddWaterLabel/View/WaterMark.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WaterMark 3 | // 4 | // Created by 胡春源 on 16/7/17. 5 | // Copyright © 2016年 huchunyuan. All rights reserved. 6 | // 7 | 8 | import UIKit 9 | 10 | extension WaterMark{ 11 | func addLongPress(){ 12 | self.isUserInteractionEnabled = true 13 | let longPress = UILongPressGestureRecognizer(target: self, action: #selector(longPress(_:))) 14 | longPress.minimumPressDuration = 1 15 | longPress.allowableMovement = 100 16 | self.addGestureRecognizer(longPress) 17 | } 18 | func longPress(_ longPress:UILongPressGestureRecognizer){ 19 | if longPress.state == .began { 20 | print("长按开始") 21 | if let callBack = longPressCallBack { 22 | self.changeEidtType(true) 23 | callBack() 24 | } 25 | }else{ 26 | print("结束") 27 | } 28 | } 29 | } 30 | class WaterMark: UILabel,UITextFieldDelegate { 31 | var textField:UITextField! 32 | var longPressCallBack:(() -> Void)? = {} 33 | var model:LabelModel = LabelModel(){ 34 | willSet{ 35 | self.setlabelModel(newValue) 36 | } 37 | } 38 | override init(frame: CGRect) { 39 | super.init(frame: frame) 40 | textAlignment = .center 41 | addTextView() 42 | addLongPress() 43 | addPan() 44 | } 45 | func addTextView(){ 46 | textField = UITextField(frame:CGRect.zero) 47 | textField.borderStyle = .roundedRect 48 | textField.isHidden = true 49 | textField.delegate = self 50 | textField.addTarget(self, action: #selector(textchange), for: .editingChanged) 51 | textField.textAlignment = .center 52 | self.addSubview(textField) 53 | viewChange() 54 | } 55 | // model一改变就会调用 56 | func setlabelModel(_ labelModel:LabelModel){ 57 | let dic = labelModel.getAttributes(1) 58 | let att = NSMutableAttributedString(string: labelModel.text, attributes: dic) 59 | self.attributedText = att 60 | 61 | viewChange() 62 | } 63 | func textchange(){ 64 | fieldStatusToLabel() 65 | 66 | } 67 | // textFile一改变就会调用 68 | func fieldStatusToLabel(){ 69 | let dic = model.getAttributes(1) 70 | let att = NSAttributedString(string: self.textField.text!, attributes: dic) 71 | self.attributedText = att 72 | self.model.text = self.textField.text 73 | viewChange() 74 | } 75 | // 通过传入的bool进行label的文字变换 76 | func changeEidtType(_ type:Bool){ 77 | textField.isHidden = !type 78 | if type == true { 79 | 80 | self.textField.attributedText = self.attributedText 81 | self.textField.becomeFirstResponder() 82 | 83 | }else{ 84 | fieldStatusToLabel() 85 | textField.endEditing(true) 86 | } 87 | } 88 | 89 | // 通过label的size,调整view和textFiled的大小 90 | func viewChange(){ 91 | self.sizeToFit() 92 | let rect = CGRect(x: -10, y: -4, width: frame.size.width+20, height: frame.size.height + 8) 93 | textField.frame = rect 94 | } 95 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 96 | 97 | self.attributedText = textField.attributedText 98 | self.model.text = textField.text 99 | changeEidtType(false) 100 | 101 | return true 102 | } 103 | required init?(coder aDecoder: NSCoder) { 104 | fatalError("init(coder:) has not been implemented") 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/Capture/Controller/BeginCaptureViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BeginCaptureViewController.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/9/27. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension BeginCaptureViewController{ 12 | override func viewWillAppear(_ animated: Bool) { 13 | super.viewWillAppear(animated) 14 | if let str = CaptureModel.getUrlStr(){ 15 | let newStr = CaptureModel.getSafeUrlStr(str: str) 16 | urlField.text = newStr 17 | capture.url = URL(string:newStr) 18 | let navi = UINavigationController(rootViewController: capture) 19 | self.present(navi, animated: true) { 20 | CaptureModel.clearUD() 21 | } 22 | } 23 | } 24 | } 25 | 26 | class BeginCaptureViewController: UIViewController { 27 | @IBOutlet weak var urlField: UITextField! 28 | 29 | @IBOutlet weak var textView: UITextView! 30 | var capture = CaptureViewController() 31 | override func viewDidLoad() { 32 | super.viewDidLoad() 33 | self.navigationItem.title = "准备截图" 34 | 35 | weak var weakSelf = self 36 | LeanCloudData().getCaptureString { (str) in 37 | weakSelf?.textView.text = str 38 | } 39 | 40 | } 41 | 42 | @IBAction func jumpAction(_ sender: UIButton) { 43 | if let text = urlField.text{ 44 | let urlStr = CaptureModel.getSafeUrlStr(str: text) 45 | self.urlField.text = urlStr 46 | if let url = URL(string: urlStr){ 47 | capture.url = url 48 | let navi = UINavigationController(rootViewController: capture) 49 | self.present(navi, animated: true) { 50 | 51 | } 52 | return 53 | } 54 | } 55 | ZEHud.sharedInstance.view = self.view 56 | ZEHud.sharedInstance.showError("网址不对") 57 | } 58 | override func didReceiveMemoryWarning() { 59 | super.didReceiveMemoryWarning() 60 | // Dispose of any resources that can be recreated. 61 | } 62 | 63 | 64 | /* 65 | // MARK: - Navigation 66 | 67 | // In a storyboard-based application, you will often want to do a little preparation before navigation 68 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 69 | // Get the new view controller using segue.destinationViewController. 70 | // Pass the selected object to the new view controller. 71 | } 72 | */ 73 | 74 | } 75 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/Capture/Model/CaptureModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CaptureModel.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/9/27. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | let groupUD = UserDefaults(suiteName: "group.WaterMark") 11 | let capture_urlKey = "capture_urlKey" 12 | class CaptureModel{ 13 | static func urlStrBelongToJueJin(_ urlStr:String) -> Bool { 14 | // 判断是否为掘金的网址 15 | if urlStr.hasPrefix("http://gold.xitu.io") || urlStr.hasPrefix("https://gold.xitu.io") || urlStr.hasPrefix("http://http://gold.xitu.io") || urlStr.hasPrefix("http://https://gold.xitu.io"){ 16 | return true 17 | }else{ 18 | return false 19 | } 20 | } 21 | static func getSafeUrlStr(str:String) -> String{ 22 | if str.hasPrefix("http://") || str.hasPrefix("https://") { 23 | return str 24 | } 25 | return ("http://" + str) 26 | 27 | } 28 | static func save(_ urlStr:String?){ 29 | groupUD?.set(urlStr, forKey: capture_urlKey) 30 | groupUD?.synchronize() 31 | } 32 | static func getUrlStr() -> String? { 33 | return groupUD?.object(forKey: capture_urlKey) as? String 34 | } 35 | static func clearUD(){ 36 | groupUD?.removeObject(forKey: capture_urlKey) 37 | groupUD?.synchronize() 38 | 39 | } 40 | 41 | static func needCapture() -> Bool{ 42 | if CaptureModel.getUrlStr() != nil { 43 | return true 44 | }else{ 45 | return false 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/DemoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DemoViewController.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/7/28. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension DemoViewController{ 12 | override func viewWillAppear(_ animated: Bool) { 13 | super.viewWillAppear(animated) 14 | 15 | } 16 | override func viewDidAppear(_ animated: Bool) { 17 | super.viewDidAppear(animated) 18 | } 19 | } 20 | 21 | class DemoViewController: UIViewController { 22 | 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | 27 | 28 | let editView = EditView(frame:CGRect(x: 0, y: 64, width: view.frame.size.width, height:130)) 29 | editView.backgroundColor = UIColor.groupTableViewBackground 30 | view.addSubview(editView) 31 | let waterMark = WaterMark(frame: CGRect(x: 0, y: 0, width: 200, height: 30)) 32 | waterMark.model = LabelModel() 33 | waterMark.center = view.center 34 | 35 | waterMark.longPressCallBack = { 36 | editView.isHidden = false 37 | 38 | } 39 | editView.waterMark = waterMark 40 | view.addSubview(waterMark) 41 | // Do any additional setup after loading the view. 42 | } 43 | override func didReceiveMemoryWarning() { 44 | super.didReceiveMemoryWarning() 45 | // Dispose of any resources that can be recreated. 46 | } 47 | 48 | 49 | 50 | // MARK: - Navigation 51 | 52 | // In a storyboard-based application, you will often want to do a little preparation before navigation 53 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 54 | // Get the new view controller using segue.destinationViewController. 55 | // Pass the selected object to the new view controller. 56 | } 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/EditLabel/Controller/EditLabelViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EditLabelViewController.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/7/17. 6 | // Copyright © 2016年 huchunyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | class EditLabelViewController: UIViewController,UITextViewDelegate { 13 | var waterMark:WaterMark! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | setWaterMark() 19 | // Do any additional setup after loading the view. 20 | } 21 | func setWaterMark(){ 22 | waterMark = WaterMark(frame: CGRect(x: 0, y: 0, width: 200, height: 30)) 23 | waterMark.center = view.center 24 | weak var WeakSelf = self 25 | waterMark.longPressCallBack = { 26 | WeakSelf?.waterMark.changeEidtType(true) 27 | } 28 | view.addSubview(waterMark) 29 | } 30 | 31 | override func didReceiveMemoryWarning() { 32 | super.didReceiveMemoryWarning() 33 | // Dispose of any resources that can be recreated. 34 | } 35 | 36 | override func viewWillAppear(_ animated: Bool) { 37 | super.viewWillAppear(animated) 38 | self.navigationController?.setNavigationBarHidden(false, animated: true) 39 | } 40 | override func viewWillDisappear(_ animated: Bool) { 41 | super.viewWillDisappear(animated) 42 | 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/EditLabel/View/ColorSelectView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ColorSelectView.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/7/29. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ColorSelectView: UIView { 12 | var color:UIColor!{ 13 | willSet{ 14 | self.color = newValue 15 | self.backgroundColor = self.color 16 | if ColorFile.colorIsClear(self.color!) { 17 | label.isHidden = false 18 | }else{ 19 | label.isHidden = true 20 | } 21 | } 22 | } 23 | var label:UILabel! 24 | override init(frame: CGRect) { 25 | super.init(frame: frame) 26 | self.layer.masksToBounds = true 27 | self.layer.cornerRadius = 5 28 | self.layer.borderWidth = 1 29 | self.layer.borderColor = UIColor.groupTableViewBackground.cgColor 30 | label = UILabel(frame: bounds) 31 | var attDic = [String : AnyObject]() 32 | attDic[NSForegroundColorAttributeName] = UIColor.white 33 | attDic[NSFontAttributeName] = UIFont.systemFont(ofSize: 12) 34 | attDic[NSStrokeWidthAttributeName] = -3 as AnyObject? 35 | attDic[NSStrokeColorAttributeName] = UIColor.black 36 | let att = NSMutableAttributedString(string: "透明", attributes: attDic) 37 | label.attributedText = att 38 | label.isHidden = true 39 | self.addSubview(label) 40 | } 41 | override func touchesBegan(_ touches: Set, with event: UIEvent?) { 42 | print("colorTouch") 43 | } 44 | required init?(coder aDecoder: NSCoder) { 45 | fatalError("init(coder:) has not been implemented") 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/EditLabel/View/FontEditSubView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FontEidtButton.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/8/1. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class FontEditButton: UIButton { 12 | let selectColor = UIColor(red: 0, green: 128/255, blue: 255/255, alpha: 1) 13 | var select:Bool!{ 14 | willSet{ 15 | self.select = newValue 16 | selected(self.select) 17 | } 18 | } 19 | override init(frame: CGRect) { 20 | super.init(frame: frame) 21 | select = false 22 | selected(select) 23 | } 24 | func selected(_ bool:Bool){ 25 | var titleColor:UIColor 26 | var backgroundColor:UIColor 27 | if bool == true { 28 | titleColor = .white 29 | backgroundColor = selectColor 30 | }else{ 31 | titleColor = selectColor 32 | backgroundColor = .white 33 | } 34 | self.tintColor = titleColor 35 | self.backgroundColor = backgroundColor 36 | } 37 | required init?(coder aDecoder: NSCoder) { 38 | fatalError("init(coder:) has not been implemented") 39 | } 40 | } 41 | class FontEditLabel: UILabel{ 42 | override init(frame: CGRect) { 43 | super.init(frame: frame) 44 | font = UIFont.systemFont(ofSize: 15) 45 | textColor = .gray 46 | } 47 | required init?(coder aDecoder: NSCoder) { 48 | fatalError("init(coder:) has not been implemented") 49 | } 50 | } 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/EditLabel/View/SelectView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SelectView.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/7/29. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SelectView: IGLDropDownMenu { 12 | 13 | 14 | var customView:ColorSelectView! 15 | fileprivate var firstY:CGFloat 16 | var color:UIColor! 17 | override init(frame: CGRect) { 18 | customView = ColorSelectView(frame: frame) 19 | firstY = frame.origin.y+frame.size.height 20 | super.init(menuButtonCustomView: customView) 21 | var dropItemArr:[IGLDropDownItem] = [] 22 | for dic in titleColorArr { 23 | let view = ColorSelectView(frame: frame) 24 | view.color = ColorFile.dicToColor(dic.values.first!) 25 | let dropItem = IGLDropDownItem(customView: view) 26 | dropItemArr.append(dropItem!) 27 | } 28 | self.dropDownItems = dropItemArr 29 | self.frame = frame 30 | type = .normal 31 | gutterY = 1 32 | self.reloadView() 33 | } 34 | override func touchesBegan(_ touches: Set, with event: UIEvent?) { 35 | let point = touches.first?.location(in: self) 36 | print(touches.first?.location(in: self)) 37 | for subview in self.subviews { 38 | let p = subview.convert(point!, from: self) 39 | if subview.bounds.contains(p) { 40 | let view = subview as! IGLDropDownItem 41 | view.sendActions(for: .touchUpInside) 42 | } 43 | } 44 | super.touchesBegan(touches, with: event) 45 | } 46 | 47 | required init?(coder aDecoder: NSCoder) { 48 | fatalError("init(coder:) has not been implemented") 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/Home/Controller/HomeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // WaterMark 4 | // 5 | // Created by huchunyuan on 16/1/4. 6 | // Copyright © 2016年 huchunyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | extension HomeViewController{ 11 | override func viewWillAppear(_ animated: Bool) { 12 | super.viewWillAppear(animated) 13 | 14 | self.navigationController?.setNavigationBarHidden(true, animated: true) 15 | hiddenBarAnimate = true 16 | 17 | if CaptureModel.needCapture() { 18 | showCapture() 19 | } 20 | 21 | 22 | } 23 | override func viewWillDisappear(_ animated: Bool) { 24 | super.viewWillDisappear(animated) 25 | if hiddenBarAnimate == true { 26 | self.navigationController?.setNavigationBarHidden(false, animated: true) 27 | } 28 | } 29 | override func viewDidDisappear(_ animated: Bool) { 30 | super.viewDidDisappear(animated) 31 | self.navigationController?.setNavigationBarHidden(false,animated:false) 32 | } 33 | } 34 | class HomeViewController: UIViewController { 35 | @IBOutlet weak var addButton: UIButton! 36 | @IBOutlet weak var contactButton: UIButton! 37 | @IBOutlet weak var noticeLabel: UILabel! 38 | @IBOutlet weak var webCaptureButton: UIButton! 39 | 40 | var hiddenBarAnimate:Bool = true 41 | 42 | override func viewDidLoad() { 43 | super.viewDidLoad() 44 | webCaptureButton.whiteBorder() 45 | addButton.whiteBorder() 46 | contactButton.whiteBorder() 47 | 48 | } 49 | func showCapture(){ 50 | self.performSegue(withIdentifier: captureSegueId, sender: nil) 51 | } 52 | 53 | // 修改状态栏颜色 54 | override var preferredStatusBarStyle : UIStatusBarStyle { 55 | // 设置状态栏颜色为白色 56 | return UIStatusBarStyle.lightContent 57 | } 58 | @IBAction func webCaptureAction(_ sender: UIButton) { 59 | showCapture() 60 | } 61 | // 添加水印 62 | @IBAction func addWaterAction(_ sender: UIButton) { 63 | hiddenBarAnimate = false // modal出来不显示navigation 64 | weak var weakSelf = self 65 | let imagePickerVC = TZImagePickerController(maxImagesCount: 50, delegate: nil) 66 | imagePickerVC?.isSelectOriginalPhoto = true 67 | imagePickerVC?.allowTakePicture = true 68 | imagePickerVC?.sortAscendingByModificationDate = true 69 | imagePickerVC?.didFinishPickingPhotosHandle = { 70 | photos,assets,isSelectOriginalPhoto in 71 | weakSelf?.performSegue(withIdentifier: editVCSeugeId, sender: assets) 72 | } 73 | 74 | self.navigationController?.present(imagePickerVC!, animated: true, completion: nil) 75 | } 76 | 77 | // 默认水印 78 | @IBAction func defaultAction(_ sender: UIButton) { 79 | self.performSegue(withIdentifier: editLabelVCId, sender: nil) 80 | } 81 | // 联系我们 82 | @IBAction func contactAction(_ sender: UIButton) { 83 | let vc = ZEFeedBackContoller() 84 | vc.app_root_id = app_root_id 85 | vc.app_root_key = app_root_key 86 | self.show(vc, sender: nil) 87 | } 88 | 89 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 90 | hiddenBarAnimate = true // modal出来不显示navigation 91 | if segue.identifier == editVCSeugeId { 92 | let vc = segue.destination as! EditViewController 93 | vc.assets = sender as! [AnyObject] 94 | } 95 | } 96 | override func didReceiveMemoryWarning() { 97 | super.didReceiveMemoryWarning() 98 | // Dispose of any resources that can be recreated. 99 | } 100 | 101 | 102 | } 103 | 104 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/Home/Controller/XYHomeVC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XYHomeVC.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/10/3. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class XYHomeVC: UIViewController,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout { 12 | var collectionView:UICollectionView! 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | setUI() 16 | LeanCloudData().getBanner { (banners) in 17 | print(banners) 18 | } 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | override func didReceiveMemoryWarning() { 23 | super.didReceiveMemoryWarning() 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | func numberOfSections(in collectionView: UICollectionView) -> Int { 28 | return 1 29 | } 30 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 31 | return 3 32 | } 33 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 34 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: XYHomeCellId, for: indexPath) as! XYHomeCell 35 | return cell 36 | } 37 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 38 | 39 | } 40 | func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { 41 | let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: XYHomeHeaderViewId, for: indexPath) 42 | return header 43 | } 44 | //MARK: UICollectionViewDelegateFlowLayout 45 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { 46 | return CGSize(width: XYHomeCellWidth, height: XYHomeCellHeith) 47 | } 48 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { 49 | return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) 50 | } 51 | // 上下间距 52 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { 53 | return 0 54 | } 55 | // 左右间距 56 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { 57 | return 0 58 | } 59 | 60 | 61 | 62 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { 63 | return CGSize(width: screenWidth, height: 150) 64 | } 65 | 66 | 67 | /* 68 | // MARK: - Navigation 69 | 70 | // In a storyboard-based application, you will often want to do a little preparation before navigation 71 | override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 72 | // Get the new view controller using segue.destinationViewController. 73 | // Pass the selected object to the new view controller. 74 | } 75 | */ 76 | 77 | } 78 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/Home/View/XYHomeCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XYHomeCell.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/10/3. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class XYHomeCell: UICollectionViewCell { 12 | override init(frame: CGRect) { 13 | super.init(frame: frame) 14 | backgroundColor = .blue 15 | } 16 | 17 | required init?(coder aDecoder: NSCoder) { 18 | fatalError("init(coder:) has not been implemented") 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/Home/View/XYHomePageHeader.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XTHomePageHeader.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/10/3. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class XYHomePageHeader: UICollectionReusableView { 12 | var viewpager:SDCycleScrollView! 13 | override init(frame: CGRect) { 14 | super.init(frame: frame) 15 | self.backgroundColor = .red 16 | viewpager = SDCycleScrollView(frame: bounds, delegate: nil, placeholderImage: UIImage(named: "bannerPlaceHolder")) 17 | viewpager.autoScrollTimeInterval = 4 18 | 19 | self.addSubview(viewpager) 20 | 21 | } 22 | 23 | 24 | required init?(coder aDecoder: NSCoder) { 25 | fatalError("init(coder:) has not been implemented") 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/Home/View/XYHomeViewExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XTHomeViewExtension.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/10/3. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | let XYHomeCellId = "XYHomeCell" 11 | let XYHomeHeaderViewId = "XYHomePageHeader" 12 | let XYHomeCellWidth:CGFloat = screenWidth/2 13 | let XYHomeCellHeith:CGFloat = screenWidth/2 14 | 15 | extension XYHomeVC{ 16 | func setUI(){ 17 | let layout = UICollectionViewFlowLayout() 18 | layout.scrollDirection = .vertical 19 | collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: screenWidth, height: screenHeight), collectionViewLayout: layout) 20 | collectionView.register(XYHomeCell.self, forCellWithReuseIdentifier: XYHomeCellId) 21 | collectionView.register(XYHomePageHeader.self, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: XYHomeHeaderViewId) 22 | collectionView.delegate = self 23 | collectionView.dataSource = self 24 | view.addSubview(collectionView) 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/Home/View/ZEHomeView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZEHomeView.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/8/19. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | extension UIButton { 11 | func whiteBorder(){ 12 | self.layer.masksToBounds = true 13 | self.layer.cornerRadius = 2 14 | self.layer.borderColor = UIColor.white.cgColor 15 | self.layer.borderWidth = 1 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/ZEVC/FeedBack/Controller/ZEFeedBackContoller.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FeedBackContoller.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/8/18. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | 13 | 14 | extension ZEFeedBackContoller{ 15 | override func viewWillAppear(_ animated: Bool) { 16 | super.viewWillAppear(animated) 17 | AVOSCloud.setApplicationId(app_feedback_id, clientKey: app_feedback_key) 18 | 19 | } 20 | 21 | override func viewWillDisappear(_ animated: Bool) { 22 | super.viewWillDisappear(animated) 23 | guard let appRid = app_root_id,let appRKey = app_root_key else{ 24 | return 25 | } 26 | AVOSCloud.setApplicationId(appRid, clientKey: appRKey) 27 | } 28 | 29 | override func viewDidAppear(_ animated: Bool) { 30 | super.viewDidAppear(animated) 31 | titleField.becomeFirstResponder() 32 | } 33 | } 34 | 35 | class ZEFeedBackContoller: UIViewController,UITextFieldDelegate,UIScrollViewDelegate { 36 | var titleField:ZETextField! 37 | var descriptionTextView:ZETextView! 38 | var app_root_id:String? 39 | var app_root_key:String? 40 | 41 | override func viewDidLoad() { 42 | super.viewDidLoad() 43 | setUI() 44 | // Do any additional setup after loading the view. 45 | } 46 | func rightItemAction(){ 47 | sendFeedBack() 48 | } 49 | override func didReceiveMemoryWarning() { 50 | super.didReceiveMemoryWarning() 51 | // Dispose of any resources that can be recreated. 52 | } 53 | func textFieldShouldReturn(_ textField: UITextField) -> Bool { 54 | descriptionTextView.becomeFirstResponder() 55 | return true 56 | } 57 | func scrollViewDidScroll(_ scrollView: UIScrollView) { 58 | self.view.endEditing(true) 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/ZEVC/FeedBack/Model/ZEFeedBackModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZEFeedBackModel.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/8/18. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | let className_feedBack = "FeedBack" 12 | let model_contact = "contact" 13 | let model_description = "description" 14 | let model_appName = "appName" 15 | let feedBack_appName = "WaterMark" 16 | 17 | extension ZEFeedBackContoller { 18 | func sendFeedBack(){ 19 | let feedBack = AVObject(className: className_feedBack) 20 | 21 | feedBack?.setObject(titleField.text, forKey:model_contact ) 22 | feedBack?.setObject(descriptionTextView.text, forKey:model_description) 23 | feedBack?.setObject(feedBack_appName, forKey: model_appName) 24 | ZEHud.sharedInstance.showHud() 25 | weak var weakSelf = self 26 | feedBack?.saveInBackground { (success, error) in 27 | ZEHud.sharedInstance.hideHud() 28 | ZEHud.sharedInstance.showSuccess("信息已发送") 29 | weakSelf?.dismiss(animated: true, completion: nil) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/ZEVC/FeedBack/View/ZEFeedBackSubViewClass.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZEFeedBackSubViewClass.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/8/18. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | let fontSize:CGFloat = 16 12 | 13 | class ZELabel:UILabel{ 14 | override init(frame: CGRect) { 15 | super.init(frame: frame) 16 | self.font = UIFont.systemFont(ofSize: 16) 17 | self.textColor = UIColor.gray 18 | } 19 | 20 | required init?(coder aDecoder: NSCoder) { 21 | fatalError("init(coder:) has not been implemented") 22 | } 23 | } 24 | 25 | class ZETextField: UITextField { 26 | var textStatusChange:((_ haveText:Bool)->())? 27 | 28 | var canShare:Bool = false 29 | override init(frame: CGRect) { 30 | super.init(frame: frame) 31 | self.borderStyle = .roundedRect 32 | self.backgroundColor = UIColor.white 33 | self.font = UIFont.systemFont(ofSize: fontSize) 34 | self.addTarget(self, action: #selector(textChange), for: .editingChanged) 35 | } 36 | func textChange(){ 37 | if self.text == "" { 38 | canShare = false 39 | }else{ 40 | canShare = true 41 | } 42 | textStatusChange?(canShare) 43 | } 44 | required init?(coder aDecoder: NSCoder) { 45 | fatalError("init(coder:) has not been implemented") 46 | } 47 | } 48 | 49 | class ZETextView: UITextView { 50 | var placeHolderLabel:UILabel! 51 | var textStatusChange:((_ haveText:Bool)->())? 52 | var canShare = false 53 | var placeHolder:String!{ 54 | willSet{ 55 | self.placeHolder = newValue 56 | placeHolderLabel.text = self.placeHolder 57 | placeHolderLabel.sizeToFit() 58 | } 59 | } 60 | let defultPlaceColor = UIColor(red: 199/255.0, green: 199/255.0, blue: 205/255.0, alpha: 1) 61 | override init(frame: CGRect, textContainer: NSTextContainer?) { 62 | super.init(frame: frame, textContainer: textContainer) 63 | font = UIFont.systemFont(ofSize: fontSize) 64 | contentInset = UIEdgeInsets(top: -5, left:0, bottom: 0, right: 0) 65 | setLabel() 66 | NotificationCenter.default.addObserver(self, selector: #selector(textChanged(_:)), name: NSNotification.Name.UITextViewTextDidChange, object: nil) 67 | } 68 | func textChanged(_ noti:Notification){ 69 | if self.text == "\n" { 70 | self.text = "" 71 | } 72 | if self.text == "" { 73 | self.placeHolderLabel.alpha = 1 74 | canShare = false 75 | textStatusChange?(false) 76 | }else{ 77 | self.placeHolderLabel.alpha = 0 78 | canShare = true 79 | textStatusChange?(true) 80 | } 81 | } 82 | func setLabel(){ 83 | placeHolderLabel = UILabel(frame: CGRect(x: 5, y: 8, width: bounds.width, height: 0)) 84 | placeHolderLabel.lineBreakMode = .byWordWrapping 85 | placeHolderLabel.numberOfLines = 0 86 | placeHolderLabel.font = self.font 87 | placeHolderLabel.backgroundColor = .clear 88 | placeHolderLabel.textColor = defultPlaceColor; 89 | 90 | self.addSubview(placeHolderLabel) 91 | self.sendSubview(toBack: placeHolderLabel) 92 | } 93 | required init?(coder aDecoder: NSCoder) { 94 | fatalError("init(coder:) has not been implemented") 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/ZEVC/RegistLogin/Controller/ZELoginViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZELoginViewController.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/8/23. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ZELoginViewController: UIViewController { 12 | // let disposeBag = DisposeBag() 13 | 14 | var userNameF:ZETextField! 15 | var passWordF:ZETextField! 16 | var loginButton:UIButton! 17 | var registButton:UIButton! 18 | var fogetButton:UIButton! 19 | var wechatButton:UIButton! 20 | var weiboButton:UIButton! 21 | var qqButton:UIButton! 22 | override func viewDidLoad() { 23 | super.viewDidLoad() 24 | setUI() 25 | viewLogic() 26 | } 27 | func viewLogic(){ 28 | // // 用户名 29 | // userNameF.rx_text.subscribeNext { (text) in 30 | // 31 | // }.addDisposableTo(disposeBag) 32 | // // 密码 33 | // passWordF.rx_text.subscribeNext { (text) in 34 | // 35 | // }.addDisposableTo(disposeBag) 36 | // // 登陆 37 | // loginButton.rx_tap.subscribeNext { 38 | // 39 | // }.addDisposableTo(disposeBag) 40 | // // 注册 41 | // registButton.rx_tap.subscribeNext { 42 | // 43 | // }.addDisposableTo(disposeBag) 44 | // // 忘记密码 45 | // fogetButton.rx_tap.subscribeNext { 46 | // 47 | // }.addDisposableTo(disposeBag) 48 | } 49 | 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/ZEVC/RegistLogin/Controller/ZERegistController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZERegistController.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/9/17. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ZERegistController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | // Do any additional setup after loading the view. 17 | } 18 | 19 | override func didReceiveMemoryWarning() { 20 | super.didReceiveMemoryWarning() 21 | // Dispose of any resources that can be recreated. 22 | } 23 | 24 | 25 | /* 26 | // MARK: - Navigation 27 | 28 | // In a storyboard-based application, you will often want to do a little preparation before navigation 29 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 30 | // Get the new view controller using segue.destinationViewController. 31 | // Pass the selected object to the new view controller. 32 | } 33 | */ 34 | 35 | } 36 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/ZEVC/RegistLogin/Model/ZELoginModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZELoginModel.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/8/23. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension ZELoginViewController { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/ZEVC/RegistLogin/View/ZELoginView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZELoginView.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/8/23. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | 13 | let loginMargin = 15 14 | extension ZELoginViewController{ 15 | 16 | func setUI(){ 17 | let logoIamgeView = UIImageView() 18 | logoIamgeView.image = UIImage(named: "logo") 19 | logoIamgeView.backgroundColor = UIColor.groupTableViewBackground 20 | logoIamgeView.layer.masksToBounds = true 21 | logoIamgeView.layer.cornerRadius = 10 22 | view.addSubview(logoIamgeView) 23 | logoIamgeView.snp.makeConstraints { (make) in 24 | make.top.equalTo(64+20) 25 | make.centerX.equalTo(view.snp.centerX) 26 | make.size.equalTo(CGSize(width: 64, height: 64)) 27 | } 28 | 29 | let ulabel = ZELabel() 30 | ulabel.text = "用户名:" 31 | ulabel.textAlignment = .right 32 | view.addSubview(ulabel) 33 | ulabel.snp.makeConstraints { (make) in 34 | make.left.equalTo(10) 35 | make.width.equalTo(60) 36 | make.top.equalTo(logoIamgeView.snp.bottom).offset(30) 37 | make.height.equalTo(30) 38 | } 39 | ulabel.sizeToFit() 40 | userNameF = ZETextField() 41 | userNameF.placeholder = "请输入用户名" 42 | view.addSubview(userNameF) 43 | userNameF.snp.makeConstraints { (make) in 44 | make.left.equalTo(ulabel.snp.right) 45 | make.top.equalTo(ulabel.snp.top) 46 | make.right.equalTo(-10) 47 | make.height.equalTo(ulabel.snp.height) 48 | } 49 | 50 | let pLabel = ZELabel() 51 | pLabel.textAlignment = .right 52 | view.addSubview(pLabel) 53 | pLabel.text = "密码:" 54 | pLabel.snp.makeConstraints { (make) in 55 | make.right.equalTo(ulabel.snp.right) 56 | make.top.equalTo(ulabel.snp.bottom).offset(10) 57 | make.height.equalTo(ulabel.snp.height) 58 | } 59 | 60 | passWordF = ZETextField() 61 | passWordF.placeholder = "请输入密码" 62 | view.addSubview(passWordF) 63 | passWordF.snp.makeConstraints { (make) in 64 | make.left.equalTo(pLabel.snp.right) 65 | make.top.equalTo(pLabel.snp.top) 66 | make.right.equalTo(userNameF.snp.right) 67 | make.height.equalTo(pLabel.snp.height) 68 | } 69 | 70 | loginButton = UIButton(type: .system) 71 | loginButton.setTitle("登陆", for: UIControlState()) 72 | loginButton.backgroundColor = ZEButtomDefultColor 73 | loginButton.setTitleColor(UIColor.white, for: UIControlState()) 74 | loginButton.layer.masksToBounds = true 75 | loginButton.layer.cornerRadius = 5 76 | view.addSubview(loginButton) 77 | loginButton.snp.makeConstraints { (make) in 78 | make.left.equalTo(ulabel.snp.left) 79 | make.right.equalTo(passWordF.snp.right) 80 | make.top.equalTo(passWordF.snp.bottom).offset(10) 81 | } 82 | 83 | 84 | fogetButton = UIButton(type: .system) 85 | fogetButton.setTitle("忘记密码", for: UIControlState()) 86 | view.addSubview(fogetButton) 87 | fogetButton.snp.makeConstraints { (make) in 88 | make.left.equalTo(loginButton.snp.left) 89 | make.top.equalTo(loginButton.snp.bottom).offset(10) 90 | } 91 | 92 | registButton = UIButton(type: .system) 93 | registButton.setTitle("注册", for: UIControlState()) 94 | view.addSubview(registButton) 95 | registButton.snp.makeConstraints { (make) in 96 | make.right.equalTo(loginButton.snp.right) 97 | make.top.equalTo(fogetButton.snp.top) 98 | } 99 | 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Scenes/ZEVC/ZEHead.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZEHead.swift 3 | // WaterMark 4 | // 5 | // Created by 胡春源 on 16/8/23. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | 10 | let viewMargin:CGFloat = 15 -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/StroyBoard/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/IGLDropDownMenu/IGLDropDownItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // IGLDropDownItem.h 3 | // IGLDropDownMenuDemo 4 | // 5 | // Created by Galvin Li on 8/30/14. 6 | // Copyright (c) 2014 Galvin Li. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface IGLDropDownItem : UIControl 12 | 13 | @property (nonatomic, assign) NSInteger index; 14 | @property (nonatomic, strong) id object; 15 | 16 | @property (nonatomic, strong, readonly) UIView *customView; 17 | 18 | @property (nonatomic, strong) UIImage *iconImage; 19 | @property (nonatomic, strong, readonly) UILabel *textLabel; 20 | @property (nonatomic, copy) NSString *text; 21 | @property (nonatomic, assign) BOOL showBackgroundShadow; 22 | @property (nonatomic, strong) UIColor *backgroundColor; 23 | @property (nonatomic, assign) CGFloat paddingLeft; 24 | 25 | - (instancetype)initWithCustomView:(UIView*)customView; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/IGLDropDownMenu/IGLDropDownMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // IGLDropDownMenu.h 3 | // IGLDropDownMenuDemo 4 | // 5 | // Created by Galvin Li on 8/30/14. 6 | // Copyright (c) 2014 Galvin Li. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "IGLDropDownItem.h" 11 | @class IGLDropDownMenu; 12 | 13 | typedef NS_ENUM(NSUInteger, IGLDropDownMenuRotate) { 14 | IGLDropDownMenuRotateNone, 15 | IGLDropDownMenuRotateLeft, 16 | IGLDropDownMenuRotateRight, 17 | IGLDropDownMenuRotateRandom 18 | }; 19 | 20 | typedef NS_ENUM(NSUInteger, IGLDropDownMenuType) { 21 | IGLDropDownMenuTypeNormal, 22 | IGLDropDownMenuTypeStack, 23 | IGLDropDownMenuTypeSlidingInBoth, 24 | IGLDropDownMenuTypeSlidingInFromLeft, 25 | IGLDropDownMenuTypeSlidingInFromRight, 26 | IGLDropDownMenuTypeFlipVertical, 27 | IGLDropDownMenuTypeFlipFromLeft, 28 | IGLDropDownMenuTypeFlipFromRight 29 | }; 30 | 31 | typedef NS_ENUM(NSUInteger, IGLDropDownMenuDirection) { 32 | IGLDropDownMenuDirectionDown, 33 | IGLDropDownMenuDirectionUp, 34 | }; 35 | 36 | @protocol IGLDropDownMenuDelegate 37 | 38 | @optional 39 | - (void)dropDownMenu:(IGLDropDownMenu*)dropDownMenu selectedItemAtIndex:(NSInteger)index; 40 | - (void)dropDownMenu:(IGLDropDownMenu *)dropDownMenu expandingChanged:(BOOL)isExpending; 41 | 42 | @end 43 | 44 | @interface IGLDropDownMenu : UIControl 45 | 46 | @property (nonatomic, strong) IGLDropDownItem *menuButton; 47 | @property (nonatomic, copy) NSString* menuText; 48 | @property (nonatomic, strong) id object; 49 | @property (nonatomic, strong) UIImage *menuIconImage; 50 | @property (nonatomic, copy) NSArray* dropDownItems; 51 | @property (nonatomic, assign) CGSize itemSize; 52 | @property (nonatomic, assign, readonly) NSInteger selectedIndex; 53 | 54 | @property (nonatomic, assign) CGFloat paddingLeft; 55 | 56 | @property (nonatomic, assign) CGFloat animationDuration; 57 | @property (nonatomic, assign) UIViewAnimationOptions animationOption; 58 | @property (nonatomic, assign) CGFloat itemAnimationDelay; 59 | @property (nonatomic, assign) IGLDropDownMenuRotate rotate; 60 | @property (nonatomic, assign) IGLDropDownMenuType type; 61 | @property (nonatomic, assign) IGLDropDownMenuDirection direction; 62 | @property (nonatomic, assign) CGFloat slidingInOffset; 63 | @property (nonatomic, assign) CGFloat gutterY; 64 | @property (nonatomic, assign) CGFloat alphaOnFold; 65 | @property (nonatomic, assign, getter = isMenuButtonStatic) BOOL menuButtonStatic; 66 | @property (nonatomic, assign, getter = isExpanding) BOOL expanding; 67 | @property (nonatomic, assign, getter = shouldFlipWhenToggleView) BOOL flipWhenToggleView; 68 | @property (nonatomic, assign, getter = shouldUseSpringAnimation) BOOL useSpringAnimation; 69 | 70 | @property (nonatomic, assign) id delegate; 71 | 72 | - (instancetype)initWithMenuButtonCustomView:(UIView*)customView; 73 | 74 | - (void)reloadView; 75 | - (void)resetParams; 76 | - (void)selectItemAtIndex:(NSUInteger)index; 77 | - (void)addSelectedItemChangeBlock:(void (^)(NSInteger selectedIndex))block; 78 | - (void)toggleView; 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/NJKWebViewProgress/NJKWebViewProgress.h: -------------------------------------------------------------------------------- 1 | // 2 | // NJKWebViewProgress.h 3 | // 4 | // Created by Satoshi Aasano on 4/20/13. 5 | // Copyright (c) 2013 Satoshi Asano. All rights reserved. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | #undef njk_weak 12 | #if __has_feature(objc_arc_weak) 13 | #define njk_weak weak 14 | #else 15 | #define njk_weak unsafe_unretained 16 | #endif 17 | 18 | extern const float NJKInitialProgressValue; 19 | extern const float NJKInteractiveProgressValue; 20 | extern const float NJKFinalProgressValue; 21 | 22 | typedef void (^NJKWebViewProgressBlock)(float progress); 23 | @protocol NJKWebViewProgressDelegate; 24 | @interface NJKWebViewProgress : NSObject 25 | @property (nonatomic, njk_weak) idprogressDelegate; 26 | @property (nonatomic, njk_weak) idwebViewProxyDelegate; 27 | @property (nonatomic, copy) NJKWebViewProgressBlock progressBlock; 28 | @property (nonatomic, readonly) float progress; // 0.0..1.0 29 | 30 | - (void)reset; 31 | @end 32 | 33 | @protocol NJKWebViewProgressDelegate 34 | - (void)webViewProgress:(NJKWebViewProgress *)webViewProgress updateProgress:(float)progress; 35 | @end 36 | 37 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/NJKWebViewProgress/NJKWebViewProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // NJKWebViewProgressView.h 3 | // iOS 7 Style WebView Progress Bar 4 | // 5 | // Created by Satoshi Aasano on 11/16/13. 6 | // Copyright (c) 2013 Satoshi Asano. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NJKWebViewProgressView : UIView 12 | @property (nonatomic) float progress; 13 | 14 | @property (nonatomic) UIView *progressBarView; 15 | @property (nonatomic) NSTimeInterval barAnimationDuration; // default 0.1 16 | @property (nonatomic) NSTimeInterval fadeAnimationDuration; // default 0.27 17 | @property (nonatomic) NSTimeInterval fadeOutDelay; // default 0.1 18 | 19 | - (void)setProgress:(float)progress animated:(BOOL)animated; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/NJKWebViewProgress/NJKWebViewProgressView.m: -------------------------------------------------------------------------------- 1 | // 2 | // NJKWebViewProgressView.m 3 | // 4 | // Created by Satoshi Aasanoon 11/16/13. 5 | // Copyright (c) 2013 Satoshi Asano. All rights reserved. 6 | // 7 | 8 | #import "NJKWebViewProgressView.h" 9 | 10 | @implementation NJKWebViewProgressView 11 | 12 | - (id)initWithFrame:(CGRect)frame 13 | { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | [self configureViews]; 17 | } 18 | return self; 19 | } 20 | 21 | - (void)awakeFromNib 22 | { 23 | [super awakeFromNib]; 24 | [self configureViews]; 25 | } 26 | 27 | -(void)configureViews 28 | { 29 | self.userInteractionEnabled = NO; 30 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth; 31 | _progressBarView = [[UIView alloc] initWithFrame:self.bounds]; 32 | _progressBarView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; 33 | UIColor *tintColor = [UIColor colorWithRed:22.f / 255.f green:126.f / 255.f blue:251.f / 255.f alpha:1.0]; // iOS7 Safari bar color 34 | 35 | _progressBarView.backgroundColor = tintColor; 36 | [self addSubview:_progressBarView]; 37 | 38 | _barAnimationDuration = 0.27f; 39 | _fadeAnimationDuration = 0.27f; 40 | _fadeOutDelay = 0.1f; 41 | } 42 | 43 | -(void)setProgress:(float)progress 44 | { 45 | [self setProgress:progress animated:NO]; 46 | } 47 | 48 | - (void)setProgress:(float)progress animated:(BOOL)animated 49 | { 50 | BOOL isGrowing = progress > 0.0; 51 | [UIView animateWithDuration:(isGrowing && animated) ? _barAnimationDuration : 0.0 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 52 | CGRect frame = _progressBarView.frame; 53 | frame.size.width = progress * self.bounds.size.width; 54 | _progressBarView.frame = frame; 55 | } completion:nil]; 56 | 57 | if (progress >= 1.0) { 58 | [UIView animateWithDuration:animated ? _fadeAnimationDuration : 0.0 delay:_fadeOutDelay options:UIViewAnimationOptionCurveEaseInOut animations:^{ 59 | _progressBarView.alpha = 0.0; 60 | } completion:^(BOOL completed){ 61 | CGRect frame = _progressBarView.frame; 62 | frame.size.width = 0; 63 | _progressBarView.frame = frame; 64 | }]; 65 | } 66 | else { 67 | [UIView animateWithDuration:animated ? _fadeAnimationDuration : 0.0 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 68 | _progressBarView.alpha = 1.0; 69 | } completion:nil]; 70 | } 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/OffscreenRendering/UIImage+RoundedCorner.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+RoundedCorner.h 3 | // SelectTags 4 | // 5 | // Created by jm on 16/2/22. 6 | // Copyright © 2016年 Jim. All rights reserved. 7 | // 8 | //生成带圆角的图片 9 | 10 | #import 11 | 12 | struct JMRadius { 13 | CGFloat topLeftRadius; 14 | CGFloat topRightRadius; 15 | CGFloat bottomLeftRadius; 16 | CGFloat bottomRightRadius; 17 | }; 18 | typedef struct JMRadius JMRadius; 19 | 20 | static inline JMRadius JMRadiusMake(CGFloat topLeftRadius, CGFloat topRightRadius, CGFloat bottomLeftRadius, CGFloat bottomRightRadius) { 21 | JMRadius radius; 22 | radius.topLeftRadius = topLeftRadius; 23 | radius.topRightRadius = topRightRadius; 24 | radius.bottomLeftRadius = bottomLeftRadius; 25 | radius.bottomRightRadius = bottomRightRadius; 26 | return radius; 27 | } 28 | 29 | @interface UIImage (RoundedCorner) 30 | 31 | - (UIImage *)jm_imageWithRoundedCornersAndSize:(CGSize)sizeToFit andCornerRadius:(CGFloat)radius; 32 | 33 | - (UIImage *)jm_imageWithRoundedCornersAndSize:(CGSize)sizeToFit andCornerRadius:(CGFloat)radius withContentMode:(UIViewContentMode)contentMode; 34 | 35 | + (UIImage *)jm_imageWithRoundedCornersAndSize:(CGSize)sizeToFit CornerRadius:(CGFloat)radius borderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth; 36 | 37 | + (UIImage *)jm_imageWithRoundedCornersAndSize:(CGSize)sizeToFit andCornerRadius:(CGFloat)radius andColor:(UIColor *)color; 38 | 39 | + (UIImage *)jm_imageWithRoundedCornersAndSize:(CGSize)sizeToFit CornerRadius:(CGFloat)radius borderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth backgroundColor:(UIColor *)backgroundColor backgroundImage:(UIImage *)backgroundImage withContentMode:(UIViewContentMode)contentMode; 40 | 41 | + (UIImage *)jm_imageWithRoundedCornersAndSize:(CGSize)sizeToFit JMRadius:(JMRadius)radius borderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth backgroundColor:(UIColor *)backgroundColor backgroundImage:(UIImage *)backgroundImage withContentMode:(UIViewContentMode)contentMode; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/OffscreenRendering/UIView+RoundedCorner.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+RoundedCorner.h 3 | // UIImageRoundedCornerDemo 4 | // 5 | // Created by jm on 16/2/25. 6 | // Copyright © 2016年 Jim. All rights reserved. 7 | // 8 | //使用这个类就可以了 9 | 10 | #import 11 | #import "UIImage+RoundedCorner.h" 12 | 13 | @interface UIView (RoundedCorner) 14 | 15 | /**给view设置一个圆角边框*/ 16 | - (void)jm_setCornerRadius:(CGFloat)radius withBorderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth; 17 | 18 | /**给view设置一个圆角边框,四个圆角弧度可以不同*/ 19 | - (void)jm_setJMRadius:(JMRadius)radius withBorderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth; 20 | 21 | 22 | /**给view设置一个圆角背景颜色*/ 23 | - (void)jm_setCornerRadius:(CGFloat)radius withBackgroundColor:(UIColor *)backgroundColor; 24 | 25 | /**给view设置一个圆角背景颜色,四个圆角弧度可以不同*/ 26 | - (void)jm_setJMRadius:(JMRadius)radius withBackgroundColor:(UIColor *)backgroundColor; 27 | 28 | 29 | /**给view设置一个圆角背景图*/ 30 | - (void)jm_setCornerRadius:(CGFloat)radius withImage:(UIImage *)image; 31 | 32 | ///**给view设置一个圆角背景图,四个圆角弧度可以不同*/ 33 | - (void)jm_setJMRadius:(JMRadius)radius withImage:(UIImage *)image; 34 | 35 | 36 | /**给view设置一个contentMode模式的圆角背景图*/ 37 | - (void)jm_setCornerRadius:(CGFloat)radius withImage:(UIImage *)image contentMode:(UIViewContentMode)contentMode; 38 | 39 | ///**给view设置一个contentMode模式的圆角背景图,四个圆角弧度可以不同*/ 40 | - (void)jm_setJMRadius:(JMRadius)radius withImage:(UIImage *)image contentMode:(UIViewContentMode)contentMode; 41 | 42 | 43 | /**设置所有属性配置出一个圆角背景图*/ 44 | - (void)jm_setCornerRadius:(CGFloat)radius withBorderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth backgroundColor:(UIColor *)backgroundColor backgroundImage:(UIImage *)backgroundImage contentMode:(UIViewContentMode)contentMode; 45 | 46 | /**设置所有属性配置出一个圆角背景图,四个圆角弧度可以不同*/ 47 | - (void)jm_setJMRadius:(JMRadius)radius withBorderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth backgroundColor:(UIColor *)backgroundColor backgroundImage:(UIImage *)backgroundImage contentMode:(UIViewContentMode)contentMode; 48 | 49 | /**设置所有属性配置出一个圆角背景图,并多传递了一个size参数,如果JMRoundedCorner没有拿到view的size,可以调用这个方法*/ 50 | - (void)jm_setJMRadius:(JMRadius)radius withBorderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth backgroundColor:(UIColor *)backgroundColor backgroundImage:(UIImage *)backgroundImage contentMode:(UIViewContentMode)contentMode size:(CGSize)size; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/PublicProtocol/GestureRecognizerProtocl.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GestureRecognizerProtocl.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/7/26. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | 13 | protocol ViewPan { 14 | 15 | } 16 | extension ViewPan where Self:UIView{ 17 | 18 | } 19 | protocol ViewLongPress { 20 | var longPressCallBack:(() -> Void)?{get set} 21 | } 22 | extension ViewLongPress where Self:UIView{ 23 | 24 | func addLongPress(){ 25 | self.isUserInteractionEnabled = true 26 | let longPress = UILongPressGestureRecognizer(target: self, action:Selector(("longPress:"))) 27 | longPress.minimumPressDuration = 1 28 | longPress.allowableMovement = 100 29 | self.addGestureRecognizer(longPress) 30 | } 31 | 32 | func longPress(_ longPress:UILongPressGestureRecognizer){ 33 | if longPress.state == .began { 34 | print("长按开始") 35 | 36 | if let callBack = longPressCallBack { 37 | callBack() 38 | } 39 | }else{ 40 | print("结束") 41 | } 42 | } 43 | } 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/PageControl/TAAbstractDotView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAAbstractDotView.h 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface TAAbstractDotView : UIView 13 | 14 | 15 | /** 16 | * A method call let view know which state appearance it should take. Active meaning it's current page. Inactive not the current page. 17 | * 18 | * @param active BOOL to tell if view is active or not 19 | */ 20 | - (void)changeActivityState:(BOOL)active; 21 | 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/PageControl/TAAbstractDotView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TAAbstractDotView.m 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TAAbstractDotView.h" 10 | 11 | 12 | @implementation TAAbstractDotView 13 | 14 | 15 | - (id)init 16 | { 17 | @throw [NSException exceptionWithName:NSInternalInconsistencyException 18 | reason:[NSString stringWithFormat:@"You must override %@ in %@", NSStringFromSelector(_cmd), self.class] 19 | userInfo:nil]; 20 | } 21 | 22 | 23 | - (void)changeActivityState:(BOOL)active 24 | { 25 | @throw [NSException exceptionWithName:NSInternalInconsistencyException 26 | reason:[NSString stringWithFormat:@"You must override %@ in %@", NSStringFromSelector(_cmd), self.class] 27 | userInfo:nil]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/PageControl/TAAnimatedDotView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAAnimatedDotView.h 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TAAbstractDotView.h" 10 | 11 | @interface TAAnimatedDotView : TAAbstractDotView 12 | 13 | @property (nonatomic, strong) UIColor *dotColor; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/PageControl/TAAnimatedDotView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TAAnimatedDotView.m 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TAAnimatedDotView.h" 10 | 11 | static CGFloat const kAnimateDuration = 1; 12 | 13 | @implementation TAAnimatedDotView 14 | 15 | - (instancetype)init 16 | { 17 | self = [super init]; 18 | if (self) { 19 | [self initialization]; 20 | } 21 | 22 | return self; 23 | } 24 | 25 | 26 | - (id)initWithFrame:(CGRect)frame 27 | { 28 | self = [super initWithFrame:frame]; 29 | if (self) { 30 | [self initialization]; 31 | } 32 | return self; 33 | } 34 | 35 | 36 | - (id)initWithCoder:(NSCoder *)aDecoder 37 | { 38 | self = [super initWithCoder:aDecoder]; 39 | if (self) { 40 | [self initialization]; 41 | } 42 | 43 | return self; 44 | } 45 | 46 | - (void)setDotColor:(UIColor *)dotColor 47 | { 48 | _dotColor = dotColor; 49 | self.layer.borderColor = dotColor.CGColor; 50 | } 51 | 52 | - (void)initialization 53 | { 54 | _dotColor = [UIColor whiteColor]; 55 | self.backgroundColor = [UIColor clearColor]; 56 | self.layer.cornerRadius = CGRectGetWidth(self.frame) / 2; 57 | self.layer.borderColor = [UIColor whiteColor].CGColor; 58 | self.layer.borderWidth = 2; 59 | } 60 | 61 | 62 | - (void)changeActivityState:(BOOL)active 63 | { 64 | if (active) { 65 | [self animateToActiveState]; 66 | } else { 67 | [self animateToDeactiveState]; 68 | } 69 | } 70 | 71 | 72 | - (void)animateToActiveState 73 | { 74 | [UIView animateWithDuration:kAnimateDuration delay:0 usingSpringWithDamping:.5 initialSpringVelocity:-20 options:UIViewAnimationOptionCurveLinear animations:^{ 75 | self.backgroundColor = _dotColor; 76 | self.transform = CGAffineTransformMakeScale(1.4, 1.4); 77 | } completion:nil]; 78 | } 79 | 80 | - (void)animateToDeactiveState 81 | { 82 | [UIView animateWithDuration:kAnimateDuration delay:0 usingSpringWithDamping:.5 initialSpringVelocity:0 options:UIViewAnimationOptionCurveLinear animations:^{ 83 | self.backgroundColor = [UIColor clearColor]; 84 | self.transform = CGAffineTransformIdentity; 85 | } completion:nil]; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/PageControl/TADotView.h: -------------------------------------------------------------------------------- 1 | // 2 | // TADotView.h 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TAAbstractDotView.h" 10 | 11 | @interface TADotView : TAAbstractDotView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/PageControl/TADotView.m: -------------------------------------------------------------------------------- 1 | // 2 | // TADotView.m 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-22. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import "TADotView.h" 10 | 11 | @implementation TADotView 12 | 13 | 14 | - (instancetype)init 15 | { 16 | self = [super init]; 17 | if (self) { 18 | [self initialization]; 19 | } 20 | 21 | return self; 22 | } 23 | 24 | 25 | - (id)initWithFrame:(CGRect)frame 26 | { 27 | self = [super initWithFrame:frame]; 28 | if (self) { 29 | [self initialization]; 30 | } 31 | return self; 32 | } 33 | 34 | 35 | - (id)initWithCoder:(NSCoder *)aDecoder 36 | { 37 | self = [super initWithCoder:aDecoder]; 38 | if (self) { 39 | [self initialization]; 40 | } 41 | 42 | return self; 43 | } 44 | 45 | - (void)initialization 46 | { 47 | self.backgroundColor = [UIColor clearColor]; 48 | self.layer.cornerRadius = CGRectGetWidth(self.frame) / 2; 49 | self.layer.borderColor = [UIColor whiteColor].CGColor; 50 | self.layer.borderWidth = 2; 51 | } 52 | 53 | 54 | - (void)changeActivityState:(BOOL)active 55 | { 56 | if (active) { 57 | self.backgroundColor = [UIColor whiteColor]; 58 | } else { 59 | self.backgroundColor = [UIColor clearColor]; 60 | } 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/PageControl/TAPageControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // TAPageControl.h 3 | // TAPageControl 4 | // 5 | // Created by Tanguy Aladenise on 2015-01-21. 6 | // Copyright (c) 2015 Tanguy Aladenise. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol TAPageControlDelegate; 12 | 13 | 14 | @interface TAPageControl : UIControl 15 | 16 | 17 | /** 18 | * Dot view customization properties 19 | */ 20 | 21 | /** 22 | * The Class of your custom UIView, make sure to respect the TAAbstractDotView class. 23 | */ 24 | @property (nonatomic) Class dotViewClass; 25 | 26 | 27 | /** 28 | * UIImage to represent a dot. 29 | */ 30 | @property (nonatomic) UIImage *dotImage; 31 | 32 | 33 | /** 34 | * UIImage to represent current page dot. 35 | */ 36 | @property (nonatomic) UIImage *currentDotImage; 37 | 38 | 39 | /** 40 | * Dot size for dot views. Default is 8 by 8. 41 | */ 42 | @property (nonatomic) CGSize dotSize; 43 | 44 | 45 | @property (nonatomic, strong) UIColor *dotColor; 46 | 47 | /** 48 | * Spacing between two dot views. Default is 8. 49 | */ 50 | @property (nonatomic) NSInteger spacingBetweenDots; 51 | 52 | 53 | /** 54 | * Page control setup properties 55 | */ 56 | 57 | 58 | /** 59 | * Delegate for TAPageControl 60 | */ 61 | @property(nonatomic,assign) id delegate; 62 | 63 | 64 | /** 65 | * Number of pages for control. Default is 0. 66 | */ 67 | @property (nonatomic) NSInteger numberOfPages; 68 | 69 | 70 | /** 71 | * Current page on which control is active. Default is 0. 72 | */ 73 | @property (nonatomic) NSInteger currentPage; 74 | 75 | 76 | /** 77 | * Hide the control if there is only one page. Default is NO. 78 | */ 79 | @property (nonatomic) BOOL hidesForSinglePage; 80 | 81 | 82 | /** 83 | * Let the control know if should grow bigger by keeping center, or just get longer (right side expanding). By default YES. 84 | */ 85 | @property (nonatomic) BOOL shouldResizeFromCenter; 86 | 87 | 88 | /** 89 | * Return the minimum size required to display control properly for the given page count. 90 | * 91 | * @param pageCount Number of dots that will require display 92 | * 93 | * @return The CGSize being the minimum size required. 94 | */ 95 | - (CGSize)sizeForNumberOfPages:(NSInteger)pageCount; 96 | 97 | 98 | @end 99 | 100 | 101 | @protocol TAPageControlDelegate 102 | 103 | @optional 104 | - (void)TAPageControl:(TAPageControl *)pageControl didSelectPageAtIndex:(NSInteger)index; 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/SDCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // SDCollectionViewCell.h 3 | // SDCycleScrollView 4 | // 5 | // Created by aier on 15-3-22. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | /* 10 | 11 | ********************************************************************************* 12 | * 13 | * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟 14 | * 15 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 16 | * 帮您解决问题。 17 | * 新浪微博:GSD_iOS 18 | * Email : gsdios@126.com 19 | * GitHub: https://github.com/gsdios 20 | * 21 | * 另(我的自动布局库SDAutoLayout): 22 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 23 | * 做最简单易用的AutoLayout库。 24 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 25 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 26 | * GitHub:https://github.com/gsdios/SDAutoLayout 27 | ********************************************************************************* 28 | 29 | */ 30 | 31 | 32 | 33 | #import 34 | 35 | @interface SDCollectionViewCell : UICollectionViewCell 36 | 37 | @property (weak, nonatomic) UIImageView *imageView; 38 | @property (copy, nonatomic) NSString *title; 39 | 40 | @property (nonatomic, strong) UIColor *titleLabelTextColor; 41 | @property (nonatomic, strong) UIFont *titleLabelTextFont; 42 | @property (nonatomic, strong) UIColor *titleLabelBackgroundColor; 43 | @property (nonatomic, assign) CGFloat titleLabelHeight; 44 | 45 | @property (nonatomic, assign) BOOL hasConfigured; 46 | 47 | /** 只展示文字轮播 */ 48 | @property (nonatomic, assign) BOOL onlyDisplayText; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/SDCollectionViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // SDCollectionViewCell.m 3 | // SDCycleScrollView 4 | // 5 | // Created by aier on 15-3-22. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | 10 | /* 11 | 12 | ********************************************************************************* 13 | * 14 | * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟 15 | * 16 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 17 | * 帮您解决问题。 18 | * 新浪微博:GSD_iOS 19 | * Email : gsdios@126.com 20 | * GitHub: https://github.com/gsdios 21 | * 22 | * 另(我的自动布局库SDAutoLayout): 23 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 24 | * 做最简单易用的AutoLayout库。 25 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 26 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 27 | * GitHub:https://github.com/gsdios/SDAutoLayout 28 | ********************************************************************************* 29 | 30 | */ 31 | 32 | 33 | #import "SDCollectionViewCell.h" 34 | #import "UIView+SDExtension.h" 35 | 36 | @implementation SDCollectionViewCell 37 | { 38 | __weak UILabel *_titleLabel; 39 | } 40 | 41 | 42 | - (instancetype)initWithFrame:(CGRect)frame 43 | { 44 | if (self = [super initWithFrame:frame]) { 45 | [self setupImageView]; 46 | [self setupTitleLabel]; 47 | } 48 | 49 | return self; 50 | } 51 | 52 | - (void)setTitleLabelBackgroundColor:(UIColor *)titleLabelBackgroundColor 53 | { 54 | _titleLabelBackgroundColor = titleLabelBackgroundColor; 55 | _titleLabel.backgroundColor = titleLabelBackgroundColor; 56 | } 57 | 58 | - (void)setTitleLabelTextColor:(UIColor *)titleLabelTextColor 59 | { 60 | _titleLabelTextColor = titleLabelTextColor; 61 | _titleLabel.textColor = titleLabelTextColor; 62 | } 63 | 64 | - (void)setTitleLabelTextFont:(UIFont *)titleLabelTextFont 65 | { 66 | _titleLabelTextFont = titleLabelTextFont; 67 | _titleLabel.font = titleLabelTextFont; 68 | } 69 | 70 | - (void)setupImageView 71 | { 72 | UIImageView *imageView = [[UIImageView alloc] init]; 73 | _imageView = imageView; 74 | _imageView.contentMode = UIViewContentModeScaleAspectFill; 75 | _imageView.clipsToBounds = YES; 76 | [self.contentView addSubview:imageView]; 77 | } 78 | 79 | - (void)setupTitleLabel 80 | { 81 | UILabel *titleLabel = [[UILabel alloc] init]; 82 | _titleLabel = titleLabel; 83 | _titleLabel.hidden = YES; 84 | [self.contentView addSubview:titleLabel]; 85 | } 86 | 87 | - (void)setTitle:(NSString *)title 88 | { 89 | _title = [title copy]; 90 | _titleLabel.text = [NSString stringWithFormat:@" %@", title]; 91 | if (_titleLabel.hidden) { 92 | _titleLabel.hidden = NO; 93 | } 94 | } 95 | 96 | 97 | - (void)layoutSubviews 98 | { 99 | [super layoutSubviews]; 100 | 101 | if (self.onlyDisplayText) { 102 | _titleLabel.frame = self.bounds; 103 | } else { 104 | _imageView.frame = self.bounds; 105 | CGFloat titleLabelW = self.sd_width; 106 | CGFloat titleLabelH = _titleLabelHeight; 107 | CGFloat titleLabelX = 0; 108 | CGFloat titleLabelY = self.sd_height - titleLabelH; 109 | _titleLabel.frame = CGRectMake(titleLabelX, titleLabelY, titleLabelW, titleLabelH); 110 | } 111 | } 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/UIView+SDExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+SDExtension.h 3 | // SDRefreshView 4 | // 5 | // Created by aier on 15-2-23. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | /* 10 | 11 | ********************************************************************************* 12 | * 13 | * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟 14 | * 15 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 16 | * 帮您解决问题。 17 | * 新浪微博:GSD_iOS 18 | * Email : gsdios@126.com 19 | * GitHub: https://github.com/gsdios 20 | * 21 | * 另(我的自动布局库SDAutoLayout): 22 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 23 | * 做最简单易用的AutoLayout库。 24 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 25 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 26 | * GitHub:https://github.com/gsdios/SDAutoLayout 27 | ********************************************************************************* 28 | 29 | */ 30 | 31 | #import 32 | 33 | #define SDColorCreater(r, g, b, a) [UIColor colorWithRed:(r / 255.0) green:(g / 255.0) blue:(b / 255.0) alpha:a] 34 | 35 | 36 | @interface UIView (SDExtension) 37 | 38 | @property (nonatomic, assign) CGFloat sd_height; 39 | @property (nonatomic, assign) CGFloat sd_width; 40 | 41 | @property (nonatomic, assign) CGFloat sd_y; 42 | @property (nonatomic, assign) CGFloat sd_x; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SDCycleScrollView/UIView+SDExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+SDExtension.m 3 | // SDRefreshView 4 | // 5 | // Created by aier on 15-2-23. 6 | // Copyright (c) 2015年 GSD. All rights reserved. 7 | // 8 | 9 | /* 10 | 11 | ********************************************************************************* 12 | * 13 | * 🌟🌟🌟 新建SDCycleScrollView交流QQ群:185534916 🌟🌟🌟 14 | * 15 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 16 | * 帮您解决问题。 17 | * 新浪微博:GSD_iOS 18 | * Email : gsdios@126.com 19 | * GitHub: https://github.com/gsdios 20 | * 21 | * 另(我的自动布局库SDAutoLayout): 22 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 23 | * 做最简单易用的AutoLayout库。 24 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 25 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 26 | * GitHub:https://github.com/gsdios/SDAutoLayout 27 | ********************************************************************************* 28 | 29 | */ 30 | 31 | /* 32 | 33 | ********************************************************************************* 34 | * 35 | * 在您使用此自动轮播库的过程中如果出现bug请及时以以下任意一种方式联系我们,我们会及时修复bug并 36 | * 帮您解决问题。 37 | * 新浪微博:GSD_iOS 38 | * Email : gsdios@126.com 39 | * GitHub: https://github.com/gsdios 40 | * 41 | * 另(我的自动布局库SDAutoLayout): 42 | * 一行代码搞定自动布局!支持Cell和Tableview高度自适应,Label和ScrollView内容自适应,致力于 43 | * 做最简单易用的AutoLayout库。 44 | * 视频教程:http://www.letv.com/ptv/vplay/24038772.html 45 | * 用法示例:https://github.com/gsdios/SDAutoLayout/blob/master/README.md 46 | * GitHub:https://github.com/gsdios/SDAutoLayout 47 | ********************************************************************************* 48 | 49 | */ 50 | 51 | 52 | #import "UIView+SDExtension.h" 53 | 54 | @implementation UIView (SDExtension) 55 | 56 | - (CGFloat)sd_height 57 | { 58 | return self.frame.size.height; 59 | } 60 | 61 | - (void)setSd_height:(CGFloat)sd_height 62 | { 63 | CGRect temp = self.frame; 64 | temp.size.height = sd_height; 65 | self.frame = temp; 66 | } 67 | 68 | - (CGFloat)sd_width 69 | { 70 | return self.frame.size.width; 71 | } 72 | 73 | - (void)setSd_width:(CGFloat)sd_width 74 | { 75 | CGRect temp = self.frame; 76 | temp.size.width = sd_width; 77 | self.frame = temp; 78 | } 79 | 80 | 81 | - (CGFloat)sd_y 82 | { 83 | return self.frame.origin.y; 84 | } 85 | 86 | - (void)setSd_y:(CGFloat)sd_y 87 | { 88 | CGRect temp = self.frame; 89 | temp.origin.y = sd_y; 90 | self.frame = temp; 91 | } 92 | 93 | - (CGFloat)sd_x 94 | { 95 | return self.frame.origin.x; 96 | } 97 | 98 | - (void)setSd_x:(CGFloat)sd_x 99 | { 100 | CGRect temp = self.frame; 101 | temp.origin.x = sd_x; 102 | self.frame = temp; 103 | } 104 | 105 | 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/ShowString/ShowString.h: -------------------------------------------------------------------------------- 1 | // 2 | // ShowString.h 3 | // Xitu 4 | // 5 | // Created by SGJ on 16/1/31. 6 | // Copyright © 2016年 huchunyuan. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ShowString : NSObject 12 | /** 仿MBP */ 13 | + (ShowString *)sharedManager; 14 | - (void)showStringView:(NSString *)str; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/ShowString/ShowString.m: -------------------------------------------------------------------------------- 1 | // 2 | // ShowString.m 3 | // Xitu 4 | // 5 | // Created by SGJ on 16/1/31. 6 | // Copyright © 2016年 huchunyuan. All rights reserved. 7 | // 8 | 9 | #import "ShowString.h" 10 | #import "KLCPopup.h" 11 | 12 | @implementation ShowString 13 | 14 | +(ShowString *)sharedManager 15 | { 16 | static ShowString *sharedManager = nil; 17 | static dispatch_once_t onceToken; 18 | dispatch_once(&onceToken, ^{ 19 | sharedManager = [[ShowString alloc]init]; 20 | }); 21 | return sharedManager; 22 | } 23 | - (void)showStringView:(NSString *)str { 24 | [KLCPopup dismissAllPopups]; 25 | 26 | CGFloat width = [self widthForString:str fontSize:17.0]; 27 | 28 | UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, width + 80, 50)]; 29 | label.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.8]; 30 | label.textColor = [UIColor whiteColor]; 31 | label.textAlignment = NSTextAlignmentCenter; 32 | label.layer.cornerRadius = 6; 33 | label.layer.masksToBounds = YES; 34 | label.numberOfLines = 0; 35 | label.text = str; 36 | KLCPopup *view = [KLCPopup popupWithContentView:label showType:(KLCPopupShowTypeFadeIn) dismissType:(KLCPopupDismissTypeFadeOut) maskType:(KLCPopupMaskTypeNone) dismissOnBackgroundTouch:NO dismissOnContentTouch:YES]; 37 | [view showWithDuration:0.5]; 38 | } 39 | 40 | - (float)widthForString:(NSString *)value fontSize:(float)fontSize{ 41 | NSDictionary *attribute = @{NSFontAttributeName: [UIFont systemFontOfSize:fontSize]}; 42 | CGSize size = [value boundingRectWithSize:CGSizeMake(MAXFLOAT, 30) options: NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attribute context:nil].size; 43 | return size.width; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintConfig.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection 27 | #else 28 | import AppKit 29 | public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection 30 | #endif 31 | 32 | 33 | public struct ConstraintConfig { 34 | 35 | public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .leftToRight 36 | 37 | } 38 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintDescription.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintDescription { 32 | 33 | internal let view: ConstraintView 34 | internal var attributes: ConstraintAttributes 35 | internal var relation: ConstraintRelation? = nil 36 | internal var sourceLocation: (String, UInt)? = nil 37 | internal var label: String? = nil 38 | internal var related: ConstraintItem? = nil 39 | internal var multiplier: ConstraintMultiplierTarget = 1.0 40 | internal var constant: ConstraintConstantTarget = 0.0 41 | internal var priority: ConstraintPriorityTarget = 1000.0 42 | internal lazy var constraint: Constraint? = { 43 | guard let relation = self.relation, 44 | let related = self.related, 45 | let sourceLocation = self.sourceLocation else { 46 | return nil 47 | } 48 | let from = ConstraintItem(target: self.view, attributes: self.attributes) 49 | 50 | return Constraint( 51 | from: from, 52 | to: related, 53 | relation: relation, 54 | sourceLocation: sourceLocation, 55 | label: self.label, 56 | multiplier: self.multiplier, 57 | constant: self.constant, 58 | priority: self.priority 59 | ) 60 | }() 61 | 62 | // MARK: Initialization 63 | 64 | internal init(view: ConstraintView, attributes: ConstraintAttributes) { 65 | self.view = view 66 | self.attributes = attributes 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintInsetTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintInsetTarget: ConstraintConstantTarget { 32 | } 33 | 34 | extension Int: ConstraintInsetTarget { 35 | } 36 | 37 | extension UInt: ConstraintInsetTarget { 38 | } 39 | 40 | extension Float: ConstraintInsetTarget { 41 | } 42 | 43 | extension Double: ConstraintInsetTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintInsetTarget { 47 | } 48 | 49 | extension ConstraintInsets: ConstraintInsetTarget { 50 | } 51 | 52 | extension ConstraintInsetTarget { 53 | 54 | internal var constraintInsetTargetValue: ConstraintInsets { 55 | if let amount = self as? ConstraintInsets { 56 | return amount 57 | } else if let amount = self as? Float { 58 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 59 | } else if let amount = self as? Double { 60 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 61 | } else if let amount = self as? CGFloat { 62 | return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount) 63 | } else if let amount = self as? Int { 64 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 65 | } else if let amount = self as? UInt { 66 | return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount)) 67 | } else { 68 | return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0) 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintInsets.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | public typealias ConstraintInsets = UIEdgeInsets 33 | #else 34 | public typealias ConstraintInsets = EdgeInsets 35 | #endif 36 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintItem: Equatable { 32 | 33 | internal weak var target: AnyObject? 34 | internal let attributes: ConstraintAttributes 35 | 36 | internal init(target: AnyObject?, attributes: ConstraintAttributes) { 37 | self.target = target 38 | self.attributes = attributes 39 | } 40 | 41 | internal var view: ConstraintView? { 42 | return self.target as? ConstraintView 43 | } 44 | 45 | } 46 | 47 | public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool { 48 | // pointer equality 49 | guard lhs !== rhs else { 50 | return true 51 | } 52 | 53 | // must both have valid targets and identical attributes 54 | guard let target1 = lhs.target, 55 | let target2 = rhs.target, 56 | target1 === target2 && lhs.attributes == rhs.attributes else { 57 | return false 58 | } 59 | 60 | return true 61 | } 62 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintLayoutGuide.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | @available(iOS 9.0, *) 33 | public typealias ConstraintLayoutGuide = UILayoutGuide 34 | #else 35 | public class ConstraintLayoutGuide {} 36 | #endif 37 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintLayoutGuideDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | @available(iOS 9.0, *) 32 | public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL { 33 | 34 | public var target: AnyObject? { 35 | return self.guide 36 | } 37 | 38 | internal let guide: ConstraintLayoutGuide 39 | 40 | internal init(guide: ConstraintLayoutGuide) { 41 | self.guide = guide 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintLayoutSupport.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | @available(iOS 8.0, *) 33 | public typealias ConstraintLayoutSupport = UILayoutSupport 34 | #else 35 | public class ConstraintLayoutSupport {} 36 | #endif 37 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintLayoutSupportDSL.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | @available(iOS 8.0, *) 32 | public struct ConstraintLayoutSupportDSL: ConstraintDSL { 33 | 34 | public var target: AnyObject? { 35 | return self.support 36 | } 37 | 38 | internal let support: ConstraintLayoutSupport 39 | 40 | internal init(support: ConstraintLayoutSupport) { 41 | self.support = support 42 | 43 | } 44 | 45 | public var top: ConstraintItem { 46 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top) 47 | } 48 | 49 | public var bottom: ConstraintItem { 50 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom) 51 | } 52 | 53 | public var height: ConstraintItem { 54 | return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintMakerEditable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerEditable: ConstraintMakerPriortizable { 32 | 33 | @discardableResult 34 | public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable { 35 | self.description.multiplier = amount 36 | return self 37 | } 38 | 39 | @discardableResult 40 | public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable { 41 | return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue) 42 | } 43 | 44 | @discardableResult 45 | public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable { 46 | self.description.constant = amount.constraintOffsetTargetValue 47 | return self 48 | } 49 | 50 | @discardableResult 51 | public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable { 52 | self.description.constant = amount.constraintInsetTargetValue 53 | return self 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintMakerFinalizable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerFinalizable { 32 | 33 | internal let description: ConstraintDescription 34 | 35 | internal init(_ description: ConstraintDescription) { 36 | self.description = description 37 | } 38 | 39 | @discardableResult 40 | public func labeled(_ label: String) -> ConstraintMakerFinalizable { 41 | self.description.label = label 42 | return self 43 | } 44 | 45 | public var constraint: Constraint { 46 | return self.description.constraint! 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintMakerPriortizable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class ConstraintMakerPriortizable: ConstraintMakerFinalizable { 32 | 33 | @discardableResult 34 | public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable { 35 | self.description.priority = amount 36 | return self 37 | } 38 | 39 | @available(*, deprecated:3.0, message:"Use priority(_ amount: ConstraintPriorityTarget) instead.") 40 | @discardableResult 41 | public func priorityRequired() -> ConstraintMakerFinalizable { 42 | return self.priority(1000) 43 | } 44 | 45 | @available(*, deprecated:3.0, message:"Use priority(_ amount: ConstraintPriorityTarget) instead.") 46 | @discardableResult 47 | public func priorityHigh() -> ConstraintMakerFinalizable { 48 | return self.priority(750) 49 | } 50 | 51 | @available(*, deprecated:3.0, message:"Use priority(_ amount: ConstraintPriorityTarget) instead.") 52 | @discardableResult 53 | public func priorityMedium() -> ConstraintMakerFinalizable { 54 | #if os(iOS) || os(tvOS) 55 | return self.priority(500) 56 | #else 57 | return self.priority(501) 58 | #endif 59 | } 60 | 61 | @available(*, deprecated:3.0, message:"Use priority(_ amount: ConstraintPriorityTarget) instead.") 62 | @discardableResult 63 | public func priorityLow() -> ConstraintMakerFinalizable { 64 | return self.priority(250) 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintMultiplierTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintMultiplierTarget { 32 | 33 | var constraintMultiplierTargetValue: CGFloat { get } 34 | 35 | } 36 | 37 | extension Int: ConstraintMultiplierTarget { 38 | 39 | public var constraintMultiplierTargetValue: CGFloat { 40 | return CGFloat(self) 41 | } 42 | 43 | } 44 | 45 | extension UInt: ConstraintMultiplierTarget { 46 | 47 | public var constraintMultiplierTargetValue: CGFloat { 48 | return CGFloat(self) 49 | } 50 | 51 | } 52 | 53 | extension Float: ConstraintMultiplierTarget { 54 | 55 | public var constraintMultiplierTargetValue: CGFloat { 56 | return CGFloat(self) 57 | } 58 | 59 | } 60 | 61 | extension Double: ConstraintMultiplierTarget { 62 | 63 | public var constraintMultiplierTargetValue: CGFloat { 64 | return CGFloat(self) 65 | } 66 | 67 | } 68 | 69 | extension CGFloat: ConstraintMultiplierTarget { 70 | 71 | public var constraintMultiplierTargetValue: CGFloat { 72 | return self 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintOffsetTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintOffsetTarget: ConstraintConstantTarget { 32 | } 33 | 34 | extension Int: ConstraintOffsetTarget { 35 | } 36 | 37 | extension UInt: ConstraintOffsetTarget { 38 | } 39 | 40 | extension Float: ConstraintOffsetTarget { 41 | } 42 | 43 | extension Double: ConstraintOffsetTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintOffsetTarget { 47 | } 48 | 49 | extension ConstraintOffsetTarget { 50 | 51 | internal var constraintOffsetTargetValue: CGFloat { 52 | let offset: CGFloat 53 | if let amount = self as? Float { 54 | offset = CGFloat(amount) 55 | } else if let amount = self as? Double { 56 | offset = CGFloat(amount) 57 | } else if let amount = self as? CGFloat { 58 | offset = CGFloat(amount) 59 | } else if let amount = self as? Int { 60 | offset = CGFloat(amount) 61 | } else if let amount = self as? UInt { 62 | offset = CGFloat(amount) 63 | } else { 64 | offset = 0.0 65 | } 66 | return offset 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintPriorityTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintPriorityTarget { 32 | 33 | var constraintPriorityTargetValue: Float { get } 34 | 35 | } 36 | 37 | extension Int: ConstraintPriorityTarget { 38 | 39 | public var constraintPriorityTargetValue: Float { 40 | return Float(self) 41 | } 42 | 43 | } 44 | 45 | extension UInt: ConstraintPriorityTarget { 46 | 47 | public var constraintPriorityTargetValue: Float { 48 | return Float(self) 49 | } 50 | 51 | } 52 | 53 | extension Float: ConstraintPriorityTarget { 54 | 55 | public var constraintPriorityTargetValue: Float { 56 | return self 57 | } 58 | 59 | } 60 | 61 | extension Double: ConstraintPriorityTarget { 62 | 63 | public var constraintPriorityTargetValue: Float { 64 | return Float(self) 65 | } 66 | 67 | } 68 | 69 | extension CGFloat: ConstraintPriorityTarget { 70 | 71 | public var constraintPriorityTargetValue: Float { 72 | return Float(self) 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintRelatableTarget.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public protocol ConstraintRelatableTarget { 32 | } 33 | 34 | extension Int: ConstraintRelatableTarget { 35 | } 36 | 37 | extension UInt: ConstraintRelatableTarget { 38 | } 39 | 40 | extension Float: ConstraintRelatableTarget { 41 | } 42 | 43 | extension Double: ConstraintRelatableTarget { 44 | } 45 | 46 | extension CGFloat: ConstraintRelatableTarget { 47 | } 48 | 49 | extension CGSize: ConstraintRelatableTarget { 50 | } 51 | 52 | extension CGPoint: ConstraintRelatableTarget { 53 | } 54 | 55 | extension ConstraintInsets: ConstraintRelatableTarget { 56 | } 57 | 58 | extension ConstraintItem: ConstraintRelatableTarget { 59 | } 60 | 61 | extension ConstraintView: ConstraintRelatableTarget { 62 | } 63 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintRelation.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | internal enum ConstraintRelation: Int { 32 | case equal = 1 33 | case lessThanOrEqual 34 | case greaterThanOrEqual 35 | 36 | internal var layoutRelation: NSLayoutRelation { 37 | get { 38 | switch(self) { 39 | case .equal: 40 | return .equal 41 | case .lessThanOrEqual: 42 | return .lessThanOrEqual 43 | case .greaterThanOrEqual: 44 | return .greaterThanOrEqual 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/ConstraintView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | #if os(iOS) || os(tvOS) 32 | public typealias ConstraintView = UIView 33 | #else 34 | public typealias ConstraintView = NSView 35 | #endif 36 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/LayoutConstraint.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #else 27 | import AppKit 28 | #endif 29 | 30 | 31 | public class LayoutConstraint: NSLayoutConstraint { 32 | 33 | public var label: String? { 34 | get { 35 | return self.identifier 36 | } 37 | set { 38 | self.identifier = newValue 39 | } 40 | } 41 | 42 | internal var constraint: Constraint! = nil 43 | 44 | } 45 | 46 | internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool { 47 | guard lhs.firstItem === rhs.firstItem && 48 | lhs.secondItem === rhs.secondItem && 49 | lhs.firstAttribute == rhs.firstAttribute && 50 | lhs.secondAttribute == rhs.secondAttribute && 51 | lhs.relation == rhs.relation && 52 | lhs.priority == rhs.priority && 53 | lhs.multiplier == rhs.multiplier else { 54 | return false 55 | } 56 | return true 57 | } 58 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/SnapKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #import 25 | 26 | FOUNDATION_EXPORT double SnapKitVersionNumber; 27 | FOUNDATION_EXPORT const unsigned char SnapKitVersionString[]; -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/UILayoutGuide+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #endif 27 | 28 | 29 | @available(iOS 9.0, *) 30 | public extension ConstraintLayoutGuide { 31 | 32 | public var snp: ConstraintLayoutGuideDSL { 33 | return ConstraintLayoutGuideDSL(guide: self) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/Snapkit/UILayoutSupport+Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SnapKit 3 | // 4 | // Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | 24 | #if os(iOS) || os(tvOS) 25 | import UIKit 26 | #endif 27 | 28 | 29 | @available(iOS 8.0, *) 30 | public extension ConstraintLayoutSupport { 31 | 32 | public var snp: ConstraintLayoutSupportDSL { 33 | return ConstraintLayoutSupportDSL(support: self) 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SwViewCapture/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SwViewCapture/SwViewCapture.h: -------------------------------------------------------------------------------- 1 | // 2 | // SwViewCapture.h 3 | // SwViewCapture 4 | // 5 | // Created by chenxing.cx on 15/10/29. 6 | // Copyright © 2015年 Startry. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SwViewCapture. 12 | FOUNDATION_EXPORT double SwViewCaptureVersionNumber; 13 | 14 | //! Project version string for SwViewCapture. 15 | FOUNDATION_EXPORT const unsigned char SwViewCaptureVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SwViewCapture/UIView+SwCapture.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+SwCapture.swift 3 | // SwViewCapture 4 | // 5 | // Created by chenxing.cx on 16/2/17. 6 | // Copyright © 2016年 Startry. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import WebKit 11 | import ObjectiveC 12 | 13 | private var SwViewCaptureKey_IsCapturing: String = "SwViewCapture_AssoKey_isCapturing" 14 | 15 | public extension UIView { 16 | 17 | public func swSetFrame(_ frame: CGRect) { 18 | // Do nothing, use for swizzling 19 | } 20 | 21 | var isCapturing:Bool! { 22 | get { 23 | let num = objc_getAssociatedObject(self, &SwViewCaptureKey_IsCapturing) 24 | if num == nil { 25 | return false 26 | } 27 | 28 | // num as AnyObject .boolValue 29 | return false 30 | 31 | // return num.boolValue 32 | } 33 | set(newValue) { 34 | let num = NSNumber(value: newValue as Bool) 35 | objc_setAssociatedObject(self, &SwViewCaptureKey_IsCapturing, num, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC) 36 | } 37 | } 38 | 39 | // Ref: chromium source - snapshot_manager, fix wkwebview screenshot bug. 40 | // https://chromium.googlesource.com/chromium/src.git/+/46.0.2478.0/ios/chrome/browser/snapshots/snapshot_manager.mm 41 | public func swContainsWKWebView() -> Bool { 42 | if self.isKind(of: WKWebView.self) { 43 | return true 44 | } 45 | for subView in self.subviews { 46 | if (subView.swContainsWKWebView()) { 47 | return true 48 | } 49 | } 50 | return false 51 | } 52 | 53 | public func swCapture(_ completionHandler: (_ capturedImage: UIImage?) -> Void) { 54 | 55 | self.isCapturing = true 56 | 57 | let bounds = self.bounds 58 | 59 | UIGraphicsBeginImageContextWithOptions(bounds.size, false, UIScreen.main.scale) 60 | 61 | let context = UIGraphicsGetCurrentContext() 62 | context?.saveGState() 63 | context?.translateBy(x: -self.frame.origin.x, y: -self.frame.origin.y); 64 | 65 | if (swContainsWKWebView()) { 66 | self.drawHierarchy(in: bounds, afterScreenUpdates: true) 67 | }else{ 68 | self.layer.render(in: context!) 69 | } 70 | let capturedImage = UIGraphicsGetImageFromCurrentImageContext() 71 | 72 | context?.restoreGState(); 73 | UIGraphicsEndImageContext() 74 | 75 | self.isCapturing = false 76 | 77 | completionHandler(capturedImage) 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/SwiftyJSON/SwiftyJSON.h: -------------------------------------------------------------------------------- 1 | // SwiftyJSON.h 2 | // 3 | // Copyright (c) 2014 Ruoyu Fu, Pinglin Tang 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | @import Foundation; 24 | 25 | //! Project version number for SwiftyJSON. 26 | FOUNDATION_EXPORT double SwiftyJSONVersionNumber; 27 | 28 | //! Project version string for SwiftyJSON. 29 | FOUNDATION_EXPORT const unsigned char SwiftyJSONVersionString[]; 30 | 31 | 32 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZAssetCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TZAssetCell.h 3 | // TZImagePickerController 4 | // 5 | // Created by 谭真 on 15/12/24. 6 | // Copyright © 2015年 谭真. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | 14 | typedef enum : NSUInteger { 15 | TZAssetCellTypePhoto = 0, 16 | TZAssetCellTypeLivePhoto, 17 | TZAssetCellTypeVideo, 18 | TZAssetCellTypeAudio, 19 | } TZAssetCellType; 20 | 21 | @class TZAssetModel; 22 | @interface TZAssetCell : UICollectionViewCell 23 | 24 | @property (weak, nonatomic) UIButton *selectPhotoButton; 25 | @property (nonatomic, strong) TZAssetModel *model; 26 | @property (nonatomic, copy) void (^didSelectPhotoBlock)(BOOL); 27 | @property (nonatomic, assign) TZAssetCellType type; 28 | @property (nonatomic, copy) NSString *representedAssetIdentifier; 29 | @property (nonatomic, assign) PHImageRequestID imageRequestID; 30 | @end 31 | 32 | 33 | @class TZAlbumModel; 34 | 35 | @interface TZAlbumCell : UITableViewCell 36 | 37 | @property (nonatomic, strong) TZAlbumModel *model; 38 | @property (weak, nonatomic) UIButton *selectedCountButton; 39 | 40 | @end 41 | 42 | 43 | @interface TZAssetCameraCell : UICollectionViewCell 44 | 45 | @property (nonatomic, strong) UIImageView *imageView; 46 | 47 | @end -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZAssetModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // TZAssetModel.h 3 | // TZImagePickerController 4 | // 5 | // Created by 谭真 on 15/12/24. 6 | // Copyright © 2015年 谭真. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | typedef enum : NSUInteger { 13 | TZAssetModelMediaTypePhoto = 0, 14 | TZAssetModelMediaTypeLivePhoto, 15 | TZAssetModelMediaTypeVideo, 16 | TZAssetModelMediaTypeAudio 17 | } TZAssetModelMediaType; 18 | 19 | @class PHAsset; 20 | @interface TZAssetModel : NSObject 21 | 22 | @property (nonatomic, strong) id asset; ///< PHAsset or ALAsset 23 | @property (nonatomic, assign) BOOL isSelected; ///< The select status of a photo, default is No 24 | @property (nonatomic, assign) TZAssetModelMediaType type; 25 | @property (nonatomic, copy) NSString *timeLength; 26 | 27 | /// Init a photo dataModel With a asset 28 | /// 用一个PHAsset/ALAsset实例,初始化一个照片模型 29 | + (instancetype)modelWithAsset:(id)asset type:(TZAssetModelMediaType)type; 30 | + (instancetype)modelWithAsset:(id)asset type:(TZAssetModelMediaType)type timeLength:(NSString *)timeLength; 31 | 32 | @end 33 | 34 | 35 | @class PHFetchResult; 36 | @interface TZAlbumModel : NSObject 37 | 38 | @property (nonatomic, strong) NSString *name; ///< The album name 39 | @property (nonatomic, assign) NSInteger count; ///< Count of photos the album contain 40 | @property (nonatomic, strong) id result; ///< PHFetchResult or ALAssetsGroup 41 | 42 | @property (nonatomic, strong) NSArray *models; 43 | @property (nonatomic, strong) NSArray *selectedModels; 44 | @property (nonatomic, assign) NSUInteger selectedCount; 45 | @end -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZAssetModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // TZAssetModel.m 3 | // TZImagePickerController 4 | // 5 | // Created by 谭真 on 15/12/24. 6 | // Copyright © 2015年 谭真. All rights reserved. 7 | // 8 | 9 | #import "TZAssetModel.h" 10 | #import "TZImageManager.h" 11 | 12 | @implementation TZAssetModel 13 | 14 | + (instancetype)modelWithAsset:(id)asset type:(TZAssetModelMediaType)type{ 15 | TZAssetModel *model = [[TZAssetModel alloc] init]; 16 | model.asset = asset; 17 | model.isSelected = NO; 18 | model.type = type; 19 | return model; 20 | } 21 | 22 | + (instancetype)modelWithAsset:(id)asset type:(TZAssetModelMediaType)type timeLength:(NSString *)timeLength { 23 | TZAssetModel *model = [self modelWithAsset:asset type:type]; 24 | model.timeLength = timeLength; 25 | return model; 26 | } 27 | 28 | @end 29 | 30 | 31 | 32 | @implementation TZAlbumModel 33 | 34 | - (void)setResult:(id)result { 35 | _result = result; 36 | BOOL allowPickingImage = [[[NSUserDefaults standardUserDefaults] objectForKey:@"tz_allowPickingImage"] isEqualToString:@"1"]; 37 | BOOL allowPickingVideo = [[[NSUserDefaults standardUserDefaults] objectForKey:@"tz_allowPickingVideo"] isEqualToString:@"1"]; 38 | [[TZImageManager manager] getAssetsFromFetchResult:result allowPickingVideo:allowPickingVideo allowPickingImage:allowPickingImage completion:^(NSArray *models) { 39 | _models = models; 40 | if (_selectedModels) { 41 | [self checkSelectedModels]; 42 | } 43 | }]; 44 | } 45 | 46 | - (void)setSelectedModels:(NSArray *)selectedModels { 47 | _selectedModels = selectedModels; 48 | if (_models) { 49 | [self checkSelectedModels]; 50 | } 51 | } 52 | 53 | - (void)checkSelectedModels { 54 | self.selectedCount = 0; 55 | NSMutableArray *selectedAssets = [NSMutableArray array]; 56 | for (TZAssetModel *model in _selectedModels) { 57 | [selectedAssets addObject:model.asset]; 58 | } 59 | for (TZAssetModel *model in _models) { 60 | if ([[TZImageManager manager] isAssetsArray:selectedAssets containAsset:model.asset]) { 61 | self.selectedCount ++; 62 | } 63 | } 64 | } 65 | 66 | @end -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImageManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // TZImageManager.h 3 | // TZImagePickerController 4 | // 5 | // Created by 谭真 on 16/1/4. 6 | // Copyright © 2016年 谭真. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import 13 | 14 | @class TZAlbumModel,TZAssetModel; 15 | @interface TZImageManager : NSObject 16 | 17 | + (instancetype)manager; 18 | @property (nonatomic, strong) PHCachingImageManager *cachingImageManager; 19 | 20 | 21 | @property (nonatomic, assign) BOOL shouldFixOrientation; 22 | 23 | /// Default is 600px / 默认600像素宽 24 | @property (nonatomic, assign) CGFloat photoPreviewMaxWidth; 25 | 26 | /// Sort photos ascending by modificationDate,Default is YES 27 | /// 对照片排序,按修改时间升序,默认是YES。如果设置为NO,最新的照片会显示在最前面,内部的拍照按钮会排在第一个 28 | @property (nonatomic, assign) BOOL sortAscendingByModificationDate; 29 | 30 | /// Return YES if Authorized 返回YES如果得到了授权 31 | - (BOOL)authorizationStatusAuthorized; 32 | 33 | /// Get Album 获得相册/相册数组 34 | - (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(TZAlbumModel *model))completion; 35 | - (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray *models))completion; 36 | 37 | /// Get Assets 获得Asset数组 38 | - (void)getAssetsFromFetchResult:(id)result allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray *models))completion; 39 | - (void)getAssetFromFetchResult:(id)result atIndex:(NSInteger)index allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(TZAssetModel *model))completion; 40 | 41 | /// Get photo 获得照片 42 | - (void)getPostImageWithAlbumModel:(TZAlbumModel *)model completion:(void (^)(UIImage *postImage))completion; 43 | - (PHImageRequestID)getPhotoWithAsset:(id)asset completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion; 44 | - (PHImageRequestID)getPhotoWithAsset:(id)asset photoWidth:(CGFloat)photoWidth completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion; 45 | - (void)getOriginalPhotoWithAsset:(id)asset completion:(void (^)(UIImage *photo,NSDictionary *info))completion; 46 | 47 | /// Save photo 保存照片 48 | - (void)savePhotoWithImage:(UIImage *)image completion:(void (^)())completion; 49 | 50 | /// Get video 获得视频 51 | - (void)getVideoWithAsset:(id)asset completion:(void (^)(AVPlayerItem * playerItem, NSDictionary * info))completion; 52 | 53 | /// Export video 导出视频 54 | - (void)getVideoOutputPathWithAsset:(id)asset completion:(void (^)(NSString *outputPath))completion; 55 | 56 | /// Get photo bytes 获得一组照片的大小 57 | - (void)getPhotosBytesWithArray:(NSArray *)photos completion:(void (^)(NSString *totalBytes))completion; 58 | 59 | /// Judge is a assets array contain the asset 判断一个assets数组是否包含这个asset 60 | - (BOOL)isAssetsArray:(NSArray *)assets containAsset:(id)asset; 61 | 62 | - (NSString *)getAssetIdentifier:(id)asset; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/MMVideoPreviewPlay@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/MMVideoPreviewPlay@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/MMVideoPreviewPlayHL@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/MMVideoPreviewPlayHL@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/Root.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | StringsTable 6 | Root 7 | PreferenceSpecifiers 8 | 9 | 10 | Type 11 | PSGroupSpecifier 12 | Title 13 | Group 14 | 15 | 16 | Type 17 | PSTextFieldSpecifier 18 | Title 19 | Name 20 | Key 21 | name_preference 22 | DefaultValue 23 | 24 | IsSecure 25 | 26 | KeyboardType 27 | Alphabet 28 | AutocapitalizationType 29 | None 30 | AutocorrectionType 31 | No 32 | 33 | 34 | Type 35 | PSToggleSwitchSpecifier 36 | Title 37 | Enabled 38 | Key 39 | enabled_preference 40 | DefaultValue 41 | 42 | 43 | 44 | Type 45 | PSSliderSpecifier 46 | Key 47 | slider_preference 48 | DefaultValue 49 | 0.5 50 | MinimumValue 51 | 0 52 | MaximumValue 53 | 1 54 | MinimumValueImage 55 | 56 | MaximumValueImage 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/TableViewArrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/TableViewArrow@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/VideoSendIcon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/VideoSendIcon@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/navi_back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/navi_back@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_def_photoPickerVc@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_def_photoPickerVc@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_def_previewVc@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_def_previewVc@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_number_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_number_icon@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_original_def@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_original_def@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_original_sel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_original_sel@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_sel_photoPickerVc@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_sel_photoPickerVc@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_sel_previewVc@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/photo_sel_previewVc@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/preview_number_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/preview_number_icon@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/preview_original_def@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/preview_original_def@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/takePicture@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lafree317/WaterMark/7077bf66b44ceed93610e697f22335ef6b496342/WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZImagePickerController.bundle/takePicture@2x.png -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZPhotoPickerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TZPhotoPickerController.h 3 | // TZImagePickerController 4 | // 5 | // Created by 谭真 on 15/12/24. 6 | // Copyright © 2015年 谭真. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class TZAlbumModel; 12 | @interface TZPhotoPickerController : UIViewController 13 | 14 | @property (nonatomic, assign) BOOL isFirstAppear; 15 | @property (nonatomic, strong) TZAlbumModel *model; 16 | 17 | @property (nonatomic, copy) void (^backButtonClickHandle)(TZAlbumModel *model); 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZPhotoPreviewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // TZPhotoPreviewCell.h 3 | // TZImagePickerController 4 | // 5 | // Created by 谭真 on 15/12/24. 6 | // Copyright © 2015年 谭真. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class TZAssetModel; 12 | @interface TZPhotoPreviewCell : UICollectionViewCell 13 | 14 | @property (nonatomic, strong) TZAssetModel *model; 15 | @property (nonatomic, copy) void (^singleTapGestureBlock)(); 16 | 17 | - (void)recoverSubviews; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZPhotoPreviewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TZPhotoPreviewController.h 3 | // TZImagePickerController 4 | // 5 | // Created by 谭真 on 15/12/24. 6 | // Copyright © 2015年 谭真. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TZPhotoPreviewController : UIViewController 12 | 13 | @property (nonatomic, strong) NSMutableArray *models; ///< All photo models / 所有图片模型数组 14 | @property (nonatomic, strong) NSMutableArray *photos; ///< All photos / 所有图片数组 15 | @property (nonatomic, assign) NSInteger currentIndex; ///< Index of the photo user click / 用户点击的图片的索引 16 | @property (nonatomic, assign) BOOL isSelectOriginalPhoto; ///< If YES,return original photo / 是否返回原图 17 | 18 | /// Return the new selected photos / 返回最新的选中图片数组 19 | @property (nonatomic, copy) void (^backButtonClickBlock)(BOOL isSelectOriginalPhoto); 20 | @property (nonatomic, copy) void (^okButtonClickBlock)(BOOL isSelectOriginalPhoto); 21 | @property (nonatomic, copy) void (^okButtonClickBlockWithPreviewType)(NSArray *photos,NSArray *assets,BOOL isSelectOriginalPhoto); 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/TZVideoPlayerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TZVideoPlayerController.h 3 | // TZImagePickerController 4 | // 5 | // Created by 谭真 on 16/1/5. 6 | // Copyright © 2016年 谭真. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class TZAssetModel; 12 | @interface TZVideoPlayerController : UIViewController 13 | 14 | @property (nonatomic, strong) TZAssetModel *model; 15 | 16 | @end -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/UIView+Layout.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Layout.h 3 | // 4 | // Created by 谭真 on 15/2/24. 5 | // Copyright © 2015年 谭真. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | typedef enum : NSUInteger { 11 | TZOscillatoryAnimationToBigger, 12 | TZOscillatoryAnimationToSmaller, 13 | } TZOscillatoryAnimationType; 14 | 15 | @interface UIView (Layout) 16 | 17 | @property (nonatomic) CGFloat tz_left; ///< Shortcut for frame.origin.x. 18 | @property (nonatomic) CGFloat tz_top; ///< Shortcut for frame.origin.y 19 | @property (nonatomic) CGFloat tz_right; ///< Shortcut for frame.origin.x + frame.size.width 20 | @property (nonatomic) CGFloat tz_bottom; ///< Shortcut for frame.origin.y + frame.size.height 21 | @property (nonatomic) CGFloat tz_width; ///< Shortcut for frame.size.width. 22 | @property (nonatomic) CGFloat tz_height; ///< Shortcut for frame.size.height. 23 | @property (nonatomic) CGFloat tz_centerX; ///< Shortcut for center.x 24 | @property (nonatomic) CGFloat tz_centerY; ///< Shortcut for center.y 25 | @property (nonatomic) CGPoint tz_origin; ///< Shortcut for frame.origin. 26 | @property (nonatomic) CGSize tz_size; ///< Shortcut for frame.size. 27 | 28 | + (void)showOscillatoryAnimationWithLayer:(CALayer *)layer type:(TZOscillatoryAnimationType)type; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/TZImagePickerController/UIView+Layout.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Layout.m 3 | // 4 | // Created by 谭真 on 15/2/24. 5 | // Copyright © 2015年 谭真. All rights reserved. 6 | // 7 | 8 | #import "UIView+Layout.h" 9 | 10 | @implementation UIView (Layout) 11 | 12 | - (CGFloat)tz_left { 13 | return self.frame.origin.x; 14 | } 15 | 16 | - (void)setTz_left:(CGFloat)x { 17 | CGRect frame = self.frame; 18 | frame.origin.x = x; 19 | self.frame = frame; 20 | } 21 | 22 | - (CGFloat)tz_top { 23 | return self.frame.origin.y; 24 | } 25 | 26 | - (void)setTz_top:(CGFloat)y { 27 | CGRect frame = self.frame; 28 | frame.origin.y = y; 29 | self.frame = frame; 30 | } 31 | 32 | - (CGFloat)tz_right { 33 | return self.frame.origin.x + self.frame.size.width; 34 | } 35 | 36 | - (void)setTz_right:(CGFloat)right { 37 | CGRect frame = self.frame; 38 | frame.origin.x = right - frame.size.width; 39 | self.frame = frame; 40 | } 41 | 42 | - (CGFloat)tz_bottom { 43 | return self.frame.origin.y + self.frame.size.height; 44 | } 45 | 46 | - (void)setTz_bottom:(CGFloat)bottom { 47 | CGRect frame = self.frame; 48 | frame.origin.y = bottom - frame.size.height; 49 | self.frame = frame; 50 | } 51 | 52 | - (CGFloat)tz_width { 53 | return self.frame.size.width; 54 | } 55 | 56 | - (void)setTz_width:(CGFloat)width { 57 | CGRect frame = self.frame; 58 | frame.size.width = width; 59 | self.frame = frame; 60 | } 61 | 62 | - (CGFloat)tz_height { 63 | return self.frame.size.height; 64 | } 65 | 66 | - (void)setTz_height:(CGFloat)height { 67 | CGRect frame = self.frame; 68 | frame.size.height = height; 69 | self.frame = frame; 70 | } 71 | 72 | - (CGFloat)tz_centerX { 73 | return self.center.x; 74 | } 75 | 76 | - (void)setTz_centerX:(CGFloat)centerX { 77 | self.center = CGPointMake(centerX, self.center.y); 78 | } 79 | 80 | - (CGFloat)tz_centerY { 81 | return self.center.y; 82 | } 83 | 84 | - (void)setTz_centerY:(CGFloat)centerY { 85 | self.center = CGPointMake(self.center.x, centerY); 86 | } 87 | 88 | - (CGPoint)tz_origin { 89 | return self.frame.origin; 90 | } 91 | 92 | - (void)setTz_origin:(CGPoint)origin { 93 | CGRect frame = self.frame; 94 | frame.origin = origin; 95 | self.frame = frame; 96 | } 97 | 98 | - (CGSize)tz_size { 99 | return self.frame.size; 100 | } 101 | 102 | - (void)setTz_size:(CGSize)size { 103 | CGRect frame = self.frame; 104 | frame.size = size; 105 | self.frame = frame; 106 | } 107 | 108 | + (void)showOscillatoryAnimationWithLayer:(CALayer *)layer type:(TZOscillatoryAnimationType)type{ 109 | NSNumber *animationScale1 = type == TZOscillatoryAnimationToBigger ? @(1.15) : @(0.5); 110 | NSNumber *animationScale2 = type == TZOscillatoryAnimationToBigger ? @(0.92) : @(1.15); 111 | 112 | [UIView animateWithDuration:0.15 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{ 113 | [layer setValue:animationScale1 forKeyPath:@"transform.scale"]; 114 | } completion:^(BOOL finished) { 115 | [UIView animateWithDuration:0.15 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{ 116 | [layer setValue:animationScale2 forKeyPath:@"transform.scale"]; 117 | } completion:^(BOOL finished) { 118 | [UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{ 119 | [layer setValue:@(1.0) forKeyPath:@"transform.scale"]; 120 | } completion:nil]; 121 | }]; 122 | }]; 123 | } 124 | 125 | @end 126 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/ZEViewKit/ZEAlertView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZEAlertView.swift 3 | // Xitu 4 | // 5 | // Created by 胡春源 on 16/7/21. 6 | // Copyright © 2016年 huchunyuan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | typealias alertCallBack = (_ confirm:Bool)->() 11 | class ZEAlert: NSObject { 12 | var alertVC:UIAlertController! 13 | init(title:String,message:String?,confirm:String?,cancle:String?,style:UIAlertControllerStyle,callBack:alertCallBack?){ 14 | super.init() 15 | alertVC = UIAlertController(title: title, message: message, preferredStyle:style) 16 | if let confirm = confirm { 17 | let confirmAction = UIAlertAction(title: confirm, style:.default, handler: { (action) in 18 | if let block = callBack{ 19 | block(true) 20 | } 21 | }) 22 | alertVC.addAction(confirmAction) 23 | } 24 | if let cancle = cancle { 25 | let cancleAction = UIAlertAction(title: cancle, style:.default, handler: { (action) in 26 | if let block = callBack{ 27 | block(false) 28 | } 29 | }) 30 | alertVC.addAction(cancleAction) 31 | } 32 | } 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/ZEViewKit/ZEHud.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZEHud.swift 3 | // HandNote 4 | // 5 | // Created by 胡春源 on 16/3/19. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | // TODO : 时间 12 | class ZEHud: NSObject { 13 | static let sharedInstance = ZEHud() 14 | fileprivate override init() {} 15 | var hud:MBProgressHUD? 16 | var view:UIView! 17 | 18 | func showHud(){ 19 | hud = MBProgressHUD.showAdded(to: view, animated: true) 20 | } 21 | func showHudWithView(_ view:UIView){ 22 | hud = MBProgressHUD.showAdded(to: view, animated: true) 23 | } 24 | func hideHud(){ 25 | 26 | hud?.hide(animated: true, afterDelay: 0) 27 | } 28 | func showSuccess(_ text:String){ 29 | createdHud(text) 30 | } 31 | func showError(_ text:String){ 32 | createdHud(text) 33 | } 34 | func createdHud(_ text:String){ 35 | hud?.hide(animated: true) 36 | hud = MBProgressHUD.showAdded(to: view, animated: true) 37 | hud?.label.text = text 38 | hud?.mode = MBProgressHUDMode.customView 39 | hud?.removeFromSuperViewOnHide = true 40 | hud?.hide(animated: true, afterDelay: 0.75) 41 | } 42 | func showSuccessWithImage(_ text:String){ 43 | createdHud(text) 44 | hud?.customView = UIImageView(image: UIImage.init(named: "success")) 45 | } 46 | func showErrorWithImage(_ text:String){ 47 | createdHud(text) 48 | hud?.customView = UIImageView(image: UIImage.init(named: "error")) 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/Vendors/ZEViewKit/ZEToolBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZEToolBar.swift 3 | // WaterLabel 4 | // 5 | // Created by 胡春源 on 16/7/28. 6 | // Copyright © 2016年 胡春源. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ZEToolBar: UIToolbar { 12 | var imageNameArr:[String] = []{// 记录图片名数组 13 | willSet{ 14 | self.imageNameArr = newValue 15 | setBarItems() 16 | } 17 | } 18 | fileprivate var itemArr:[UIBarButtonItem] = [] // 存储item用于以后操作 19 | var actionCallBack:((_ imageName:String) -> ())? // 回调imageName 20 | override init(frame: CGRect) { 21 | super.init(frame: frame) 22 | setUI() 23 | setBarItems() 24 | } 25 | func setUI(){ 26 | tintColor = UIColor.lightGray 27 | } 28 | func setBarItems(){ 29 | itemArr = [] 30 | let spaceItem = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) 31 | for str in imageNameArr { 32 | let item = UIBarButtonItem(image: UIImage(named: str), style: .done, target: self, action: #selector(itemAction(_:))) 33 | item.title = str 34 | if itemArr.count != 0 { 35 | itemArr.append(spaceItem) 36 | } 37 | itemArr.append(item) 38 | } 39 | self.setItems(itemArr, animated: true) 40 | } 41 | func itemAction(_ item:UIBarButtonItem){ 42 | if let block = actionCallBack { 43 | block(item.title!) 44 | } 45 | } 46 | required init?(coder aDecoder: NSCoder) { 47 | fatalError("init(coder:) has not been implemented") 48 | } 49 | 50 | } 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /WaterLabel/WaterLabel/WaterLabel.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.WaterMark 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /WaterLabel/podfile: -------------------------------------------------------------------------------- 1 | target ’WaterLabel’ do 2 | platform:ios,’8.0’ 3 | pod 'LeanCloudSocial' 4 | pod 'SDWebImage' 5 | pod 'Bugly' 6 | end 7 | 8 | target ‘Capture’ do 9 | platform:ios,’8.0’ 10 | pod 'AVOSCloud' 11 | end 12 | --------------------------------------------------------------------------------