Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. extension UIViewController{
  2. func drawHorizontalStrip(color : CGColor){
  3. let rect = CGRect(x: 0, y: 0, width: self.view.frame.width, height: 2)
  4. let lineStripView = UIView(frame: rect)
  5. lineStripView.layer.borderWidth = 1.0
  6. lineStripView.layer.borderColor = color
  7. self.view.addSubview(lineStripView)
  8. }
  9. }
  10.  
  11. if (delegate.networkStatus != Reachability.NetworkStatus.notReachable)
  12. {
  13. drawHorizontalStrip(color: UIColor.green.cgColor)
  14. }
  15. else
  16. {
  17. drawHorizontalStrip(color: UIColor.red.cgColor)
  18. let nc = NotificationCenter.default
  19. nc.post(name:CONNECTIVITY_NOTIFICATION,
  20. object: nil,
  21. userInfo: ["message":"Connectivity Lost", "date":Date()])
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement