فهرست منبع

修复通讯录搜索框按钮看不到的bug

fancy 5 سال پیش
والد
کامیت
6f3176e65f

+ 10 - 6
o2ios/O2Platform/App/Contact-通讯录/View/UnitBreadcrumbViewCell.swift

@@ -66,12 +66,16 @@ class UnitBreadcrumbViewCell: UITableViewCell {
                     }
                 })
             }
-            var size = self.breadcrumbScrollView.contentSize;
-            size.width = oX;
-            self.breadcrumbScrollView.showsHorizontalScrollIndicator = true;
-            self.breadcrumbScrollView.contentSize = size;
-            self.breadcrumbScrollView.bounces = true;
-            
+            var size = self.breadcrumbScrollView.contentSize
+            size.width = oX
+            self.breadcrumbScrollView.showsHorizontalScrollIndicator = true
+            self.breadcrumbScrollView.contentSize = size
+            self.breadcrumbScrollView.bounces = true
+            //滚动到底部
+            if self.breadcrumbScrollView.contentSize.width > self.breadcrumbScrollView.bounds.size.width {
+                let point = CGPoint(x: self.breadcrumbScrollView.contentSize.width - self.breadcrumbScrollView.bounds.size.width + self.breadcrumbScrollView.contentInset.right, y: 0)
+                self.breadcrumbScrollView.setContentOffset(point, animated: true)
+            }
         }
     }
 

+ 10 - 5
o2ios/O2Platform/App/Work-工作/c/TodoTaskViewController.swift

@@ -107,12 +107,17 @@ class TodoTaskViewController: UITableViewController {
         self.searchController.dimsBackgroundDuringPresentation = false
         self.searchController.hidesNavigationBarDuringPresentation = false
         definesPresentationContext = true
+        UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).title = "取消"
+        let attrs =  [NSAttributedString.Key.font: UIFont.init(name: "PingFangTC-Light", size: 14) ?? UIFont.systemFont(ofSize: 14),
+         NSAttributedString.Key.foregroundColor: O2ThemeManager.color(for: "Base.base_color") ?? UIColor.red]
+        UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(attrs, for: .normal)
+        self.searchController.searchBar.searchBarStyle = UISearchBar.Style.minimal
         self.searchController.searchBar.sizeToFit()
-        self.searchController.searchBar.backgroundColor = RGB(251, g: 71, b: 71)
-        self.searchController.searchBar.setImage(UIImage(named: "contact_search"), for: .search, state: .normal)
-        if let searchField = self.searchController.searchBar.value(forKey: "searchField") as? UITextField {
-            searchField.textColor = .white
-        }
+//        self.searchController.searchBar.backgroundColor = RGB(251, g: 71, b: 71)
+//        self.searchController.searchBar.setImage(UIImage(named: "contact_search"), for: .search, state: .normal)
+//        if let searchField = self.searchController.searchBar.value(forKey: "searchField") as? UITextField {
+//            searchField.textColor = .white
+//        }
         //设置搜索框是否显示
         self.setSearchBarIsShow()
         

+ 17 - 17
o2ios/O2Platform/App/contacts/c/ContactHomeViewController.swift

@@ -83,11 +83,11 @@ class ContactHomeViewController: UITableViewController {
         searchController.searchResultsUpdater = self
         
         searchController.dimsBackgroundDuringPresentation = false
-        //searchController.hidesNavigationBarDuringPresentation = false
+        searchController.hidesNavigationBarDuringPresentation = false
         
         UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).title = "取消"
-        let textFont = UIFont(name: "PingFangTC-Light", size: 14.0)
-        let attrs = [NSAttributedString.Key.font: textFont!]
+        let attrs =  [NSAttributedString.Key.font: UIFont.init(name: "PingFangTC-Light", size: 14) ?? UIFont.systemFont(ofSize: 14),
+         NSAttributedString.Key.foregroundColor: O2ThemeManager.color(for: "Base.base_color") ?? UIColor.red]
         UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(attrs, for: .normal)
         
         searchController.searchBar.searchBarStyle = UISearchBar.Style.minimal
@@ -241,7 +241,7 @@ class ContactHomeViewController: UITableViewController {
                     DDLogError("error message =\(value["message"])")
                 }
             case .failure(let err):
-                DDLogDebug(err as? String ?? "未知错误")
+                DDLogError(err.localizedDescription)
             }
         }
     }
@@ -372,33 +372,33 @@ class ContactHomeViewController: UITableViewController {
 extension ContactHomeViewController:UISearchControllerDelegate{
     func willPresentSearchController(_ searchController: UISearchController) {
         NSLog("willPresentSearchController")
-        searchController.searchBar.searchBarStyle = UISearchBar.Style.default
-        self.tableView.mj_header.isHidden = true
+//        searchController.searchBar.searchBarStyle = UISearchBar.Style.default
+//        self.tableView.mj_header.isHidden = true
         
     }
     
     func didPresentSearchController(_ searchController: UISearchController) {
         NSLog("didPresentSearchController")
-        UIView.animate(withDuration: 0.1, animations:{
-            ()-> Void in
-            self.tableView.contentInset = UIEdgeInsets(top: 25, left: 0, bottom: 0, right: 0)
-        })
+//        UIView.animate(withDuration: 0.1, animations:{
+//            ()-> Void in
+//            self.tableView.contentInset = UIEdgeInsets(top: 25, left: 0, bottom: 0, right: 0)
+//        })
         
     }
     
     func willDismissSearchController(_ searchController: UISearchController) {
         NSLog("willDismissSearchController")
-        searchController.searchBar.searchBarStyle = UISearchBar.Style.minimal
+//        searchController.searchBar.searchBarStyle = UISearchBar.Style.minimal
     }
     
     func didDismissSearchController(_ searchController: UISearchController) {
         NSLog("didDismissSearchController")
-        UIView.animate(withDuration: 0.15, animations:{
-            ()-> Void in
-            self.tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-        },completion:{(finished:Bool) -> Void in
-            self.tableView.mj_header.isHidden = false
-        })
+//        UIView.animate(withDuration: 0.15, animations:{
+//            ()-> Void in
+//            self.tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+//        },completion:{(finished:Bool) -> Void in
+//            self.tableView.mj_header.isHidden = false
+//        })
         
         
     }

+ 1 - 1
o2ios/O2Platform/App/contacts/contacts.storyboard

@@ -623,7 +623,7 @@
         </scene>
     </scenes>
     <inferredMetricsTieBreakers>
-        <segue reference="ou3-1r-djP"/>
+        <segue reference="PJp-HH-i6F"/>
         <segue reference="JCQ-fv-wZ7"/>
         <segue reference="5hh-6u-Olo"/>
         <segue reference="EGH-4l-bNL"/>