Prechádzať zdrojové kódy

PDFViewer(ios) - ui的基本设计(下拉列表后续补充)

dengkang 2 rokov pred
rodič
commit
4ae7822154

+ 147 - 22
PDFViewer.xcodeproj/project.pbxproj

@@ -20,9 +20,25 @@
 		EC6297B8292239A700D339EE /* CPDFModel.m in Sources */ = {isa = PBXBuildFile; fileRef = EC6297B7292239A700D339EE /* CPDFModel.m */; };
 		EC6297BD292239C200D339EE /* CPDFListController.m in Sources */ = {isa = PBXBuildFile; fileRef = EC6297BC292239C200D339EE /* CPDFListController.m */; };
 		ECC8831D2923352B00F6392E /* CPDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECC8831C2923352B00F6392E /* CPDFViewController.m */; };
-		ECE3196F2923888800DB9D2F /* CPDFWatermarkController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECE3196E2923888800DB9D2F /* CPDFWatermarkController.m */; };
-		ECE319722923895C00DB9D2F /* CPDFWatermarkView.m in Sources */ = {isa = PBXBuildFile; fileRef = ECE319712923895C00DB9D2F /* CPDFWatermarkView.m */; };
-		ECE319742924849C00DB9D2F /* pdfImage@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = ECE319732924849C00DB9D2F /* pdfImage@2x.png */; };
+		ECD0ABF02928ED9A0091B6EB /* CPDFTextPreview.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABE52928ED990091B6EB /* CPDFTextPreview.m */; };
+		ECD0ABF12928ED9A0091B6EB /* CPDFPageRangeDropDownList.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABE62928ED990091B6EB /* CPDFPageRangeDropDownList.m */; };
+		ECD0ABF32928ED9A0091B6EB /* CPDFImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABE82928ED990091B6EB /* CPDFImageView.m */; };
+		ECD0ABF42928ED9A0091B6EB /* CPDFTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABEA2928ED990091B6EB /* CPDFTextView.m */; };
+		ECD0ABF52928ED9A0091B6EB /* CPDFImagePreview.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABEC2928ED9A0091B6EB /* CPDFImagePreview.m */; };
+		ECD0AC132928EECB0091B6EB /* MASConstraintMaker.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABFB2928EECA0091B6EB /* MASConstraintMaker.m */; };
+		ECD0AC142928EECB0091B6EB /* NSLayoutConstraint+MASDebugAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABFE2928EECA0091B6EB /* NSLayoutConstraint+MASDebugAdditions.m */; };
+		ECD0AC152928EECB0091B6EB /* MASLayoutConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0ABFF2928EECA0091B6EB /* MASLayoutConstraint.m */; };
+		ECD0AC162928EECB0091B6EB /* NSArray+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC002928EECA0091B6EB /* NSArray+MASAdditions.m */; };
+		ECD0AC172928EECB0091B6EB /* MASConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC022928EECA0091B6EB /* MASConstraint.m */; };
+		ECD0AC182928EECB0091B6EB /* MASCompositeConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC032928EECA0091B6EB /* MASCompositeConstraint.m */; };
+		ECD0AC192928EECB0091B6EB /* MASViewConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC062928EECA0091B6EB /* MASViewConstraint.m */; };
+		ECD0AC1A2928EECB0091B6EB /* ViewController+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC092928EECA0091B6EB /* ViewController+MASAdditions.m */; };
+		ECD0AC1C2928EECB0091B6EB /* View+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC0D2928EECA0091B6EB /* View+MASAdditions.m */; };
+		ECD0AC1D2928EECB0091B6EB /* MASViewAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC112928EECB0091B6EB /* MASViewAttribute.m */; };
+		ECD0AC202928EF260091B6EB /* btn_selected.png in Resources */ = {isa = PBXBuildFile; fileRef = ECD0AC1F2928EF260091B6EB /* btn_selected.png */; };
+		ECD0AC232928F2A70091B6EB /* CPDFTextViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC222928F2A70091B6EB /* CPDFTextViewController.m */; };
+		ECD0AC262928F2E50091B6EB /* CPDFImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC252928F2E50091B6EB /* CPDFImageViewController.m */; };
+		ECD0AC32292B56C90091B6EB /* CPDFDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = ECD0AC31292B56C90091B6EB /* CPDFDataModel.m */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -60,10 +76,48 @@
 		EC6297BC292239C200D339EE /* CPDFListController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFListController.m; sourceTree = "<group>"; };
 		ECC8831B2923352B00F6392E /* CPDFViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFViewController.h; sourceTree = "<group>"; };
 		ECC8831C2923352B00F6392E /* CPDFViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFViewController.m; sourceTree = "<group>"; };
-		ECE3196D2923888800DB9D2F /* CPDFWatermarkController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFWatermarkController.h; sourceTree = "<group>"; };
-		ECE3196E2923888800DB9D2F /* CPDFWatermarkController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFWatermarkController.m; sourceTree = "<group>"; };
-		ECE319702923895C00DB9D2F /* CPDFWatermarkView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFWatermarkView.h; sourceTree = "<group>"; };
-		ECE319712923895C00DB9D2F /* CPDFWatermarkView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFWatermarkView.m; sourceTree = "<group>"; };
+		ECD0ABE52928ED990091B6EB /* CPDFTextPreview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFTextPreview.m; sourceTree = "<group>"; };
+		ECD0ABE62928ED990091B6EB /* CPDFPageRangeDropDownList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFPageRangeDropDownList.m; sourceTree = "<group>"; };
+		ECD0ABE82928ED990091B6EB /* CPDFImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFImageView.m; sourceTree = "<group>"; };
+		ECD0ABE92928ED990091B6EB /* CPDFTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFTextView.h; sourceTree = "<group>"; };
+		ECD0ABEA2928ED990091B6EB /* CPDFTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFTextView.m; sourceTree = "<group>"; };
+		ECD0ABEB2928ED9A0091B6EB /* CPDFImagePreview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFImagePreview.h; sourceTree = "<group>"; };
+		ECD0ABEC2928ED9A0091B6EB /* CPDFImagePreview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFImagePreview.m; sourceTree = "<group>"; };
+		ECD0ABED2928ED9A0091B6EB /* CPDFImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFImageView.h; sourceTree = "<group>"; };
+		ECD0ABEE2928ED9A0091B6EB /* CPDFPageRangeDropDownList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFPageRangeDropDownList.h; sourceTree = "<group>"; };
+		ECD0ABEF2928ED9A0091B6EB /* CPDFTextPreview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFTextPreview.h; sourceTree = "<group>"; };
+		ECD0ABF92928EECA0091B6EB /* NSArray+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MASAdditions.h"; sourceTree = "<group>"; };
+		ECD0ABFA2928EECA0091B6EB /* View+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "View+MASAdditions.h"; sourceTree = "<group>"; };
+		ECD0ABFB2928EECA0091B6EB /* MASConstraintMaker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASConstraintMaker.m; sourceTree = "<group>"; };
+		ECD0ABFC2928EECA0091B6EB /* MASConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASConstraint.h; sourceTree = "<group>"; };
+		ECD0ABFD2928EECA0091B6EB /* MASConstraint+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MASConstraint+Private.h"; sourceTree = "<group>"; };
+		ECD0ABFE2928EECA0091B6EB /* NSLayoutConstraint+MASDebugAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSLayoutConstraint+MASDebugAdditions.m"; sourceTree = "<group>"; };
+		ECD0ABFF2928EECA0091B6EB /* MASLayoutConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASLayoutConstraint.m; sourceTree = "<group>"; };
+		ECD0AC002928EECA0091B6EB /* NSArray+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+MASAdditions.m"; sourceTree = "<group>"; };
+		ECD0AC012928EECA0091B6EB /* NSArray+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+MASShorthandAdditions.h"; sourceTree = "<group>"; };
+		ECD0AC022928EECA0091B6EB /* MASConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASConstraint.m; sourceTree = "<group>"; };
+		ECD0AC032928EECA0091B6EB /* MASCompositeConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASCompositeConstraint.m; sourceTree = "<group>"; };
+		ECD0AC042928EECA0091B6EB /* MASLayoutConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASLayoutConstraint.h; sourceTree = "<group>"; };
+		ECD0AC052928EECA0091B6EB /* NSLayoutConstraint+MASDebugAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSLayoutConstraint+MASDebugAdditions.h"; sourceTree = "<group>"; };
+		ECD0AC062928EECA0091B6EB /* MASViewConstraint.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASViewConstraint.m; sourceTree = "<group>"; };
+		ECD0AC072928EECA0091B6EB /* MASConstraintMaker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASConstraintMaker.h; sourceTree = "<group>"; };
+		ECD0AC082928EECA0091B6EB /* Masonry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Masonry.h; sourceTree = "<group>"; };
+		ECD0AC092928EECA0091B6EB /* ViewController+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "ViewController+MASAdditions.m"; sourceTree = "<group>"; };
+		ECD0AC0A2928EECA0091B6EB /* ViewController+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ViewController+MASAdditions.h"; sourceTree = "<group>"; };
+		ECD0AC0C2928EECA0091B6EB /* MASCompositeConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASCompositeConstraint.h; sourceTree = "<group>"; };
+		ECD0AC0D2928EECA0091B6EB /* View+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "View+MASAdditions.m"; sourceTree = "<group>"; };
+		ECD0AC0E2928EECB0091B6EB /* MASViewConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASViewConstraint.h; sourceTree = "<group>"; };
+		ECD0AC0F2928EECB0091B6EB /* MASUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASUtilities.h; sourceTree = "<group>"; };
+		ECD0AC102928EECB0091B6EB /* MASViewAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASViewAttribute.h; sourceTree = "<group>"; };
+		ECD0AC112928EECB0091B6EB /* MASViewAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASViewAttribute.m; sourceTree = "<group>"; };
+		ECD0AC122928EECB0091B6EB /* View+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "View+MASShorthandAdditions.h"; sourceTree = "<group>"; };
+		ECD0AC1F2928EF260091B6EB /* btn_selected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = btn_selected.png; sourceTree = "<group>"; };
+		ECD0AC212928F2A70091B6EB /* CPDFTextViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFTextViewController.h; sourceTree = "<group>"; };
+		ECD0AC222928F2A70091B6EB /* CPDFTextViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFTextViewController.m; sourceTree = "<group>"; };
+		ECD0AC242928F2E50091B6EB /* CPDFImageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFImageViewController.h; sourceTree = "<group>"; };
+		ECD0AC252928F2E50091B6EB /* CPDFImageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFImageViewController.m; sourceTree = "<group>"; };
+		ECD0AC30292B56C90091B6EB /* CPDFDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFDataModel.h; sourceTree = "<group>"; };
+		ECD0AC31292B56C90091B6EB /* CPDFDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFDataModel.m; sourceTree = "<group>"; };
 		ECE319732924849C00DB9D2F /* pdfImage@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pdfImage@2x.png"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
@@ -107,16 +161,16 @@
 		EC62978B29220F8300D339EE /* PDFViewer */ = {
 			isa = PBXGroup;
 			children = (
+				ECD0ABF62928EE9A0091B6EB /* Masonry */,
 				EC6297B52922393F00D339EE /* Controller */,
 				EC6297AD29222D3100D339EE /* Model */,
-				EC6297AE29222D4400D339EE /* View */,
+				ECD0ABE42928ED5D0091B6EB /* View */,
 				EC62978C29220F8300D339EE /* AppDelegate.h */,
 				EC62978D29220F8300D339EE /* AppDelegate.m */,
 				EC62978F29220F8300D339EE /* SceneDelegate.h */,
 				EC62979029220F8300D339EE /* SceneDelegate.m */,
 				EC62979229220F8300D339EE /* ViewController.h */,
 				EC62979329220F8300D339EE /* ViewController.m */,
-				ECE319732924849C00DB9D2F /* pdfImage@2x.png */,
 				EC62979529220F8300D339EE /* Main.storyboard */,
 				EC62979829220F8400D339EE /* Assets.xcassets */,
 				EC62979A29220F8400D339EE /* LaunchScreen.storyboard */,
@@ -131,19 +185,12 @@
 			children = (
 				EC6297B6292239A700D339EE /* CPDFModel.h */,
 				EC6297B7292239A700D339EE /* CPDFModel.m */,
+				ECD0AC30292B56C90091B6EB /* CPDFDataModel.h */,
+				ECD0AC31292B56C90091B6EB /* CPDFDataModel.m */,
 			);
 			path = Model;
 			sourceTree = "<group>";
 		};
-		EC6297AE29222D4400D339EE /* View */ = {
-			isa = PBXGroup;
-			children = (
-				ECE319702923895C00DB9D2F /* CPDFWatermarkView.h */,
-				ECE319712923895C00DB9D2F /* CPDFWatermarkView.m */,
-			);
-			path = View;
-			sourceTree = "<group>";
-		};
 		EC6297B52922393F00D339EE /* Controller */ = {
 			isa = PBXGroup;
 			children = (
@@ -152,12 +199,73 @@
 				EC6297BC292239C200D339EE /* CPDFListController.m */,
 				ECC8831B2923352B00F6392E /* CPDFViewController.h */,
 				ECC8831C2923352B00F6392E /* CPDFViewController.m */,
-				ECE3196D2923888800DB9D2F /* CPDFWatermarkController.h */,
-				ECE3196E2923888800DB9D2F /* CPDFWatermarkController.m */,
+				ECD0AC212928F2A70091B6EB /* CPDFTextViewController.h */,
+				ECD0AC222928F2A70091B6EB /* CPDFTextViewController.m */,
+				ECD0AC242928F2E50091B6EB /* CPDFImageViewController.h */,
+				ECD0AC252928F2E50091B6EB /* CPDFImageViewController.m */,
 			);
 			path = Controller;
 			sourceTree = "<group>";
 		};
+		ECD0ABE42928ED5D0091B6EB /* View */ = {
+			isa = PBXGroup;
+			children = (
+				ECD0AC1E2928EF030091B6EB /* sources */,
+				ECD0ABEB2928ED9A0091B6EB /* CPDFImagePreview.h */,
+				ECD0ABEC2928ED9A0091B6EB /* CPDFImagePreview.m */,
+				ECD0ABED2928ED9A0091B6EB /* CPDFImageView.h */,
+				ECD0ABE82928ED990091B6EB /* CPDFImageView.m */,
+				ECD0ABEE2928ED9A0091B6EB /* CPDFPageRangeDropDownList.h */,
+				ECD0ABE62928ED990091B6EB /* CPDFPageRangeDropDownList.m */,
+				ECD0ABEF2928ED9A0091B6EB /* CPDFTextPreview.h */,
+				ECD0ABE52928ED990091B6EB /* CPDFTextPreview.m */,
+				ECD0ABE92928ED990091B6EB /* CPDFTextView.h */,
+				ECD0ABEA2928ED990091B6EB /* CPDFTextView.m */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
+		ECD0ABF62928EE9A0091B6EB /* Masonry */ = {
+			isa = PBXGroup;
+			children = (
+				ECD0AC0C2928EECA0091B6EB /* MASCompositeConstraint.h */,
+				ECD0AC032928EECA0091B6EB /* MASCompositeConstraint.m */,
+				ECD0ABFC2928EECA0091B6EB /* MASConstraint.h */,
+				ECD0AC022928EECA0091B6EB /* MASConstraint.m */,
+				ECD0ABFD2928EECA0091B6EB /* MASConstraint+Private.h */,
+				ECD0AC072928EECA0091B6EB /* MASConstraintMaker.h */,
+				ECD0ABFB2928EECA0091B6EB /* MASConstraintMaker.m */,
+				ECD0AC042928EECA0091B6EB /* MASLayoutConstraint.h */,
+				ECD0ABFF2928EECA0091B6EB /* MASLayoutConstraint.m */,
+				ECD0AC082928EECA0091B6EB /* Masonry.h */,
+				ECD0AC0F2928EECB0091B6EB /* MASUtilities.h */,
+				ECD0AC102928EECB0091B6EB /* MASViewAttribute.h */,
+				ECD0AC112928EECB0091B6EB /* MASViewAttribute.m */,
+				ECD0AC0E2928EECB0091B6EB /* MASViewConstraint.h */,
+				ECD0AC062928EECA0091B6EB /* MASViewConstraint.m */,
+				ECD0ABF92928EECA0091B6EB /* NSArray+MASAdditions.h */,
+				ECD0AC002928EECA0091B6EB /* NSArray+MASAdditions.m */,
+				ECD0AC012928EECA0091B6EB /* NSArray+MASShorthandAdditions.h */,
+				ECD0AC052928EECA0091B6EB /* NSLayoutConstraint+MASDebugAdditions.h */,
+				ECD0ABFE2928EECA0091B6EB /* NSLayoutConstraint+MASDebugAdditions.m */,
+				ECD0ABFA2928EECA0091B6EB /* View+MASAdditions.h */,
+				ECD0AC0D2928EECA0091B6EB /* View+MASAdditions.m */,
+				ECD0AC122928EECB0091B6EB /* View+MASShorthandAdditions.h */,
+				ECD0AC0A2928EECA0091B6EB /* ViewController+MASAdditions.h */,
+				ECD0AC092928EECA0091B6EB /* ViewController+MASAdditions.m */,
+			);
+			path = Masonry;
+			sourceTree = "<group>";
+		};
+		ECD0AC1E2928EF030091B6EB /* sources */ = {
+			isa = PBXGroup;
+			children = (
+				ECE319732924849C00DB9D2F /* pdfImage@2x.png */,
+				ECD0AC1F2928EF260091B6EB /* btn_selected.png */,
+			);
+			path = sources;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -218,6 +326,7 @@
 				EC62979C29220F8400D339EE /* LaunchScreen.storyboard in Resources */,
 				C96D13932924793800CC92C7 /* btn_more.png in Resources */,
 				EC62979929220F8400D339EE /* Assets.xcassets in Resources */,
+				ECD0AC202928EF260091B6EB /* btn_selected.png in Resources */,
 				EC62979729220F8300D339EE /* Main.storyboard in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -231,13 +340,29 @@
 			files = (
 				ECC8831D2923352B00F6392E /* CPDFViewController.m in Sources */,
 				EC62979429220F8300D339EE /* ViewController.m in Sources */,
+				ECD0AC172928EECB0091B6EB /* MASConstraint.m in Sources */,
 				EC6297B8292239A700D339EE /* CPDFModel.m in Sources */,
-				ECE3196F2923888800DB9D2F /* CPDFWatermarkController.m in Sources */,
+				ECD0AC232928F2A70091B6EB /* CPDFTextViewController.m in Sources */,
+				ECD0AC262928F2E50091B6EB /* CPDFImageViewController.m in Sources */,
+				ECD0ABF02928ED9A0091B6EB /* CPDFTextPreview.m in Sources */,
+				ECD0AC1D2928EECB0091B6EB /* MASViewAttribute.m in Sources */,
+				ECD0AC182928EECB0091B6EB /* MASCompositeConstraint.m in Sources */,
+				ECD0AC1C2928EECB0091B6EB /* View+MASAdditions.m in Sources */,
+				ECD0AC152928EECB0091B6EB /* MASLayoutConstraint.m in Sources */,
 				EC62978E29220F8300D339EE /* AppDelegate.m in Sources */,
 				EC62979F29220F8400D339EE /* main.m in Sources */,
 				EC6297BD292239C200D339EE /* CPDFListController.m in Sources */,
-				ECE319722923895C00DB9D2F /* CPDFWatermarkView.m in Sources */,
+				ECD0AC132928EECB0091B6EB /* MASConstraintMaker.m in Sources */,
+				ECD0AC1A2928EECB0091B6EB /* ViewController+MASAdditions.m in Sources */,
+				ECD0AC142928EECB0091B6EB /* NSLayoutConstraint+MASDebugAdditions.m in Sources */,
+				ECD0ABF12928ED9A0091B6EB /* CPDFPageRangeDropDownList.m in Sources */,
+				ECD0AC162928EECB0091B6EB /* NSArray+MASAdditions.m in Sources */,
+				ECD0AC192928EECB0091B6EB /* MASViewConstraint.m in Sources */,
 				EC62979129220F8300D339EE /* SceneDelegate.m in Sources */,
+				ECD0ABF52928ED9A0091B6EB /* CPDFImagePreview.m in Sources */,
+				ECD0AC32292B56C90091B6EB /* CPDFDataModel.m in Sources */,
+				ECD0ABF42928ED9A0091B6EB /* CPDFTextView.m in Sources */,
+				ECD0ABF32928ED9A0091B6EB /* CPDFImageView.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

BIN
PDFViewer.xcodeproj/project.xcworkspace/xcuserdata/kdan.xcuserdatad/UserInterfaceState.xcuserstate


+ 9 - 0
PDFViewer/Controller/CPDFImageViewController.h

@@ -7,10 +7,19 @@
 
 #import <UIKit/UIKit.h>
 
+
+@class CPDFImagePreview;
+@class CPDFImageView;
+
 NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFImageViewController : UIViewController
 
+@property (nonatomic,strong) CPDFImagePreview *imagePreview;
+@property (nonatomic,strong) CPDFImageView *imageView;
+
+- (void)addTargets;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 20 - 8
PDFViewer/Controller/CPDFImageViewController.m

@@ -6,6 +6,9 @@
 //
 
 #import "CPDFImageViewController.h"
+#import "CPDFImageView.h"
+#import "CPDFImagePreview.h"
+#import "Masonry.h"
 
 @interface CPDFImageViewController ()
 
@@ -16,16 +19,25 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
+    _imagePreview = [[CPDFImagePreview alloc] init];
+    _imageView = [[CPDFImageView alloc] init];
+
+    [self.view addSubview:_imagePreview];
+    [self.view addSubview:_imageView];
+    
+    UIEdgeInsets previewPadding = UIEdgeInsetsMake(0, 0, self.view.bounds.size.height / 3, 0);
+    [_imagePreview mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.edges.equalTo(self.view).with.insets(previewPadding);
+    }];
+
+    UIEdgeInsets imageViewPadding = UIEdgeInsetsMake(430, 0, 0, 0);
+    [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.edges.equalTo(self.view).with.insets(imageViewPadding);
+    }];
 }
 
-/*
-#pragma mark - Navigation
-
-// In a storyboard-based application, you will often want to do a little preparation before navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
-    // Get the new view controller using [segue destinationViewController].
-    // Pass the selected object to the new view controller.
+- (void)addTargets {
+    
 }
-*/
 
 @end

+ 11 - 0
PDFViewer/Controller/CPDFTextViewController.h

@@ -7,10 +7,21 @@
 
 #import <UIKit/UIKit.h>
 
+
+@class CPDFTextPreview;
+@class CPDFTextView;
+@class CPDFDataModel;
+
 NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFTextViewController : UIViewController
 
+@property (nonatomic,strong) CPDFTextPreview *textPreview;
+@property (nonatomic,strong) CPDFTextView *textView;
+@property (nonatomic,strong) CPDFDataModel *dataModel;
+
+- (void)addTargets;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 61 - 7
PDFViewer/Controller/CPDFTextViewController.m

@@ -6,6 +6,10 @@
 //
 
 #import "CPDFTextViewController.h"
+#import "CPDFTextView.h"
+#import "CPDFTextPreview.h"
+#import "CPDFDataModel.h"
+#import "Masonry.h"
 
 @interface CPDFTextViewController ()
 
@@ -16,16 +20,66 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
+    
+    _textPreview = [[CPDFTextPreview alloc] init];
+    _textView = [[CPDFTextView alloc] init];
+    _dataModel = [[CPDFDataModel alloc] init];
+    
+    [self.view addSubview:_textPreview];
+    [self.view addSubview:_textView];
+    
+    UIEdgeInsets previewPadding = UIEdgeInsetsMake(0, 0, self.view.bounds.size.height / 3, 0);
+    [_textPreview mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.edges.equalTo(self.view).with.insets(previewPadding);
+    }];
+
+    UIEdgeInsets textViewPadding = UIEdgeInsetsMake(430, 0, 0, 0);
+    [_textView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.edges.equalTo(self.view).with.insets(textViewPadding);
+    }];
+    [self addTargets];
+}
+
+- (void)addTargets {
+    
+    for (NSInteger i = 0; i < _textView.colorArray.count; ++i) {
+        [_textView.colorArray[i] addTarget:self action:@selector(onColorBtnClicked:) forControlEvents:UIControlEventTouchDown];
+    }
+    
+    [_textView.opacitySlider addTarget:self action:@selector(onOpacityChanged:) forControlEvents:UIControlEventValueChanged];
+    [_textView.textScaleSlider addTarget:self action:@selector(onTextScaleChanged:) forControlEvents:UIControlEventValueChanged];
+    [_textView.tileSwitch addTarget:self action:@selector(onTileSwitchChanged:) forControlEvents:UIControlEventValueChanged];
+}
+
+- (void)onColorBtnClicked:(UIButton *)sender {
+    _textPreview.watermarkLabel.textColor = sender.backgroundColor;
+    [_dataModel setTextColor:sender.backgroundColor];
+}
+
+- (void)onOpacityChanged:(UISlider *)sender {
+    _textPreview.watermarkLabel.alpha =  1 - sender.value;
+    [_dataModel setWatermarkOpacity:1 - sender.value];
 }
 
-/*
-#pragma mark - Navigation
+- (void)onTextScaleChanged:(UISlider *)sender {
+    sender.minimumValue = 24;
+    sender.maximumValue = 70;
+    _textPreview.watermarkLabel.font = [_textPreview.watermarkLabel.font fontWithSize:sender.value];
+    [_textPreview.watermarkLabel sizeToFit];
+    CGRect frame = _textPreview.watermarkLabel.frame;
+    frame.origin = CGPointMake(_textPreview.bounds.size.width / 2 - _textPreview.watermarkLabel.frame.size.width / 2, _textPreview.bounds.size.height / 2 - _textPreview.watermarkLabel.frame.size.height / 2);
+    _textPreview.watermarkLabel.frame = frame;
+    
+    _textPreview.rotationBtn.frame = CGRectMake(_textPreview.bounds.size.width / 2 + _textPreview.watermarkLabel.frame.size.width / 2 - 10, _textPreview.bounds.size.height / 2 + _textPreview.watermarkLabel.frame.size.height / 2 - 10, 20, 20);
+    [_dataModel setWatermarkScale:sender.value / 24];
+}
 
-// In a storyboard-based application, you will often want to do a little preparation before navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
-    // Get the new view controller using [segue destinationViewController].
-    // Pass the selected object to the new view controller.
+- (void)onTileSwitchChanged:(UISwitch *) sender {
+    if ([sender isOn]) {
+        _dataModel.isTile = YES;
+    } else {
+        _dataModel.isTile = NO;
+    }
 }
-*/
 
 @end

+ 4 - 0
PDFViewer/Controller/CPDFViewController.h

@@ -7,13 +7,17 @@
 
 #import <UIKit/UIKit.h>
 
+
 NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFViewController : UIViewController
 
 @property (nonatomic,copy) NSString *path;
+@property (nonatomic,strong) UISegmentedControl *segmentedControl;
 
 - (instancetype)initWithPath:(NSString *)inPath;
+- (void)createView;
+- (void)createFrame;
 
 @end
 

+ 111 - 5
PDFViewer/Controller/CPDFViewController.m

@@ -10,9 +10,26 @@
 #import <ComPDFKit/CPDFWatermark.h>
 #import <ComPDFKit/CPDFHeaderFooter.h>
 #import "CPDFViewController.h"
+#import "CPDFTextViewController.h"
+#import "CPDFImageViewController.h"
+#import "CPDFTextView.h"
+#import "CPDFTextPreview.h"
+#import "CPDFImageView.h"
+#import "CPDFImagePreview.h"
+#import "CPDFDataModel.h"
+#import "Masonry.h"
+
+#define KSCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width
+#define KSCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
 
 @interface CPDFViewController () <UIActionSheetDelegate>
 
+@property (nonatomic,strong) CPDFTextViewController *textViewController;
+@property (nonatomic,strong) CPDFImageViewController *imageViewController;
+@property (nonatomic,strong) CPDFView *pdfView;
+@property (nonatomic,strong) CPDFWatermark *textWatermark;
+@property (nonatomic,strong) CPDFWatermark *imageWatermark;
+
 @end
 
 @implementation CPDFViewController
@@ -35,17 +52,83 @@
     //setting URL
     NSURL *url = [NSURL fileURLWithPath:_path];
     CPDFDocument *document = [[CPDFDocument alloc] initWithURL:url];
-    CPDFView *pdfView = [[CPDFView alloc] initWithFrame:self.view.bounds];
-    pdfView.document = document;
-    pdfView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    _pdfView = [[CPDFView alloc] initWithFrame:self.view.bounds];
+    _pdfView.document = document;
+    _pdfView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    [self.view addSubview:_pdfView];
+}
 
-   [self.view addSubview:pdfView];
+- (void)createView {
+    NSArray *segmentArray = @[@"Text",@"Image"];
+    _segmentedControl = [[UISegmentedControl alloc] initWithItems:segmentArray];
+    
+    [_segmentedControl addTarget:self action:@selector(segmentedAction:) forControlEvents:UIControlEventValueChanged];
+    
+    _segmentedControl.selectedSegmentIndex = 0;
+    
+    [_segmentedControl setBackgroundColor:[UIColor whiteColor]];
+    
+    _textViewController = [[CPDFTextViewController alloc] init];
+    _imageViewController = [[CPDFImageViewController alloc] init];
+    
+    [self addChildViewController:_textViewController];
+    [self addChildViewController:_imageViewController];
+    
+    [self.view addSubview:_segmentedControl];
+    [self.view addSubview:_textViewController.view];
+    [self.view addSubview:_imageViewController.view];
+    
+    CPDFPage *pdfPage = [_pdfView.document pageAtIndex:0];
+      CGSize size = [_pdfView.document pageSizeAtIndex:0];
+    _textViewController.textPreview.documentView.image = [pdfPage thumbnailOfSize:size];
+    _imageViewController.imagePreview.documentView.image = [pdfPage thumbnailOfSize:size];
+    _imageViewController.view.hidden = YES;
+    _pdfView.hidden = YES;
+    
+    _textWatermark = [[CPDFWatermark alloc] initWithDocument:_pdfView.document type:CPDFWatermarkTypeText];
+    _imageWatermark = [[CPDFWatermark alloc] initWithDocument:_pdfView.document type:CPDFWatermarkTypeImage];
+}
+
+- (void)segmentedAction:(UISegmentedControl *)sender {
+    switch(sender.selectedSegmentIndex) {
+        case 0:
+            _textViewController.view.hidden = NO;
+            _imageViewController.view.hidden = YES;
+            break;
+        case 1:
+            _textViewController.view.hidden = YES;
+            _imageViewController.view.hidden = NO;
+            break;
+        default:
+            break;
+    }
+}
+
+- (void)createFrame {
+    NSSet *set = [UIApplication sharedApplication].connectedScenes;
+    UIWindowScene *windowScene = [set anyObject];
+    UIStatusBarManager *statusBarManager = windowScene.statusBarManager;
+    _segmentedControl.frame = CGRectMake(0, statusBarManager.statusBarFrame.size.height + self.navigationController.navigationBar.frame.size
+                                         .height, KSCREEN_WIDTH, KSCREEN_HEIGHT / 20);
+    _segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
+    
+    UIEdgeInsets padding = UIEdgeInsetsMake(statusBarManager.statusBarFrame.size.height + self.navigationController.navigationBar.frame.size
+                                            .height + KSCREEN_HEIGHT / 20, 0, 0, 0);
+    [_textViewController.view mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.edges.equalTo(self.view).with.insets(padding);
+    }];
+    [_imageViewController.view mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.edges.equalTo(self.view).with.insets(padding);
+    }];
 }
 
 - (void)onClickedOkbtn {
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
     UIAlertAction *addWatermarkAction = [UIAlertAction actionWithTitle:@"Add Watermark" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-            NSLog(@"addWatermarkAction");
+        [self createView];
+        [self createFrame];
+        UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(onClickedDoneBtn)];
+        self.navigationItem.rightBarButtonItem = doneBtn;
         }];
     UIAlertAction *addHeaderfooterAction = [UIAlertAction actionWithTitle:@"Add Headerfooter" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
             NSLog(@"addHeaderfooterAction");
@@ -59,4 +142,27 @@
     [self presentViewController:alertController animated:YES completion:nil];
 }
 
