Guest User

Untitled

a guest
Feb 14th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment