Przeglądaj źródła

1.修改iOS Apex CRM增加网址输入。

Pen Li 7 lat temu
rodzic
commit
ab8d3a847b

+ 26 - 9
RedAnt CRM/APEX CRM/APEX CRM/Base.lproj/Main.storyboard

@@ -34,15 +34,6 @@
                         <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kfy-n6-Izt">
-                                <rect key="frame" x="43" y="140" width="80" height="40"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="18"/>
-                                <state key="normal" title="Ray"/>
-                                <connections>
-                                    <action selector="onClick:" destination="BYZ-38-t0r" eventType="touchUpInside" id="tFY-i5-7fW"/>
-                                </connections>
-                            </button>
                             <button opaque="NO" tag="1" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JRK-sO-VHR">
                                 <rect key="frame" x="58" y="229" width="55" height="34"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
@@ -70,11 +61,37 @@
                                     <action selector="onClick:" destination="BYZ-38-t0r" eventType="touchUpInside" id="pos-Hr-REZ"/>
                                 </connections>
                             </button>
+                            <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="CLC-dd-eZQ">
+                                <rect key="frame" x="15" y="108" width="384" height="30"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="30" id="uHY-Ff-rgb"/>
+                                </constraints>
+                                <nil key="textColor"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <textInputTraits key="textInputTraits"/>
+                            </textField>
+                            <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kfy-n6-Izt">
+                                <rect key="frame" x="46" y="168" width="80" height="40"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="18"/>
+                                <state key="normal" title="Ray"/>
+                                <connections>
+                                    <action selector="onClick:" destination="BYZ-38-t0r" eventType="touchUpInside" id="tFY-i5-7fW"/>
+                                </connections>
+                            </button>
                         </subviews>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="CLC-dd-eZQ" secondAttribute="trailing" constant="15" id="3oA-Kd-6Me"/>
+                            <constraint firstItem="CLC-dd-eZQ" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="20" id="Flw-ys-JKD"/>
+                            <constraint firstItem="CLC-dd-eZQ" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="15" id="ZX4-qi-UiU"/>
+                        </constraints>
                         <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
                     </view>
                     <navigationItem key="navigationItem" id="C2f-WF-qb3"/>
+                    <connections>
+                        <outlet property="urlInputField" destination="CLC-dd-eZQ" id="lhR-gN-Fhv"/>
+                    </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
             </objects>

+ 29 - 1
RedAnt CRM/APEX CRM/APEX CRM/ViewController.m

@@ -10,6 +10,8 @@
 #import "WKWebTestViewController.h"
 @interface ViewController ()
 
+@property (nonatomic,weak) IBOutlet UITextField *urlInputField;
+
 @end
 
 @implementation ViewController
@@ -17,7 +19,33 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view, typically from a nib.
+    
+    UIButton *goBtn = [UIButton buttonWithType:UIButtonTypeSystem];
+    goBtn.frame = CGRectMake(0, 0, 50, 30);
+    [goBtn setTitle:@"Go" forState:UIControlStateNormal];
+    [goBtn addTarget:self action:@selector(goBtnClick:) forControlEvents:UIControlEventTouchUpInside];
+    goBtn.backgroundColor = [UIColor redColor];
+
+    self.urlInputField.rightView = goBtn;
+    self.urlInputField.rightViewMode = UITextFieldViewModeAlways;
+    
+    NSString *url = [[NSUserDefaults standardUserDefaults] valueForKey:@"url"];
+    self.urlInputField.text = url;
+}
+
+- (IBAction)goBtnClick:(id)sender {
+    
+    NSString *url = self.urlInputField.text;
+    
+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+    [defaults setObject:url forKey:@"url"];
+    [defaults synchronize];
+    
+    WKWebTestViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"WKWebTestViewController"];
+    vc.url = url;
+    [self.navigationController pushViewController:vc animated:YES];
 }
+
 - (IBAction)onClick:(id)sender {
     
     
@@ -40,7 +68,7 @@
             vc.url=@"http://192.168.1.108:8081/j/crm/mobile/login";
             break;
         case 2:
-             vc.url=@"http://www.dcloud.io/hellomui/";
+             vc.url=@"http://192.168.0.110:8080/j/crm/mobile/login"; // @"http://www.dcloud.io/hellomui/"
             break;
         case 3: