Showing
2 changed files
with
28 additions
and
1 deletions
No preview for this file type
... | @@ -79,7 +79,8 @@ extension UIViewController { | ... | @@ -79,7 +79,8 @@ extension UIViewController { |
79 | } | 79 | } |
80 | 80 | ||
81 | // Remove navigationBar bottom border | 81 | // Remove navigationBar bottom border |
82 | - self.navigationController?.navigationBar.hideBottomHairline() | 82 | + // self.navigationController?.navigationBar.hideBottomHairline() |
83 | + self.navigationController?.hideHairline() | ||
83 | 84 | ||
84 | } | 85 | } |
85 | 86 | ||
... | @@ -460,3 +461,29 @@ extension UIView { | ... | @@ -460,3 +461,29 @@ extension UIView { |
460 | return nil | 461 | return nil |
461 | } | 462 | } |
462 | } | 463 | } |
464 | + | ||
465 | +extension UINavigationController { | ||
466 | + func hideHairline() { | ||
467 | + if let hairline = findHairlineImageViewUnder(navigationBar) { | ||
468 | + hairline.isHidden = true | ||
469 | + } | ||
470 | + } | ||
471 | + | ||
472 | + func restoreHairline() { | ||
473 | + if let hairline = findHairlineImageViewUnder(navigationBar) { | ||
474 | + hairline.isHidden = false | ||
475 | + } | ||
476 | + } | ||
477 | + | ||
478 | + func findHairlineImageViewUnder(_ view: UIView) -> UIImageView? { | ||
479 | + if view is UIImageView && view.bounds.size.height <= 1.0 { | ||
480 | + return view as? UIImageView | ||
481 | + } | ||
482 | + for subview in view.subviews { | ||
483 | + if let imageView = self.findHairlineImageViewUnder(subview) { | ||
484 | + return imageView | ||
485 | + } | ||
486 | + } | ||
487 | + return nil | ||
488 | + } | ||
489 | +} | ... | ... |
-
Please register or login to post a comment