Explorar o código

Portfolio编辑增加判断是否有选择编辑项,若没有则隐藏保存按钮。

Pen Li %!s(int64=9) %!d(string=hai) anos
pai
achega
fc62251f5e

BIN=BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 43 - 3
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioEditQTYViewController.m

@@ -12,6 +12,10 @@
 #define NUMBERS @"0123456789.\n"
 @interface PortfolioEditQTYViewController ()
 
+@property (nonatomic,assign) int checkedCount;
+@property (strong, nonatomic) IBOutlet UIButton *saveButton;
+
+
 @end
 
 @implementation PortfolioEditQTYViewController
@@ -20,8 +24,10 @@
     [super viewDidLoad];
     
     self.edgesForExtendedLayout = UIRectEdgeNone;
+    self.checkedCount = 0;
+    self.saveButton.hidden = YES;
+    [self addObserver:self forKeyPath:@"checkedCount" options:NSKeyValueObservingOptionNew context:nil];
     
-
     self.tv_linenote.delegate = self;
      self.tv_linenote.text=self.linenotes ;
     if(self.qty>=0)
@@ -215,7 +221,6 @@
     bool qtypercentage = self.switchQTY.isOn;
     
     
-    
     if (!self.qtyCheckButton.selected) {
         self.qty = -INT32_MAX;
         self.qty_p = -MAXFLOAT;
@@ -558,7 +563,13 @@
     sender.selected = !sender.selected;
 
     self.editQTY.enabled = sender.selected;
-
+    
+    if (sender.selected) {
+        self.checkedCount++;
+    } else {
+        self.checkedCount--;
+    }
+    
 }
 
 - (IBAction)priceCheckButtonClicked:(id)sender {
@@ -568,6 +579,11 @@
         
         self.editPrice.enabled = btn.selected;
         
+        if (btn.selected) {
+            self.checkedCount++;
+        } else {
+            self.checkedCount--;
+        }
     }
 }
 
@@ -575,11 +591,35 @@
     sender.selected = !sender.selected;
     
     self.editDiscount.enabled = sender.selected;
+    if (sender.selected) {
+        self.checkedCount++;
+    } else {
+        self.checkedCount--;
+    }
+
 }
 - (IBAction)lineNoteCheckButtonClicked:(UIButton *)sender {
     sender.selected = !sender.selected;
     
     self.tv_linenote.editable = sender.selected;
+    if (sender.selected) {
+        self.checkedCount++;
+    } else {
+        self.checkedCount--;
+    }
+
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
+    if ([keyPath isEqualToString:@"checkedCount"]) {
+        
+        self.saveButton.hidden = self.checkedCount == 0;
+        
+    }
+}
+
+-(void)dealloc {
+    [self removeObserver:self forKeyPath:@"checkedCount"];
 }
 
 @end

+ 2 - 1
RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard

@@ -509,7 +509,7 @@
                                                     <rect key="frame" x="571" y="50" width="160" height="21"/>
                                                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                                                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+                                                    <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                             </subviews>
@@ -8521,6 +8521,7 @@ Email: redantsupport@united-us.net</string>
                         <outlet property="noticeLabel" destination="2Ua-7e-VO4" id="e8P-Yb-g7Z"/>
                         <outlet property="priceCheckButton" destination="Aox-mC-YWC" id="erc-y9-qUu"/>
                         <outlet property="qtyCheckButton" destination="ucr-Oq-foo" id="oLl-af-Ydt"/>
+                        <outlet property="saveButton" destination="xnN-1o-b5j" id="SOU-I3-K0G"/>
                         <outlet property="switchQTY" destination="QTc-m9-3Z6" id="ZK8-T2-a64"/>
                         <outlet property="tv_linenote" destination="DaX-ZG-fqt" id="12T-jx-hdw"/>
                     </connections>