+- (void)onClickedDoneBtn {
+    
+    self.navigationItem.rightBarButtonItem = nil;
+    _pdfView.hidden = NO;
+    _textViewController.view.hidden = YES;
+    _imageViewController.view.hidden = YES;
+    _segmentedControl.hidden = YES;
+    
+    if (_segmentedControl.selectedSegmentIndex == 0) {
+        _textWatermark.text = @"Watermark";
+        _textWatermark.textColor = _textViewController.dataModel.textColor;
+        _textWatermark.opacity = _textViewController.dataModel.watermarkOpacity;
+        _textWatermark.scale = _textViewController.dataModel.watermarkScale;
+        _textWatermark.isTilePage = _textViewController.dataModel.isTile;
+        [_pdfView.document addWatermark:_textWatermark];
+        
+    } else {
+        
+        
+        [_pdfView.document addWatermark:_imageWatermark];
+    }
+}
+
 @end

+ 32 - 0
PDFViewer/Model/CPDFDataModel.h

@@ -0,0 +1,32 @@
+//
+//  CPDFDataModel.h
+//  PDFViewer
+//
+//  Created by kdan on 2022/11/21.
+//
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface CPDFDataModel : NSObject
+
+@property (nonatomic,copy) NSString *text;
+@property (nonatomic,strong) UIColor *textColor;
+
+@property (nonatomic,assign) CGFloat watermarkOpacity;
+@property (nonatomic,assign) CGFloat watermarkScale;
+@property (nonatomic,assign) BOOL isTile;
+@property (nonatomic,assign) NSRange pageRange;
+@property (nonatomic,assign) CGFloat tx;
+@property (nonatomic,assign) CGFloat ty;
+@property (nonatomic,assign) CGFloat watermarkRotation;
+@property (nonatomic,assign) CGFloat tileVerticalSpacing;
+@property (nonatomic,assign) CGFloat tileHorizontalSpacing;
+
+@property (nonatomic,copy) NSString *imagePath;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 19 - 0
PDFViewer/Model/CPDFDataModel.m

