开发者

iPad - iPhone Large UIActivityIndicatorView

I need to make a large spinner (with grey style, about 80x80px) but it looks low quality.开发者_开发技巧 Is there a way to make it high quality or to replace the animated image?


Actually, you can set the indicator style of your UIActivityIndicatorView to Large White, and then in code do this:

// Objective-C
[myActivityView setColor:[UIColor grayColor]];
// Swift 4.0
myActivityView.color = .grayColor


Swift 2.0 Solution

myActivityView.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge
myActivityView.color = UIColor.grayColor()


It can't be done using UIActivityIndicatorView. you can however write your own subclass of UIView using an UIImageView and some simple animation to do this for you.


Swift 3

extension UIActivityIndicatorView {
    func makeLargeGray() {
        activityIndicatorViewStyle = .whiteLarge
        color = .gray
    }
}


You could try something like:

activityIndicator.transform = CGAffineTransform(scaleX: 1.3, y: 1.3)

However, if you make it big enough, you'll be able to see the pixels...


Swift 4.2

extension UIActivityIndicatorView {
    func makeLargeGray() {
        style = .whiteLarge
        color = .gray
    }
}


A useful project that you can start off with is MBProgressHUD.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