Преглед на файлове

text view allows you to set the alignment and display it in the editing interface according to the alignment -- text view 允许设置对齐,并在编辑界面按对齐方式显示 (resolve: #14784)

Ray Zhang преди 4 години
родител
ревизия
ab74e5b0d4

+ 11 - 10
Ants Contract/Granite Expo eSign/2021 GECI - Home Improvement Contract.json

@@ -202,6 +202,7 @@
       "pos_x": 617.474609375
     },
     "control_0": {
+        "textAlignment": "left",
       "width": 168.99998474121094,
       "tv_vmargin": 0,
       "aname": "Customer Name",
@@ -944,7 +945,7 @@
   "page_3": {
     "control_12": {
       "disable": false,
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 213.82489013671875,
       "pos_y": 867.0966186523438,
       "aname": "Sign Date",
@@ -959,7 +960,7 @@
       "pos_x": 440.7741394042969
     },
     "control_7": {
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 389.3087158203125,
       "tv_vmargin": "0.4",
       "aname": "Contractor",
@@ -1037,7 +1038,7 @@
       "name": "Change Contractor Signature"
     },
     "control_14": {
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 390.7833557128906,
       "tv_vmargin": "0.4",
       "aname": "New Contractor",
@@ -1113,7 +1114,7 @@
     "count": 16,
     "control_8": {
       "disable": false,
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 389.3087463378906,
       "pos_y": 651.7972412109375,
       "aname": "Job Date",
@@ -1129,7 +1130,7 @@
       "pos_x": 261.6036682128906
     },
     "control_5": {
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 389.3087463378906,
       "tv_vmargin": "0.4",
       "aname": "Customer Name",
@@ -1338,7 +1339,7 @@
       "pos_x": 115.61286926269531
     },
     "control_13": {
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 390.7833557128906,
       "tv_vmargin": "0.4",
       "aname": "Original Contractor",
@@ -1398,7 +1399,7 @@
       "pos_x": 260.8663024902344
     },
     "control_9": {
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 110.59906768798828,
       "tv_vmargin": "0.4",
       "aname": "Contract No",
@@ -1431,7 +1432,7 @@
       "pos_x": 115.61283874511719
     },
     "control_6": {
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 389.3087463378906,
       "tv_vmargin": "0.4",
       "aname": "Location Of Work",
@@ -1448,7 +1449,7 @@
     },
     "control_3": {
       "disable": false,
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 389.3087463378906,
       "pos_y": 600.921630859375,
       "aname": "Date",
@@ -1463,7 +1464,7 @@
       "pos_x": 261.6036682128906
     },
     "control_10": {
-      "textAlignment": "left",
+      "textAlignment": "center",
       "width": 210.13824462890625,
       "tv_vmargin": "0.4",
       "aname": "Change Order No",

+ 2 - 2
Ants Contract/Granite Expo eSign/Granite Expo eSign.xcodeproj/project.pbxproj

@@ -919,7 +919,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				CURRENT_PROJECT_VERSION = 49913;
+				CURRENT_PROJECT_VERSION = 49919;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "Granite Expo eSign/Info.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
@@ -934,7 +934,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				CURRENT_PROJECT_VERSION = 49913;
+				CURRENT_PROJECT_VERSION = 49919;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "Granite Expo eSign/Info.plist";
 				IPHONEOS_DEPLOYMENT_TARGET = 12.0;

+ 17 - 0
Ants Contract/common/PageViewController.m

@@ -526,6 +526,8 @@ typedef enum {
         text=@" ";
     tv.text =text;
     
+    
+    
     float tv_vmargin= [template[@"tv_vmargin"] floatValue];
     NSString* capital= template[@"capital"];
     UITextAutocapitalizationType capitalType=UITextAutocapitalizationTypeWords;
@@ -551,6 +553,16 @@ typedef enum {
     NSMutableAttributedString* attr_str= [tv.attributedText mutableCopy];
     
     NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
+    
+    NSString * alignment=template[@"textAlignment"];
+    paragraphStyle.alignment=NSTextAlignmentLeft; // 默认左对齐
+    if([alignment.lowercaseString isEqualToString:@"center"])
+        paragraphStyle.alignment=NSTextAlignmentCenter;
+    else if([alignment.lowercaseString isEqualToString:@"left"])
+        paragraphStyle.alignment=NSTextAlignmentLeft;
+    else if([alignment.lowercaseString isEqualToString:@"right"])
+        paragraphStyle.alignment=NSTextAlignmentRight;
+    
     if(tv_vmargin!=0)
         paragraphStyle.lineHeightMultiple = tv_vmargin;
 //    paragraphStyle.maximumLineHeight = 25.f;
@@ -559,6 +571,11 @@ typedef enum {
 //    paragraphStyle.alignment = NSTextAlignmentJustified;
     [attr_str addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,attr_str.length)];
     
+    
+    
+
+    
+    
     tv.attributedText=attr_str;
     if([text isEqualToString:(@" ")])
         tv.text=@"";