2

我正在快速做一个 iOS 8 自定义键盘,并且我在视图中添加了一个 UIActivityIndi​​catorView,问题是我可以看到它,但不能旋转,它是静态的,这是代码:

@IBOutlet var menuLabel: UILabel!

override func viewDidLoad() {
    super.viewDidLoad()
    self.load_indicator = UIActivityIndicatorView(frame: CGRectMake(0,0, 50, 50)) as UIActivityIndicatorView
    self.load_indicator.hidesWhenStopped = true
    self.load_indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
    self.view.addSubview(self.load_indicator)
}

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)

    dispatch_async(dispatch_get_main_queue(), {
        self.load_indicator.startAnimating()
        })
}

加载指示器出现,但它是静态的,我该怎么办?

4

1 回答 1

0
load_indicator = UIActivityIndicatorView(frame: CGRectMake(0,0, 50, 50))
load_indicator.hidesWhenStopped = true
load_indicator.startAnimating()
load_indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
view.addSubview(load_indicator)  

你需要开始动画

load_indicator.startAnimating()

你可能也对这个类感兴趣:https ://github.com/goktugyil/CozyLoadingActivity

于 2015-06-04T15:47:38.657 回答