V5.0.0正式版:

1、加热棒内容修改;
2、首页商品删除,更改为行业资讯;
3、绚多设备更名显示;
4、bugly更换为新版本;
5、摄像头显示bug修复;
6、开屏广告显示不全修复;
This commit is contained in:
wbzhan
2019-08-23 16:11:17 +08:00
parent 374a0fed46
commit 23c5d6f60d
50 changed files with 1499 additions and 897 deletions
+120 -148
View File
@@ -9,13 +9,13 @@
#import "IfishChatView.h"
#import "IfishHistroyVo.h"
#define Normal_heaterPh 499 //只有499才是正常流量
#define Rect_Width 248.f
@interface IfishChatView()
@property(nonatomic,strong)NSMutableArray*line1;
@property(nonatomic,strong)NSMutableArray*line2;
@property(nonatomic,strong)UIView *lablesView;
@property(nonatomic,strong)UILabel*numLable;
Strong NSMutableArray * heaterPhArray;//流量走势
@end
@@ -29,35 +29,24 @@
return _numLable;
}
-(UIView *)lablesView{
if (_lablesView==nil) {
_lablesView=[[UIView alloc]init];
_lablesView.frame=CGRectMake(290, 0, 28, 190);
_lablesView.backgroundColor=[UIColor clearColor];
[self addSubview:_lablesView];
}
return _lablesView;
}
-(NSArray *)line1{
if (_line1==nil) {
_line1=[NSMutableArray array];
}
[_line1 removeAllObjects];
if (_datas.count) {
NSSortDescriptor *ageSD = [NSSortDescriptor sortDescriptorWithKey:@"heaterGatheringTime_int" ascending:YES];
self.datas = [self.datas sortedArrayUsingDescriptors:@[ageSD]];
// CGFloat gapW= 357*scale*0.1;
for (int i=0; i<self.datas.count; i++) {
IfishHistroyVo*vo=self.datas[i];
CGFloat x=(([vo.heaterGatheringTime floatValue]/24)*270+19);
CGFloat x=32 +([vo.heaterGatheringTime floatValue]/24)*Rect_Width;
if(vo.heaterWaterTemperature.integerValue>350){
vo.heaterWaterTemperature=@"350";
}else if(vo.heaterWaterTemperature.integerValue<250){
continue;
}
CGFloat y=188*(1-((vo.heaterWaterTemperature.integerValue*0.1-25)/10))+36.5;//*-1*+158;
CGFloat y=80*(1-((vo.heaterWaterTemperature.integerValue*0.1-25)/10))+19;//*-1*+158;
CGPoint p1=CGPointMake(x, y);
// NSLog(@"%f-------%f--%f-",y,vo.heaterWaterTemperature.integerValue*0.1,x);
[_line1 addObject:NSStringFromCGPoint(p1)];
@@ -66,74 +55,53 @@
return _line1;
}
-(NSArray *)line2{
if (_line2==nil) {
_line2=[NSMutableArray array];
}
if (_datas.count) {
NSSortDescriptor *PhSD = [NSSortDescriptor sortDescriptorWithKey:@"heaterPh_int" ascending:YES];
NSMutableArray*arr = [[self.datas sortedArrayUsingDescriptors:@[PhSD]] mutableCopy];
IfishHistroyVo*vo=arr[0];
NSInteger miniPh=vo.heaterPh_int-50;
IfishHistroyVo*vo1=arr[arr.count-1];
NSInteger maxPh=vo1.heaterPh_int+50;
NSInteger range=maxPh-miniPh;
[_line2 removeAllObjects];
for (int i=0; i<self.datas.count; i++) {
IfishHistroyVo*vo=self.datas[i];
CGFloat x=(([vo.heaterGatheringTime floatValue]/24)*270+19);
CGFloat y=(1-((vo.heaterPh.floatValue-miniPh)/range))*188+36.5;
CGPoint p1=CGPointMake(x, y);
[_line2 addObject:NSStringFromCGPoint(p1)];
}
}
return _line2;
}
-(void)setLables{
NSSortDescriptor *PhSD = [NSSortDescriptor sortDescriptorWithKey:@"heaterPh_int" ascending:YES];
NSMutableArray*arr = [[self.datas sortedArrayUsingDescriptors:@[PhSD]] mutableCopy];
IfishHistroyVo*vo=arr[0];
NSInteger miniPh=vo.heaterPh_int-50;
IfishHistroyVo*vo1=arr[arr.count-1];
NSInteger maxPh=vo1.heaterPh_int+50;
NSInteger range=maxPh-miniPh;
if (_lablesView) {
[self.lablesView removeFromSuperview];
_lablesView=nil;
}
// [self addSubview:self.lablesView];
for (int i=0; i<10; i++) {
UILabel*lable=[[UILabel alloc]init];
NSInteger pos=10-i;
lable.frame=CGRectMake(0, i*9+i*10+33, 24, 9);
lable.text=[NSString stringWithFormat:@"%.0f",miniPh+range*0.1*pos];
lable.font=[UIFont systemFontOfSize:8];
[self.lablesView addSubview:lable];
}
NSLog(@"lable=================");
}
-(void)setDatas:(NSArray *)datas{
NSSortDescriptor *ageSD = [NSSortDescriptor sortDescriptorWithKey:@"heaterGatheringTime_int" ascending:YES];
datas = [datas sortedArrayUsingDescriptors:@[ageSD]];
_datas=datas;
[self setLables];
[self layoutIfNeeded];
}
-(NSMutableArray *)heaterPhArray{
if (!_heaterPhArray) {
_heaterPhArray = InitObject(NSMutableArray);
//添加流量
for (int i=0; i<23; i++) {
CGFloat x=(i*(Rect_Width/24)+32);
CGFloat y=104;
UIView *lineView = [[UIView alloc] initWithFrame:RECT(x, y, Rect_Width/24, 1)];
lineView.tag = i+1000;
[self addSubview:lineView];
[_heaterPhArray addObject:lineView];
}
}
return _heaterPhArray;
}
//刷新流量状态
-(void)reloadHeater{
for (UIView *view in self.heaterPhArray) {
[view.layer removeAllAnimations];
}
for (int i=0; i<self.datas.count-1; i++) {
IfishHistroyVo*vo=self.datas[i];
IfishHistroyVo*nextVo=self.datas[i+1];
//如果有时间段的数据拿不到,则直接使用虚线
if ([nextVo.heaterGatheringTime integerValue]-[vo.heaterGatheringTime integerValue]>1) {
for (int i=[vo.heaterGatheringTime intValue]; i<[nextVo.heaterGatheringTime intValue]; i++) {
UIView *emptyView = [self viewWithTag:i+1000];
[self drawDashLine:emptyView lineLength:2 lineSpacing:1 lineColor:[UIColor redColor]];
}
}else{
UIView *lineView = [self viewWithTag:[vo.heaterGatheringTime integerValue]+1000];
if([vo.heaterPh integerValue]==Normal_heaterPh&&[nextVo.heaterPh integerValue]==Normal_heaterPh){//正常流量
lineView.layer.backgroundColor = [UIColor greenColor].CGColor;
}else{
[self drawDashLine:lineView lineLength:2 lineSpacing:1 lineColor:[UIColor redColor]];
}
}
}
}
-(void)drawLine{
UIColor *color = [UIColor redColor];
[color set]; //设置线条颜色
@@ -143,9 +111,6 @@
path.lineCapStyle = kCGLineCapRound; //线条拐角
path.lineJoinStyle = kCGLineJoinRound; //终点处理
// Draw the lines
for (int i=0; i<self.line1.count; i++) {
@@ -159,53 +124,32 @@
// [path closePath];//第五条线通过调用closePath方法得到的
[path stroke];//Draws line 根据坐标点连线
for (int i=0; i<self.line1.count; i++) {
NSString* p=self.line1[i];
CGPoint point=CGPointFromString(p);
UIBezierPath *path0 = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(point.x-2, point.y-2, 4, 4) cornerRadius:2];
[path0 stroke];
[path0 fill];
// UIButton*btn0=[UIButton buttonWithType:1];
// btn0.frame=CGRectMake(point.x-3, point.x-3, 6, 6);
// [btn0 addTarget:self action:@selector(clickPoint:) forControlEvents:UIControlEventTouchUpInside];
// [self addSubview:btn0];
}
UIColor *color1 = [UIColor blueColor];
[color1 set]; //设置线条颜色
UIBezierPath* path1 = [UIBezierPath bezierPath];
path1.lineWidth = 1.0;
path1.lineCapStyle = kCGLineCapRound; //线条拐角
path1.lineJoinStyle = kCGLineJoinRound; //终点处理
// [path1 moveToPoint:CGPointMake(0.0, 0.0)];//起点
// Draw the lines
for (int i=0; i<self.line2.count; i++) {
NSString* p=self.line2[i];
if (i==0) {
[path1 moveToPoint:CGPointFromString(p)];//起点
}
[path1 addLineToPoint:CGPointFromString(p)];
}
//添加坐标点
// for (int i=0; i<self.line1.count; i++) {
//
// NSString* p=self.line1[i];
// CGPoint point=CGPointFromString(p);
// UIBezierPath *path0 = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(point.x-1, point.y-1, 2, 2) cornerRadius:1];
// [path0 stroke];
// [path0 fill];
//
// }
// UIColor *color1 = [UIColor greenColor];
// [color1 set]; //设置线条颜色
//
// UIBezierPath* path1 = [UIBezierPath bezierPath];
// path1.lineWidth = 1.0;
//
// path1.lineCapStyle = kCGLineCapRound; //线条拐角
// path1.lineJoinStyle = kCGLineJoinRound; //终点处理
// // Draw the lines
// for (int i=0; i<self.line2.count; i++) {
// NSString* p=self.line2[i];
// if (i==0) {
// [path1 moveToPoint:CGPointFromString(p)];//起点
// }
// [path1 addLineToPoint:CGPointFromString(p)];
// }
// [path closePath];//第五条线通过调用closePath方法得到的
@@ -213,25 +157,53 @@
// CGFloat dashPattern[] = {3,1};// 3实线,1空白
// [path1 setLineDash:dashPattern count:1 phase:1];
[path1 stroke];//颜色填充
// [path1 stroke];//颜色填充
for (int i=0; i<self.line1.count; i++) {
NSString* p=self.line2[i];
CGPoint point=CGPointFromString(p);
UIBezierPath *path01 = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(point.x-1.5, point.y-1.5, 3, 3) cornerRadius:2];
[path01 stroke];
[path01 fill];
// UIButton*btn1=[UIButton buttonWithType:1];
// btn1.frame=CGRectMake(point.x-3, point.x-3, 6, 6);
// btn1.tag=i;
// btn1.backgroundColor=[UIColor blackColor];
// [btn1 addTarget:self action:@selector(clickPoint:) forControlEvents:UIControlEventTouchUpInside];
// [self addSubview:btn1];
}
//添加坐标点
// for (int i=0; i<self.line1.count; i++) {
//
// NSString* p=self.line2[i];
// CGPoint point=CGPointFromString(p);
// UIBezierPath *path01 = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(point.x-1, point.y-1, 2, 2) cornerRadius:1];
// [path01 stroke];
// [path01 fill];
//
// }
}
/**
** lineView: 需要绘制成虚线的view
** lineLength: 虚线的宽度
** lineSpacing: 虚线的间距
** lineColor: 虚线的颜色
**/
-(void)drawDashLine:(UIView *)lineView lineLength:(int)lineLength lineSpacing:(int)lineSpacing lineColor:(UIColor *)lineColor
{
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
[shapeLayer setBounds:lineView.bounds];
[shapeLayer setPosition:CGPointMake(CGRectGetWidth(lineView.frame) / 2, CGRectGetHeight(lineView.frame))];
[shapeLayer setFillColor:[UIColor clearColor].CGColor];
// 设置虚线颜色为blackColor
[shapeLayer setStrokeColor:lineColor.CGColor];
// 设置虚线宽度
[shapeLayer setLineWidth:CGRectGetHeight(lineView.frame)];
[shapeLayer setLineJoin:kCALineJoinRound];
// 设置线宽,线间距
[shapeLayer setLineDashPattern:[NSArray arrayWithObjects:[NSNumber numberWithInt:lineLength], [NSNumber numberWithInt:lineSpacing], nil]];
// 设置路径
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, 0, 0);
CGPathAddLineToPoint(path, NULL, CGRectGetWidth(lineView.frame), 0);
[shapeLayer setPath:path];
CGPathRelease(path);
// 把绘制好的虚线添加上来
[lineView.layer addSublayer:shapeLayer];
}
-(void)clickPoint:(UIButton*)btn{
IfishHistroyVo*vo=self.datas[btn.tag];
self.numLable.text=vo.heaterWaterTemperature;