Browse Source

PDFTools(iOS) - 夜间模式的dark color 配置

yangliuhua 1 year ago
parent
commit
3e023cc9aa

+ 28 - 2
compdfkit-tools/compdfkit-tools.xcodeproj/project.pbxproj

@@ -7,6 +7,9 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		C949FEE329EE70D000C30A8D /* UIColor+Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = C949FEE129EE70D000C30A8D /* UIColor+Utils.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		C949FEE429EE70D000C30A8D /* UIColor+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = C949FEE229EE70D000C30A8D /* UIColor+Utils.m */; };
+		C9AF182629EE8AB600EC4979 /* UtilsColor.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C9AF182529EE8AB600EC4979 /* UtilsColor.xcassets */; };
 		C9B0CE1829E6486700524B7F /* ComPDFKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F313657129E4367A00EE6BBB /* ComPDFKit.xcframework */; };
 		F32DA16229ED904300E19ECA /* CPDFOutlineModel.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DA12229ED904300E19ECA /* CPDFOutlineModel.h */; };
 		F32DA16329ED904300E19ECA /* Image.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F32DA12329ED904300E19ECA /* Image.xcassets */; };
@@ -46,7 +49,6 @@
 		F32DA18529ED904300E19ECA /* CActivityIndicatorView.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DA15529ED904300E19ECA /* CActivityIndicatorView.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F32DA18629ED904300E19ECA /* Image.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F32DA15729ED904300E19ECA /* Image.xcassets */; };
 		F32DA18729ED904300E19ECA /* CPDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = F32DA15829ED904300E19ECA /* CPDFListView.m */; };
-		F32DA18829ED904300E19ECA /* Color.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F32DA15929ED904300E19ECA /* Color.xcassets */; };
 		F32DA18929ED904300E19ECA /* CPDFListView.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DA15A29ED904300E19ECA /* CPDFListView.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F32DA18A29ED904300E19ECA /* CPDFSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = F32DA15C29ED904300E19ECA /* CPDFSlider.m */; };
 		F32DA18B29ED904300E19ECA /* CPDFSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DA15D29ED904300E19ECA /* CPDFSlider.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -61,6 +63,9 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		C949FEE129EE70D000C30A8D /* UIColor+Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Utils.h"; sourceTree = "<group>"; };
+		C949FEE229EE70D000C30A8D /* UIColor+Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Utils.m"; sourceTree = "<group>"; };
+		C9AF182529EE8AB600EC4979 /* UtilsColor.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = UtilsColor.xcassets; sourceTree = "<group>"; };
 		F313657129E4367A00EE6BBB /* ComPDFKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ComPDFKit.xcframework; path = ../Lib/ComPDFKit.xcframework; sourceTree = "<group>"; };
 		F32DA12229ED904300E19ECA /* CPDFOutlineModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFOutlineModel.h; sourceTree = "<group>"; };
 		F32DA12329ED904300E19ECA /* Image.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Image.xcassets; sourceTree = "<group>"; };
@@ -127,6 +132,16 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		C949FEE029EE70D000C30A8D /* Utils */ = {
+			isa = PBXGroup;
+			children = (
+				C9AF182529EE8AB600EC4979 /* UtilsColor.xcassets */,
+				C949FEE129EE70D000C30A8D /* UIColor+Utils.h */,
+				C949FEE229EE70D000C30A8D /* UIColor+Utils.m */,
+			);
+			path = Utils;
+			sourceTree = "<group>";
+		};
 		F313657029E4367A00EE6BBB /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
