Explorar o código

1.修改iOS RedAnt Mobile Result增加下载活动指示器显示。
2.修改iOS RedAnt Mobile增加Retrieve Password点击事件处理。

Pen Li %!s(int64=8) %!d(string=hai) anos
pai
achega
3b3b4bd45a

+ 3 - 0
RedAnt Mobile/RedAnt Mobile/Base.lproj/Main.storyboard

@@ -222,6 +222,9 @@
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Sfr-OB-A5y">
                                 <rect key="frame" x="229" y="539" width="126" height="30"/>
                                 <state key="normal" title="Retrieve Password"/>
+                                <connections>
+                                    <action selector="retrieveBtnClick:" destination="Oh6-Jk-fWH" eventType="touchUpInside" id="eM7-4n-Oub"/>
+                                </connections>
                             </button>
                         </subviews>
                         <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>

+ 34 - 0
RedAnt Mobile/RedAnt Mobile/LoginViewController.m

@@ -316,6 +316,40 @@ static NSString *kLoginUserInfo = @"UserInfo";
     [self.navigationController pushViewController:loginSettingVC animated:false];
 }
 
+- (IBAction)retrieveBtnClick:(UIButton *)sender {
+    
+    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Retrieve Password" message:nil preferredStyle:UIAlertControllerStyleAlert];
+    
+    __block UITextField *userTextField;
+    [alertVC addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
+       
+        textField.placeholder = @"user name";
+        userTextField = textField;
+    }];
+    
+    __block UITextField *emailTextField;
+    [alertVC addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
+        
+        textField.placeholder = @"email address";
+        emailTextField = textField;
+    }];
+    
+    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
+        
+    }];
+    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        
+        NSLog(@"Retrieve Password\nuser: %@\nemail: %@",userTextField.text,emailTextField.text);
+        
+    }];
+    
+    [alertVC addAction:cancelAction];
+    [alertVC addAction:okAction];
+    
+    [self presentViewController:alertVC animated:YES completion:nil];
+    
+}
+
 #pragma mark - TextField Delegate 
 
 - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {

+ 58 - 5
RedAnt Mobile/RedAnt Mobile/RAResultViewController.m

@@ -429,6 +429,8 @@
         return;
     }
     
+    UIAlertController *alertVC = [self showIndicatorAlert];
+    
     __weak typeof(self) weakSelf = self;
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
         
@@ -439,11 +441,15 @@
         weakSelf.download_query = path;
         weakSelf.documentPath = path;
         
-        if (path) {
-            dispatch_async(dispatch_get_main_queue(), ^{
-                [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
-            });
-        }
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [alertVC dismissViewControllerAnimated:YES completion:^{
+                
+                if (path) {
+                    [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
+                }
+                
+            }];
+        });
         
     });
 }
@@ -474,4 +480,51 @@
     
 }
 
+#pragma mark - UI
+
+- (UIAlertController *)showIndicatorAlert {
+    
+    // show alert
+    UIAlertController *alertController = [UIAlertController alertControllerWithTitle: nil
+                                                                             message: @"loading..."
+                                                                      preferredStyle: UIAlertControllerStyleAlert];
+    
+    
+    
+    UIViewController *customVC     = [[UIViewController alloc] init];
+    
+    
+    UIActivityIndicatorView* spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
+    spinner.color = [UIColor darkGrayColor];
+    [spinner startAnimating];
+    [customVC.view addSubview:spinner];
+    
+    [customVC.view addConstraint:[NSLayoutConstraint
+                                  constraintWithItem: spinner
+                                  attribute:NSLayoutAttributeCenterX
+                                  relatedBy:NSLayoutRelationEqual
+                                  toItem:customVC.view
+                                  attribute:NSLayoutAttributeCenterX
+                                  multiplier:1.0f
+                                  constant:0.0f]];
+    
+    
+    
+    [customVC.view addConstraint:[NSLayoutConstraint
+                                  constraintWithItem: spinner
+                                  attribute:NSLayoutAttributeCenterY
+                                  relatedBy:NSLayoutRelationEqual
+                                  toItem:customVC.view
+                                  attribute:NSLayoutAttributeCenterY
+                                  multiplier:1.0f
+                                  constant:0.0f]];
+    
+    
+    [alertController setValue:customVC forKey:@"contentViewController"];
+    
+    [self presentViewController: alertController animated: YES completion: nil];
+    
+    return alertController;
+}
+
 @end

+ 9 - 0
RedAnt Mobile/RedAnt Mobile/SearchViewController.m

@@ -29,6 +29,15 @@
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
 }
+
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    
+    // 解决Items按钮灰色
+    self.navigationItem.rightBarButtonItem.enabled = false;
+    self.navigationItem.rightBarButtonItem.enabled = true;
+}
+
 #pragma mark - customize editor
 - (UIView*)get_tableHeader
 {