温度仪表盘在很多行业都有应用,今天放2种风格的仪表盘源码。
效果图如上
部分源码
#import "ViewController.h" #import "RectangleIndicatorView.h" #import "CircleIndicatorView.h" @interface ViewController () @property (weak, nonatomic) IBOutlet CircleIndicatorView *circleIndicatorView; @property (weak, nonatomic) IBOutlet RectangleIndicatorView *rectangleIndicatorView; - (IBAction)circleIndicatorShine; - (IBAction)rectangleIndicatorShine; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.rectangleIndicatorView.minValue = 40; self.rectangleIndicatorView.maxValue = 80; self.rectangleIndicatorView.valueToShowArray = @[@40, @50, @60, @70, @80]; self.rectangleIndicatorView.indicatorValue = 50; self.rectangleIndicatorView.minusBlock = ^{ NSLog(@"点击了 -"); self.rectangleIndicatorView.indicatorValue -= 1; }; self.rectangleIndicatorView.addBlock = ^{ NSLog(@"点击了 +"); self.rectangleIndicatorView.indicatorValue += 1; }; self.circleIndicatorView.minValue = 40; self.circleIndicatorView.maxValue = 80; self.circleIndicatorView.innerAnnulusValueToShowArray = @[@40, @50, @60, @70, @80]; self.circleIndicatorView.indicatorValue = 60; self.circleIndicatorView.minusBlock = ^{ NSLog(@"点击了 -"); self.circleIndicatorView.indicatorValue -= 1; }; self.circleIndicatorView.addBlock = ^{ NSLog(@"点击了 +"); self.circleIndicatorView.indicatorValue += 1; }; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self shineIndicatorView]; } - (void)shineIndicatorView { [self.circleIndicatorView shineWithTimeInterval:0.01 pauseDuration:0 finalValue:70 finishBlock:^{ //NSLog(@"---------- 执行完毕"); }]; } - (IBAction)circleIndicatorShine { [self.circleIndicatorView shineWithTimeInterval:0.01 pauseDuration:0 finalValue:70 finishBlock:^{ //NSLog(@"---------- 执行完毕"); }]; } - (IBAction)rectangleIndicatorShine { [self.rectangleIndicatorView shineWithTimeInterval:0.01 pauseDuration:0 finalValue:72 finishBlock:^{ //NSLog(@"---------- 执行完毕"); }]; } @end
收藏的用户(0) X
正在加载信息~
推荐阅读
最新回复 (0)
站点信息
- 文章2312
- 用户1336
- 访客11621716
每日一句
Compliment yourself daily.
每天夸自己一句。
每天夸自己一句。
How to Ungroup Icons on Windows 11 Taskbar With a Registry Hack (and 2 More Ways)
反编译修改class文件变量
如何在大学成为一名优秀的程序员?
VMware NAT端口映射外网访问虚拟机linux
ubuntu下提取DSDT SSDT
使用HTML和CSS设计磨砂玻璃效果
解决android studio 4.4使用javah失败
vscode使用eslint自动代码格式化
c++浮点运算能力附安卓版
【源码】两种仪表盘
P2P中NAT之间的打洞可能性
jQuery的load方法Cannot read property 'indexOf' of undefined
【开源Roguelike游戏】素地牢源码
新会员