@@ -250,6 +265,7 @@
 		F32DA14629ED904300E19ECA /* Common */ = {
 			isa = PBXGroup;
 			children = (
+				C949FEE029EE70D000C30A8D /* Utils */,
 				F32DA14729ED904300E19ECA /* Controls */,
 				F32DA14E29ED904300E19ECA /* Views */,
 			);
@@ -409,6 +425,7 @@
 				F32DA17029ED904300E19ECA /* CPDFThumbnailViewCell.h in Headers */,
 				F32DA17929ED904300E19ECA /* CPDFDisplayViewController.h in Headers */,
 				F32DA16C29ED904300E19ECA /* CPDFSearchResultsViewController.h in Headers */,
+				C949FEE329EE70D000C30A8D /* UIColor+Utils.h in Headers */,
 				F32DA16529ED904300E19ECA /* CPDFOutlineViewController.h in Headers */,
 				F32DA17829ED904300E19ECA /* CPDFDisplayTableViewCell.h in Headers */,
 				F32DA17129ED904300E19ECA /* CPDFThumbnailViewController.h in Headers */,
@@ -479,10 +496,10 @@
 				F32DA18629ED904300E19ECA /* Image.xcassets in Resources */,
 				F3E8495929E69712007BE967 /* DisplayImage.xcassets in Resources */,
 				F32DA17C29ED904300E19ECA /* DisplayImage.xcassets in Resources */,
-				F32DA18829ED904300E19ECA /* Color.xcassets in Resources */,
 				F32DA16329ED904300E19ECA /* Image.xcassets in Resources */,
 				F32DA18229ED904300E19ECA /* NavigationRightImage.xcassets in Resources */,
 				F32DA18C29ED904300E19ECA /* CPDFSliderImage.xcassets in Resources */,
+				C9AF182629EE8AB600EC4979 /* UtilsColor.xcassets in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -494,6 +511,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				F32DA17B29ED904300E19ECA /* CPDFDisplayViewController.m in Sources */,
+				C949FEE429EE70D000C30A8D /* UIColor+Utils.m in Sources */,
 				F32DA17F29ED904300E19ECA /* CNavigationController.m in Sources */,
 				F32DA17329ED904300E19ECA /* CPDFThumbnailViewController.m in Sources */,
 				F32DA16929ED904300E19ECA /* CPDFSearchResultsViewController.m in Sources */,
@@ -638,6 +656,8 @@
 		F335EE4F29E430C800ACC72A /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
 				DEFINES_MODULE = YES;
@@ -646,6 +666,7 @@
 				DYLIB_INSTALL_NAME_BASE = "@rpath";
 				FRAMEWORK_SEARCH_PATHS = "";
 				GENERATE_INFOPLIST_FILE = YES;
+				HEADER_SEARCH_PATHS = "";
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";
 				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
@@ -659,6 +680,7 @@
 				PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
 				SKIP_INSTALL = YES;
 				SWIFT_EMIT_LOC_STRINGS = YES;
+				SYSTEM_HEADER_SEARCH_PATHS = "";
 				TARGETED_DEVICE_FAMILY = "1,2";
 			};
 			name = Debug;
@@ -666,6 +688,8 @@
 		F335EE5029E430C800ACC72A /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
+				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
 				DEFINES_MODULE = YES;
@@ -674,6 +698,7 @@
 				DYLIB_INSTALL_NAME_BASE = "@rpath";
 				FRAMEWORK_SEARCH_PATHS = "";
 				GENERATE_INFOPLIST_FILE = YES;
+				HEADER_SEARCH_PATHS = "";
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";
 				INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
 				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
@@ -687,6 +712,7 @@
 				PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
 				SKIP_INSTALL = YES;
 				SWIFT_EMIT_LOC_STRINGS = YES;
+				SYSTEM_HEADER_SEARCH_PATHS = "";
 				TARGETED_DEVICE_FAMILY = "1,2";
 			};
 			name = Release;

+ 4 - 1
compdfkit-tools/compdfkit-tools/Common/Controls/BOTA/CPDFBOTAViewController.m

@@ -13,6 +13,7 @@
 #import "CPDFBOTAViewController.h"
 #import "CPDFThumbnailViewController.h"
 #import "CPDFOutlineViewController.h"
+#import "UIColor+Utils.h"
 
 #import <ComPDFKit/ComPDFKit.h>
 
@@ -85,7 +86,9 @@
     // Do any additional setup after loading the view.
     self.title = NSLocalizedString(@"BOTA", nil);
     
-    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
+    self.view.backgroundColor = [UIColor CPDFViewControllerBackgroundColor];
+    UIColor *color = [UIColor CPDFViewControllerBackgroundColor];
+    NSLog(@"%@", color);
     
     self.segmentedControl.selectedSegmentIndex = 0;
     [self.view addSubview:self.segmentedControl];

+ 24 - 0
compdfkit-tools/compdfkit-tools/Common/Utils/UIColor+Utils.h

@@ -0,0 +1,24 @@
+//
+//  UIColor+Utils.h
+//  compdfkit-tools
+//
+//  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+//
+//  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+//  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+//  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+//  This notice may not be removed from this file.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface UIColor (Utils)
+
++ (UIColor *)lightColor:(UIColor *)lightColor darkColor:(UIColor *)darkColor;
+
+
++ (UIColor *)CPDFViewControllerBackgroundColor;
+
+
+@end
+

+ 41 - 0
compdfkit-tools/compdfkit-tools/Common/Utils/UIColor+Utils.m

@@ -0,0 +1,41 @@
+//
+//  UIColor+Utils.m
+//  compdfkit-tools
+//
+//  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+//
+//  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+//  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+//  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+//  This notice may not be removed from this file.
+//
+
+#import "UIColor+Utils.h"
+
+@implementation UIColor (Utils)
+
++ (UIColor *)lightColor:(UIColor *)lightColor darkColor:(UIColor *)darkColor
+{
+    if (@available(iOS 13.0, *)) {
+         return [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull trait) {
+            if (trait.userInterfaceStyle == UIUserInterfaceStyleDark) {
+                return darkColor;
+            } else {
+                return lightColor;
+            }
+        }];
+    } else {
+        return lightColor;
+    }
+}
+
++ (UIColor *)CPDFViewControllerBackgroundColor
+{
+    if (@available(iOS 13.0, *)) {
+        return [UIColor colorNamed:@"CPDFViewControllerBackgroundColor" inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];
+    } else {
+        return [UIColor colorWithRed:0 green:122.0/255.0 blue:1.0 alpha:1.0];
+    }
+}
+
+@end

+ 38 - 0
compdfkit-tools/compdfkit-tools/Common/Utils/UtilsColor.xcassets/CPDFViewControllerBackgroundColor.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "255",
+          "green" : "255",
+          "red" : "255"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0",
+          "green" : "0",
+          "red" : "0"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 6 - 0
compdfkit-tools/compdfkit-tools/Common/Utils/UtilsColor.xcassets/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 2 - 1
compdfkit-tools/compdfkit-tools/Common/Views/PDFPageIndicatorView/CPDFPageIndicatorView.m

@@ -11,6 +11,7 @@
 //
 
 #import "CPDFPageIndicatorView.h"
+#import "UIColor+Utils.h"
 
 @interface CPDFPageIndicatorView()
 
@@ -36,7 +37,7 @@
         [self.pageNumButton setTitleColor:[UIColor systemTealColor] forState:UIControlStateNormal];
         self.indicatorCornerRadius = 5;
         
-        self.backgroundColor = [UIColor groupTableViewBackgroundColor];
+        self.backgroundColor = [UIColor CPDFViewControllerBackgroundColor];
     }
     return self;
 }

+ 1 - 1
compdfkit-tools/compdfkit-tools/Viewer/PDFMore/PDFInfo/CPDFInfoViewController.m

@@ -44,7 +44,7 @@
             self.view.backgroundColor = [UIColor colorWithRed:240/255. green:240/255. blue:240/255. alpha:1.];
         }
     } else {
-        // Fallback on earlier versions
+//         Fallback on earlier versions
         self.view.backgroundColor = [UIColor colorWithRed:240/255. green:240/255. blue:240/255. alpha:1.];
     }
 

+ 15 - 0
compdfkit-tools/compdfkit-tools/Viewer/PDFSearch/CPDFSearchResultsViewController.m

@@ -14,6 +14,7 @@
 #import "CPDFSearchViewCell.h"
 
 #import <ComPDFKit/ComPDFKit.h>
+#import <CoreText/CoreText.h>
 
 #define kTextSearch_Content_Length_Max 100
 
@@ -147,6 +148,20 @@
     return cell;
 }
 
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+    CPDFSelection *selection = self.resultArray[indexPath.section][indexPath.row];
+    NSAttributedString *attributeText = [self getAttributedStringWithSelection:selection];
+    
+    CGFloat cellWidth = tableView.frame.size.width;
+    UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10);
+    CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)attributeText);
+    CGSize suggestedSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetter, CFRangeMake(0, 0), NULL, CGSizeMake(cellWidth - padding.left - padding.right, CGFLOAT_MAX), NULL);
+    CGFloat cellHeight = suggestedSize.height + padding.top + padding.bottom;
+    CFRelease(framesetter);
+    
+    return cellHeight;
+}
+
 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
     return 30;
 }

+ 1 - 0
compdfkit-tools/compdfkit-tools/Viewer/PDFSearch/CPDFSearchViewCell.m

