DYDotsView
一个简单的视图,用于在 Objective-C 和 Swift 中显示脉冲点。
预览
Podfile
要使用 CocoaPods 将 DYDotsView 集成到 Xcode 项目中,请在其 Podfile
中指定它
Objective-C
pod 'DYDotsView'
Swift
pod 'DYDotsView-Swift'
如何使用
Objective-C
#import "DYDotsView.h"
DYDotsView * dots = [[DYDotsView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
[dots setNumberOfDots:@5];
[dots setDuration:@0.4];
[dots setBackgroundColor:[UIColor clearColor]];
[dots setDotsColor:[UIColor redColor]];
[dots startAnimating];
[dots setCenter:self.view.center];
[self.view addSubview:dots];
//[dots stopAnimating];
Swift
var dots = DYDotsView(frame: CGRect(x: 0, y: 0, width: 300, height: 30))
dots.numberOfDots = 5
dots.duration = 0.4
dots.backgroundColor = .clear
dots.dotsColor = .red
dots.startAnimating()
dots.center = self.view.center
self.view.addSubview(dots)
//dots.stopAnimating()