daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Feb 14th, 2018 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class MyView : UIView {
  2.  
  3.   func buildMyView() {
  4.     var indicatorView :UIActivityIndicatorView!
  5.     let indicatorSize : CGFloat = 120
  6.     loadingIndicator = UIView(frame: CGRect(origin: CGPoint.zero, size: CGSize(width: indicatorSize, height: indicatorSize)))
  7.     loadingIndicator.backgroundColor = UIColor.darkGray.withAlphaComponent(0.7)
  8.     loadingIndicator.layer.cornerRadius = 10.0
  9.     indicatorView = UIActivityIndicatorView(activityIndicatorStyle: .white)
  10.     indicatorView.hidesWhenStopped = false
  11.    
  12.     let inset :CGFloat = 20.0
  13.     let insets = UIEdgeInsets(top: inset, left: inset, bottom: inset, right: inset)
  14.     loadingIndicator.fit(subView: indicatorView, .horizontallyAndVertically, with: insets)
  15.     view.center(subView: loadingIndicator, orientated: .horizontallyAndVertically, withOffsets: CGPoint(x: 0, y: -100))
  16.   }
  17.  
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top