@@ -19,6 +19,7 @@
     if (self) {
         UILabel *contentLabel = [[UILabel alloc] initWithFrame:self.bounds];
         contentLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+        contentLabel.numberOfLines = 0;
         _contentLabel = contentLabel;
         [self.contentView addSubview:contentLabel];
     }

+ 8 - 11
compdfkit-tools/compdfkit-tools/Viewer/PDFSearch/CSearchToolbar.m

@@ -20,7 +20,7 @@
 
 #define offset 10
 
-@interface CSearchToolbar()<UISearchBarDelegate,CPDFSearchResultsDelegate>
+@interface CSearchToolbar()<UISearchBarDelegate>
 
 @property (nonatomic, strong) UIButton *searchListItem;
 
@@ -72,6 +72,9 @@
 - (void)showInView:(UIView *)subView {
     [subView addSubview:self];
     
+    self.frame = CGRectMake(0, 0, subView.bounds.size.width, 35);
+    self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    
     [self.searchBar becomeFirstResponder];
 }
 
@@ -116,6 +119,9 @@
 
             dispatch_async(dispatch_get_main_queue(), ^{
                 if ([block_self.resultArray count] < 1) {
+                    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
+                                                                           style:UIAlertActionStyleCancel
+                                                                         handler:nil];
                     UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
                                                                                    message:NSLocalizedString(@"Text not found!", nil)
                                                                             preferredStyle:UIAlertControllerStyleAlert];
@@ -124,6 +130,7 @@
                     if ([tRootViewControl presentedViewController])
                         tRootViewControl = [tRootViewControl presentedViewController];
                     
+                    [alert addAction:cancelAction];
                     [tRootViewControl presentViewController:alert animated:YES completion:nil];
                 } else {
                     block_self.nowRow = 0;
@@ -270,14 +277,4 @@
     [self beganSearchText:string];
 }
 
-- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar {
-    [searchBar resignFirstResponder];
-    
-    NSString *string = searchBar.text;
-    if ([string length] < 1)
-        return;
-    
-    [self beganSearchText:string];
-}
-
 @end

+ 2 - 0
compdfkit-tools/compdfkit-tools/compdfkit_tools.h

@@ -12,6 +12,8 @@
 
 #import <Foundation/Foundation.h>
 
+#import <compdfkit_tools/UIColor+Utils.h>
+
 // Navigtion
 #import <compdfkit_tools/CNavigationController.h>
 

+ 8 - 0
viewer-ctrl-demo/viewer-ctrl-demo.xcodeproj/project.pbxproj

@@ -14,6 +14,7 @@
 		C9413B1829E420C900F2CBF6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C9413B1729E420C900F2CBF6 /* Assets.xcassets */; };
 		C9413B1B29E420C900F2CBF6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C9413B1929E420C900F2CBF6 /* LaunchScreen.storyboard */; };
 		C9413B1E29E420C900F2CBF6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C9413B1D29E420C900F2CBF6 /* main.m */; };
+		C9AF182829EE8E1900EC4979 /* color.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C9AF182729EE8E1900EC4979 /* color.xcassets */; };
 		F313657629E4369500EE6BBB /* ComPDFKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F313657529E4369500EE6BBB /* ComPDFKit.xcframework */; };
 		F313657729E4369500EE6BBB /* ComPDFKit.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F313657529E4369500EE6BBB /* ComPDFKit.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		F313657C29E436B800EE6BBB /* Form_Widgets_Test.pdf in Resources */ = {isa = PBXBuildFile; fileRef = F313657929E436B800EE6BBB /* Form_Widgets_Test.pdf */; };
@@ -54,6 +55,7 @@
 		C9413B1A29E420C900F2CBF6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		C9413B1C29E420C900F2CBF6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		C9413B1D29E420C900F2CBF6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+		C9AF182729EE8E1900EC4979 /* color.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = color.xcassets; sourceTree = "<group>"; };
 		F313657529E4369500EE6BBB /* ComPDFKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ComPDFKit.xcframework; path = ../Lib/ComPDFKit.xcframework; sourceTree = "<group>"; };
 		F313657929E436B800EE6BBB /* Form_Widgets_Test.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = Form_Widgets_Test.pdf; sourceTree = "<group>"; };
 		F313657A29E436B800EE6BBB /* PDF32000_2008.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = PDF32000_2008.pdf; sourceTree = "<group>"; };
@@ -109,6 +111,7 @@
 				C9413B1929E420C900F2CBF6 /* LaunchScreen.storyboard */,
 				C9413B1C29E420C900F2CBF6 /* Info.plist */,
 				C9413B1D29E420C900F2CBF6 /* main.m */,