@@ -0,0 +1,19 @@
+//
+//  CPDFDataModel.m
+//  PDFViewer
+//
+//  Created by kdan on 2022/11/21.
+//
+
+#import "CPDFDataModel.h"
+
+@implementation CPDFDataModel
+
+-(instancetype)init {
+    if (self = [super init]) {
+        _textColor = [[UIColor alloc] init];
+    }
+    return self;
+}
+
+@end

+ 4 - 0
PDFViewer/View/CPDFImagePreview.h

@@ -11,6 +11,10 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFImagePreview : UIView
 
+@property (nonatomic,strong) UIImageView *watermarkView;
+@property (nonatomic,strong) UIButton *rotationBtn;
+@property (nonatomic,strong) UIImageView *documentView;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 43 - 6
PDFViewer/View/CPDFImagePreview.m

@@ -6,15 +6,52 @@
 //
 
 #import "CPDFImagePreview.h"
+#import "Masonry.h"
 
 @implementation CPDFImagePreview
 
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect {
-    // Drawing code
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    if (self = [super initWithFrame:frame]) {
+        _watermarkView = [[UIImageView alloc] init];
+        _rotationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+        _documentView = [[UIImageView alloc] init];
+
+        [self addSubview:_documentView];
+        [_documentView addSubview:_watermarkView];
+        [_documentView addSubview:_rotationBtn];
+    }
+    return self;
+}
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    [_watermarkView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.center.equalTo(self);
+        make.centerX.equalTo(self);
+        make.centerY.equalTo(self);
+        make.width.equalTo(@100);
+        make.height.equalTo(@100);
+    }];
+    _watermarkView.layer.borderColor = UIColor.blackColor.CGColor;
+    _watermarkView.layer.borderWidth = 2;
+    _watermarkView.image = [UIImage imageNamed:@"btn_selected"];
+    
+    [_rotationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.watermarkView).offset(90);
+        make.bottom.equalTo(self.watermarkView).offset(10);
+        make.right.equalTo(self.watermarkView).offset(10);
+        make.left.equalTo(self.watermarkView).offset(90);
+        make.width.equalTo(@20);
+        make.height.equalTo(@20);
+    }];
+    
+    _rotationBtn.layer.cornerRadius = 10;
+    _rotationBtn.layer.masksToBounds = YES;
+    _rotationBtn.layer.borderColor = UIColor.blueColor.CGColor;
+    [_rotationBtn setBackgroundImage:[UIImage imageNamed:@"btn_selected"] forState:UIControlStateNormal];
+    
+    _documentView.frame = self.bounds;
 }
