Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyView : UIView {
- func buildMyView() {
- var indicatorView :UIActivityIndicatorView!
- let indicatorSize : CGFloat = 120
- loadingIndicator = UIView(frame: CGRect(origin: CGPoint.zero, size: CGSize(width: indicatorSize, height: indicatorSize)))
- loadingIndicator.backgroundColor = UIColor.darkGray.withAlphaComponent(0.7)
- loadingIndicator.layer.cornerRadius = 10.0
- indicatorView = UIActivityIndicatorView(activityIndicatorStyle: .white)
- indicatorView.hidesWhenStopped = false
- let inset :CGFloat = 20.0
- let insets = UIEdgeInsets(top: inset, left: inset, bottom: inset, right: inset)
- loadingIndicator.fit(subView: indicatorView, .horizontallyAndVertically, with: insets)
- view.center(subView: loadingIndicator, orientated: .horizontallyAndVertically, withOffsets: CGPoint(x: 0, y: -100))
- }
- }
Add Comment
Please, Sign In to add comment