+				C9AF182729EE8E1900EC4979 /* color.xcassets */,
 			);
 			path = "viewer-ctrl-demo";
 			sourceTree = "<group>";
@@ -209,6 +212,7 @@
 				C9413B1B29E420C900F2CBF6 /* LaunchScreen.storyboard in Resources */,
 				C9413B1829E420C900F2CBF6 /* Assets.xcassets in Resources */,
 				F313657D29E436B800EE6BBB /* PDF32000_2008.pdf in Resources */,
+				C9AF182829EE8E1900EC4979 /* color.xcassets in Resources */,
 				F313657C29E436B800EE6BBB /* Form_Widgets_Test.pdf in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -358,10 +362,12 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+				CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = 4GGQPGRTSV;
 				GENERATE_INFOPLIST_FILE = YES;
+				HEADER_SEARCH_PATHS = "";
 				INFOPLIST_FILE = "viewer-ctrl-demo/Info.plist";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
@@ -385,10 +391,12 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+				CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = 4GGQPGRTSV;
 				GENERATE_INFOPLIST_FILE = YES;
+				HEADER_SEARCH_PATHS = "";
 				INFOPLIST_FILE = "viewer-ctrl-demo/Info.plist";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;

+ 6 - 16
viewer-ctrl-demo/viewer-ctrl-demo/CPDFViewController.m

@@ -48,7 +48,7 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     
-    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
+    self.view.backgroundColor = [UIColor CPDFViewControllerBackgroundColor];
     
     [self.view addSubview:self.pdfView];
     [self.view addSubview:self.pageSlider];
@@ -63,7 +63,7 @@
 - (CPDFView *)pdfView {
     if(!_pdfView) {
         _pdfView = [[CPDFView alloc]initWithFrame:self.view.bounds];
-        _pdfView.backgroundColor = [UIColor groupTableViewBackgroundColor];
+        _pdfView.backgroundColor = [UIColor CPDFViewControllerBackgroundColor];
         _pdfView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
         _pdfView.delegate = self;
     }
@@ -93,15 +93,6 @@
     return _rightView;
 }
 
-- (UIActivityIndicatorView *)loadingView {
-    if (!_loadingView) {
-        _loadingView = [[CActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
-        _loadingView.center = self.view.center;
-        _loadingView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
-    }
-    return _loadingView;
-}
-
 - (CSearchToolbar *)searchToolbar {
     if (!_searchToolbar) {
         _searchToolbar = [[CSearchToolbar alloc]initWithPDFView:self.pdfView];
@@ -219,10 +210,9 @@
 #pragma mark - Action
 
 - (void)navigationRightItemSearch {
-    self.searchToolbar.frame = CGRectMake(0, 0, self.navigationController.view.bounds.size.width, 35);
-    self.searchToolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
-    
-    self.navigationItem.titleView = self.searchToolbar;
+    [self.searchToolbar showInView:self.navigationController.navigationBar];
+//    self.navigationItem.titleView = self.searchToolbar;
+    self.title = nil;
     self.navigationItem.rightBarButtonItem = nil;
 }
 
@@ -274,7 +264,7 @@
                                                                style:UIAlertActionStyleCancel
                                                              handler:nil];
         UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
-                                                                       message:NSLocalizedString(@"You haven't entered the keyword yet", nil)
+                                                                       message:NSLocalizedString(@"your have‘t search result", nil)
                                                                 preferredStyle:UIAlertControllerStyleAlert];
         [alert addAction:cancelAction];
         [self presentViewController:alert animated:YES completion:nil];

+ 38 - 0
viewer-ctrl-demo/viewer-ctrl-demo/UtilsColor.xcassets/CPDFViewControllerBackgroundColor.colorset/Contents.json

@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "255",
+          "green" : "255",
+          "red" : "255"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0",
+          "green" : "0",
+          "red" : "0"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 6 - 0
viewer-ctrl-demo/viewer-ctrl-demo/UtilsColor.xcassets/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}