-*/
 
 @end

+ 18 - 0
PDFViewer/View/CPDFImageView.h

@@ -11,6 +11,24 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFImageView : UIView
 
+@property (nonatomic,strong) UIButton *selectBtn;
+@property (nonatomic,strong) UISlider *imageScaleSlider;
+@property (nonatomic,strong) UISlider *opacitySlider;
+@property (nonatomic,strong) UISwitch *tileSwitch;
+@property (nonatomic,strong) UILabel *rangeLabel;
+@property (nonatomic,strong) UILabel *tileLabel;
+@property (nonatomic,strong) UILabel *sizeLabel;
+@property (nonatomic,strong) UILabel *opacityLabel;
+@property (nonatomic,strong) UITextField *verticalField;
+@property (nonatomic,strong) UITextField *horizontalField;
+@property (nonatomic,strong) UILabel *verticalLabel;
+@property (nonatomic,strong) UILabel *horizontalLabel;
+@property (nonatomic,strong) UILabel *imageLabel;
+
+- (void)createView;
+- (void)createFrame;
+- (void)assignData;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 106 - 0
PDFViewer/View/CPDFImageView.m

@@ -6,9 +6,115 @@
 //
 
 #import "CPDFImageView.h"
+#import "Masonry.h"
+
+#define KSCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width
+#define KSCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
+
 
 @implementation CPDFImageView
 
+- (instancetype)initWithFrame:(CGRect)frame {
+    
+    if (self = [super initWithFrame:frame]) {
+        [self createView];
+        [self assignData];
+    }
+    
+    return self;
+}
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    [self createFrame];
+//    [self addConstraint];
+}
+
+- (void)createView {
+    
+    _opacitySlider = [[UISlider alloc] init];
+    _imageScaleSlider = [[UISlider alloc] init];
+    _tileSwitch = [[UISwitch alloc] init];
+    _rangeLabel = [[UILabel alloc] init];
+    _tileLabel = [[UILabel alloc] init];
+    _sizeLabel = [[UILabel alloc] init];
+    _opacityLabel = [[UILabel alloc] init];
+    
+    _verticalField = [[UITextField alloc] init];
+    _verticalField.borderStyle = UITextBorderStyleRoundedRect;
+    
+    _verticalLabel = [[UILabel alloc] init];
+    
+    _horizontalField = [[UITextField alloc] init];
+    _horizontalField.borderStyle = UITextBorderStyleRoundedRect;
+    
+    _horizontalLabel = [[UILabel alloc] init];
+    _imageLabel = [[UILabel alloc] init];
+    _selectBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
+    
+    [self addSubview:_opacitySlider];
+    [self addSubview:_sizeLabel];
+    [self addSubview:_opacityLabel];
+    [self addSubview:_imageScaleSlider];
+    [self addSubview:_tileSwitch];
+    [self addSubview:_rangeLabel];
+    [self addSubview:_tileLabel];
+    [self addSubview:_verticalLabel];
+    [self addSubview:_verticalField];
+    [self addSubview:_horizontalField];
+    [self addSubview:_horizontalLabel];
+    [self addSubview:_imageLabel];
+    [self addSubview:_selectBtn];
+    
+    [self setBackgroundColor:[UIColor whiteColor]];
+    
+}
+
+- (void)createFrame {
+    // y -- 40   height -- 30
+    _opacitySlider.frame = CGRectMake(90, 40, KSCREEN_WIDTH - 100, 30);
+    _imageScaleSlider.frame = CGRectMake(90, 80, KSCREEN_WIDTH - 100, 30);
+    _tileSwitch.frame = CGRectMake(100, 160, 10, 10);
+    _rangeLabel.frame = CGRectMake(10, 120, 100, 30);
+    _tileLabel.frame = CGRectMake(10, 160, 100, 30);
+    _sizeLabel.frame = CGRectMake(10, 80, 90, 30);
+    _opacityLabel.frame = CGRectMake(10, 40, 90, 30);
+    _verticalLabel.frame = CGRectMake(270, 160, 20, 30);
+    _verticalField.frame = CGRectMake(295, 160, 80, 30);
+    _horizontalLabel.frame = CGRectMake(165, 160, 20, 30);
+    _horizontalField.frame = CGRectMake(185, 160, 80, 30);
+    _selectBtn.frame = CGRectMake(150, 2, 227, 35);
+    _imageLabel.frame = CGRectMake(10, 5, 150, 30);
+    
+    _selectBtn.layer.borderWidth = 1.0;
+    _selectBtn.layer.borderColor = UIColor.blackColor.CGColor;
+    [_selectBtn setTitle:@"Select Image" forState:UIControlStateNormal];
+    [_selectBtn setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
+    _selectBtn.layer.cornerRadius = 7;
+}
+
+//- (void)addConstraint {
+//    [self.opacityLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+//        make.left.equalTo(self).offset(10);
+//        make.top.equalTo(self).offset(40);
+//        make.right.equalTo(self.mas_right).offset(-10);
+//    }];
+//    [self.opacitySlider mas_makeConstraints:^(MASConstraintMaker *make) {
+//        make.left.equalTo(self.mas_left).offset(90);
+//        make.top.equalTo(self.mas_top).offset(40);
+//        make.width.equalTo(@(KSCREEN_WIDTH - 100));
+//        make.height.equalTo(@30);
+//    }];
+//}
 
+- (void)assignData {
+    _rangeLabel.text = @"Page Range";
+    _tileLabel.text = @"Full Screen";
+    _sizeLabel.text = @"Image Size";
+    _opacityLabel.text = @"Opacity";
+    _verticalLabel.text = @"Y:";
+    _horizontalLabel.text = @"X:";
+    _imageLabel.text = @"Image";
+}
 
 @end

+ 1 - 0
PDFViewer/View/CPDFTextPreview.h

@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic,strong) UILabel *watermarkLabel;
 @property (nonatomic,strong) UIButton *rotationBtn;
+@property (nonatomic,strong) UIImageView *documentView;
 
 @end
 

+ 27 - 5
PDFViewer/View/CPDFTextPreview.m

@@ -6,6 +6,7 @@
 //
 
 #import "CPDFTextPreview.h"
+#import "Masonry.h"
 
 @implementation CPDFTextPreview
 
@@ -14,25 +15,46 @@
     if (self = [super initWithFrame:frame]) {
         _watermarkLabel = [[UILabel alloc] init];
         _rotationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-        [self addSubview:_watermarkLabel];
-        [self addSubview:_rotationBtn];
+        _documentView = [[UIImageView alloc] init];
+
+        [self addSubview:_documentView];
+        [_documentView addSubview:_watermarkLabel];
+        [_documentView addSubview:_rotationBtn];
     }
     return self;
 }
 
 - (void)layoutSubviews {
     [super layoutSubviews];
-    _watermarkLabel.frame = CGRectMake(self.bounds.size.width / 2 - 45, self.bounds.size.height / 2 - 20, 90, 40);
+
     _watermarkLabel.layer.borderWidth = 2;
     _watermarkLabel.layer.borderColor = UIColor.blackColor.CGColor;
-    _watermarkLabel.text = @" Watermark";
+    _watermarkLabel.text = @"Watermark";
     _watermarkLabel.textColor = UIColor.redColor;
+    _watermarkLabel.font = [UIFont systemFontOfSize:24];
+    
+    [_watermarkLabel sizeToFit];
+    CGRect frame = _watermarkLabel.frame;
+    frame.origin = CGPointMake(self.bounds.size.width / 2 - _watermarkLabel.frame.size.width / 2, self.bounds.size.height / 2 - _watermarkLabel.frame.size.height / 2);
+    _watermarkLabel.frame = frame;
     
-    _rotationBtn.frame = CGRectMake(self.bounds.size.width / 2 + 45 - 10, self.bounds.size.height / 2 + 20 - 10, 20, 20);
     _rotationBtn.layer.cornerRadius = 10;
     _rotationBtn.layer.masksToBounds = YES;
     _rotationBtn.layer.borderColor = UIColor.blueColor.CGColor;
     [_rotationBtn setBackgroundImage:[UIImage imageNamed:@"btn_selected"] forState:UIControlStateNormal];
+    
+//    [_rotationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+//        make.top.equalTo(self.watermarkLabel).offset(self.watermarkLabel.frame.size.height - 10);
+//        make.bottom.equalTo(self.watermarkLabel).offset(10);
+//        make.right.equalTo(self.watermarkLabel).offset(20);
+//        make.left.equalTo(self.watermarkLabel).offset(self.watermarkLabel.frame.size.width);
+//        make.width.equalTo(@20);
+//        make.height.equalTo(@20);
+//    }];
+    _rotationBtn.frame = CGRectMake(self.bounds.size.width / 2 + _watermarkLabel.frame.size.width / 2 - 10, self.bounds.size.height / 2 + _watermarkLabel.frame.size.height / 2 - 10, 20, 20);
+    
+    _documentView.frame = self.bounds;
+    _documentView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
 }
 
 @end

+ 19 - 2
PDFViewer/View/CPDFTextView.m

@@ -6,6 +6,7 @@
 //
 
 #import "CPDFTextView.h"
+#import "Masonry.h"
 
 #define KSCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width
 #define KSCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height
@@ -28,6 +29,7 @@
 - (void)layoutSubviews {
     [super layoutSubviews];
     [self createFrame];
+//    [self addConstraint];
 }
 
 - (void)createView {
@@ -51,7 +53,7 @@
     _horizontalLabel = [[UILabel alloc] init];
     
     _colorArray = [NSMutableArray array];
-    for (NSInteger i = 0; i < 7; ++i) {
+    for (NSInteger i = 0; i < 8; ++i) {
         _colorBtn = [UIButton buttonWithType:UIButtonTypeSystem];
         [_colorArray addObject:_colorBtn];
         [self addSubview:_colorBtn];
@@ -88,7 +90,7 @@
     _horizontalLabel.frame = CGRectMake(165, 160, 20, 30);
     _horizontalField.frame = CGRectMake(185, 160, 80, 30);
     
-    NSInteger offset = 50;
+    NSInteger offset = 10;
     for (NSInteger i = 0; i < _colorArray.count; i++) {
         [[self colorArray][i] setFrame:CGRectMake(offset, 5, KBUTTON_WIDTH, KBUTTON_HEIGHT)];
         offset += 50;
@@ -103,8 +105,23 @@
     [_colorArray[4] setBackgroundColor:[UIColor blueColor]];
     [_colorArray[5] setBackgroundColor:[UIColor brownColor]];
     [_colorArray[6] setBackgroundColor:[UIColor purpleColor]];
+    [_colorArray[7] setBackgroundColor:[UIColor grayColor]];
 }
 
+//- (void)addConstraint {
+//    [self.opacityLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+//        make.left.equalTo(self).offset(10);
+//        make.top.equalTo(self).offset(40);
+//        make.right.equalTo(self.mas_right).offset(-10);
+//    }];
+//    [self.opacitySlider mas_makeConstraints:^(MASConstraintMaker *make) {
+//        make.left.equalTo(self.mas_left).offset(90);
+//        make.top.equalTo(self.mas_top).offset(40);
+//        make.width.equalTo(@(KSCREEN_WIDTH - 100));
+//        make.height.equalTo(@30);
+//    }];
+//}
+
 - (void)assignData {
     _rangeLabel.text = @"Page Range";
     _tileLabel.text = @"Full Screen";