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
+2 -1
View File
@@ -7,8 +7,9 @@
//
#import <UIKit/UIKit.h>
#import "MessageAlertView.h"
@interface IfishBaseVc : UIViewController
Strong MessageAlertView *popView;
-(void)socketDidGetBackmsgData:(NSData *)data onsoket:(AsyncSocket *)sock;
//已断开连接
+42 -62
View File
@@ -7,15 +7,12 @@
//
#import "IfishBaseVc.h"
#import "LXPopView.h"
#import "DXPopover.h"
#import "CreatErWeiMaController.h"
#import "JHRefreshAmazingAniView.h"
#import "UIScrollView+JHRefresh.h"
@interface IfishBaseVc ()<IfishCommuniteDelegate,LxPopViewDelegate>
@property(nonatomic,strong)DXPopover *popover;
@interface IfishBaseVc ()<IfishCommuniteDelegate>
@end
@@ -27,6 +24,8 @@
[Socketsingleton sharedInstance].communiteDelegate=self;
// Do any additional setup after loading the view.
//右侧下拉菜单
[self initPopOver];
}
- (void)didReceiveMemoryWarning {
@@ -138,76 +137,57 @@
return [str copy];
}
}
#pragma mark- 下拉菜单
-(MessageAlertView *)popView{
if (!_popView) {
_popView = [[MessageAlertView alloc]initWithFrame:RECT(screen_width - kSizeFrom750(220), 0, kSizeFrom750(220), kSizeFrom750(270))];
WEAK_SELF;
//点击
_popView.comboxBlock = ^(NSInteger tag) {
if (tag == 0) {
//修改名称
[weakSelf shezhiMingCheng];
}else if (tag == 1){
//删除设备
[weakSelf deletDevice];
}else if (tag == 2){
//分享设备
[weakSelf fenXiangSheBei];
}
[weakSelf presentPopView];//隐藏弹出框
};
}
return _popView;
}
//弹出分享框
-(void)presentPopView{
UIImage *image = [UIImage imageNamed:@"popover_background_image_notrangle"];
NSArray *titleImgs = nil;
BOOL isHidden = self.popView.hidden;
if (isHidden) {
self.popView.hidden = NO;
}
[UIView animateWithDuration:0.3 animations:^{
self.popView.transform = CGAffineTransformScale(self.popView.transform,isHidden?100:0.01,isHidden?100:0.01);
} completion:^(BOOL finished) {
self.popView.hidden = !isHidden;
}];
}
-(void)initPopOver{
[self.view addSubview:self.popView];
NSArray *titleImgs =nil;
NSArray *titles=nil;
LXPopView *pop=[[LXPopView alloc] init];
CGFloat popRowH=160*(image.size.height/image.size.width);
if ([self.devicemodel.isMaster isEqualToString:@"1"]) {
//主控
pop.frame = CGRectMake(0, 0, 160, 160*(image.size.height/image.size.width) + (popRowH -12)/2);
titleImgs = @[@"ifishdropview_edite_device",@"ifishdropview_delect_device",@"Ifish_share_device"];
titles=@[@"修改名称",@"删除设备",@"分享设备"];
}else{
pop.frame = CGRectMake(0,0, 160, 160*(image.size.height/image.size.width));
titleImgs = @[@"ifishdropview_edite_device",@"ifishdropview_delect_device"];
titles=@[@"修改名称",@"删除设备"];
}
pop.delegate = self;
pop.backgroundImage =image
;
pop.titles = titles;
pop.titleImgs =titleImgs;
DXPopover *popover = [DXPopover popover];
self.popover = popover;
popover.arrowSize = CGSizeMake(0.0,0.0);
[popover showAtView:self.navigationItem.rightBarButtonItem.customView withContentView:pop];
NSLog(@"设备右侧pop");
[self.popView loadInfoWithTitle:titles Icons:titleImgs];
}
#pragma mark - PopViewDelagate
-(void)disSelectedPopViewIndex:(NSIndexPath *)Index{
[self.popover dismiss];
if (Index.row == 0) {
//修改名称
[self shezhiMingCheng];
}else if (Index.row == 1){
//删除设备
[self deletDevice];
}else if (Index.row == 2){
//分享设备
[self fenXiangSheBei];
}
}
#pragma mark - 修改设备名
+3
View File
@@ -11,6 +11,9 @@
#import "CenterViewController.h"
#import "IfishBaseVc.h"
/**
热流器页面详情
*/
@interface IfishHotBarVc :IfishBaseVc
@end
+59 -64
View File
@@ -28,14 +28,15 @@
@interface IfishHotBarVc ()<UITableViewDelegate,UITableViewDataSource,ChangeWaterDelegate,IfishHistoryViewBottomBarDelete>
@property (weak, nonatomic) IBOutlet UITableView *mainTableView;
@property (strong, nonatomic) UITableView *mainTableView;
@property(nonatomic,strong)NSMutableArray*datas;
@property(nonatomic,strong)IFishWaterChangeView*changeWaterView;
@property(nonatomic,strong)IfishHistoryView*historyView;
@property (weak, nonatomic) IBOutlet UILabel *templetrueLable;
@property(nonatomic,strong)IfishHotBarVo*vo;
@property(nonatomic,strong)IfishHotBarHeader*header;
@property(nonatomic,assign)NSInteger curDay;
Assign BOOL isInitHostoryView;
@end
@implementation IfishHotBarVc
@@ -52,9 +53,6 @@
return _header;
}
-(void)initUI{
}
-(void)wenduRequest{// 查询设备状态信息
searchDeviceModel*xinxiModel=[[searchDeviceModel alloc]init];
@@ -67,38 +65,23 @@
[[Socketsingleton sharedInstance].clientSocket readDataWithTimeout:-1 tag:0];
[self getHotBarInfo];
}
-(IfishHistoryView *)historyView{
if (_historyView==nil) {
_historyView=[IfishHistoryView getView];
_historyView.frame=self.view.bounds;
if (!_historyView) {
_historyView=InitObject(IfishHistoryView);
_historyView.myDeleget=self;
[self.view addSubview:_historyView];
[_historyView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
}
// _historyView.hidden=NO;
return _historyView;
}
-(void)clickBottomBarWithIdx:(NSInteger)idx{
if (idx==10) {
self.curDay++;
if (self.curDay>7) {
[SVProgressHUD showInfoWithStatus:@"只能查询前七天数据!"];
self.curDay=7;
return;
}
}else{
self.curDay--;
if(self.curDay<0){
[SVProgressHUD showInfoWithStatus:@"只能查询前七天数据!"];
self.curDay=0;
return;
}
}
//获取历史流量数据
-(void)getHistoryDataRequest{
self.isInitHostoryView = YES;
NSDate *curDate = [NSDate dateWithTimeInterval:self.curDay*60*60*-24 sinceDate:[NSDate date]];
NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];//创建一个日期格式化器
@@ -106,7 +89,7 @@
NSLog(@"%@",[dateFormatter stringFromDate:curDate]);//2015-11-20 08:24:04
NSString*curDateStr=[dateFormatter stringFromDate:curDate];
// __block NSString*b_dateStr=curDateStr;
// __block NSString*b_dateStr=curDateStr;
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeBlack];
NSDictionary*para=@{@"heaterMacAddress":self.devicemodel.macAddress,@"date":curDateStr};//yyyy-mm-dd
self.historyView.curdateStr=curDateStr;
@@ -130,15 +113,37 @@
[SVProgressHUD showInfoWithStatus:@"网络在开小差,请稍后!"];
}];
}
-(void)clickBottomBarWithIdx:(NSInteger)idx{
if (idx==10) {
self.curDay++;
if (self.curDay>7) {
[SVProgressHUD showInfoWithStatus:@"只能查询前七天数据!"];
self.curDay=7;
return;
}
}else{
self.curDay--;
if(self.curDay<0){
[SVProgressHUD showInfoWithStatus:@"只能查询前七天数据!"];
self.curDay=0;
return;
}
}
[self getHistoryDataRequest];
}
#pragma mark----设置参数代理---
-(IFishWaterChangeView *)changeWaterView{
if(_changeWaterView==nil){
_changeWaterView=[IFishWaterChangeView getView];
_changeWaterView.frame=self.view.bounds;
_changeWaterView=[[IFishWaterChangeView alloc]init];
[self.view addSubview:_changeWaterView];
// [_changeWaterView.picker reloadAllComponents];
[self.changeWaterView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
_changeWaterView.myDelegate=self;
}
_changeWaterView.hidden=NO;
@@ -216,8 +221,9 @@
vo.subTitle=@"";
[_datas addObject:vo];
//预警温度 add V5.0.0
IfishHotBarVo*vo1=[[IfishHotBarVo alloc]init];
vo1.title=@"鱼缸容量 ";
vo1.title=@"预警温度 ";
vo1.iconUrl=@"容积图标";
vo1.isShowArrow=YES;
vo1.subTitle=@"";
@@ -226,7 +232,7 @@
vo2.title=@"水泵流量";
vo2.iconUrl=@"流量标";
vo2.isShowArrow=NO;
vo2.subTitle=@"";
vo2.subTitle=@"无水";
[_datas addObject:vo2];
IfishHotBarVo*vo3=[[IfishHotBarVo alloc]init];
vo3.title=@"历史趋势";
@@ -250,11 +256,17 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.isInitHostoryView = NO;
// Do any additional setup after loading the view from its nib.
self.mainTableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
[self.mainTableView registerNib:[UINib nibWithNibName:@"IFishHotBarCell" bundle:nil] forCellReuseIdentifier:HOTBARCELL];
self.mainTableView.rowHeight=70;
self.mainTableView.dataSource=self;
self.mainTableView.delegate=self;
[self.view addSubview:self.mainTableView];
[self.mainTableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
[self.mainTableView reloadData];
[self getHotBarInfo];
self.tableView=self.mainTableView;
@@ -273,28 +285,15 @@
self.navigationItem.leftBarButtonItem=backItem;
self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ifishnav_dropview_list"] style:0 target:self action:@selector(clickMoreBtn)];
[self.view bringSubviewToFront:self.popView];
}
//-(void)updateNameInLocal{
// NSArray* deviceArr =[dataContorl getallDevices];
// for (DeviceModel *device in deviceArr) {
// if (device.deviceId==self.devicemodel.deviceId) {
// device.defaultShowName=self.title;
// [[DataCenter defaultDtacenter]setValue:deviceArr forKey:@"deviceInfo"];
// break;
// }
// }
//
//
//}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"blackbar.png"] forBarMetrics:UIBarMetricsDefault];
NSString*dTitle=[[NSUserDefaults standardUserDefaults] valueForKey:@"dTitle"];
self.title=self.devicemodel.showName;
// [self updateNameInLocal];
}
@@ -457,12 +456,8 @@
self.historyView.datas=self.vo.phs;
self.historyView.hidden=YES;
}
IfishHotBarVo*vo=self.datas[1];
if (self.vo.heater.heaterVolume.length) {
vo.title=[NSString stringWithFormat:@"鱼缸容量 %@L",self.vo.heater.heaterVolume];
vo.subTitle=[NSString stringWithFormat:@"推荐流量:%.1fL--%.1fL",[self.vo.heater.heaterVolume intValue]*1.5,[self.vo.heater.heaterVolume intValue]*2.0];
}
//去除鱼缸容积,改为设置预警温度
IfishHotBarVo*vo1=self.datas[4];
if (self.vo.heater.heaterCycle.length) {
if (self.vo.heater.heaterReminderTime.length) {
@@ -497,13 +492,15 @@
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row==3) {
if (!self.isInitHostoryView) {
[self getHistoryDataRequest];
}
self.historyView.hidden=NO;
// self.historyView.datas=self.vo.phs;
}else if (indexPath.row==2){
}
else{
// [self wenduRequest];
[self changeWaterView];
self.changeWaterView.hotVo=self.vo;
self.changeWaterView.viewType=indexPath.row;
@@ -541,10 +538,8 @@
-(void)updateUiWithInfo:(NSString*)info{
NSString*templeture=[info substringWithRange:NSMakeRange(36, 4)];
// templeture=[NSString stringWithFormat:@"0x%@",templeture];
UInt64 temp=[dataContorl hexToTen:templeture];
float tempFloat=temp*0.1;
// self.templetrueLable.text=[NSString stringWithFormat:@"%llu°c",temp];
self.header.degreeLable.text=[NSString stringWithFormat:@"%0.1f°c",tempFloat];
//流量 46
NSString*ph=[info substringWithRange:NSMakeRange(46, 4)];
@@ -552,11 +547,11 @@
IfishHotBarVo*vo2=self.datas[2];
// phV=0;
vo2.phv=phV;
vo2.title=[NSString stringWithFormat:@"水循环 %lluL",phV];
if (phV<=120) {
vo2.subTitle=@"流量警告:加热器停止加热,进入保护状态";
//phV给499,则为正常,其余的都是无水-V5.0.0
if (phV==499) {
vo2.subTitle=@"正常";
}else{
vo2.subTitle=@"";
vo2.subTitle=@"无水";
}
self.vo.heaterNum=[info substringWithRange:NSMakeRange(40, 4)];
@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="IfishHotBarVc">
<connections>
<outlet property="mainTableView" destination="EfA-oe-WKg" id="YG8-nm-lV1"/>
<outlet property="templetrueLable" destination="rnv-MK-lkn" id="pQy-GR-9Tu"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="EfA-oe-WKg">
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rnv-MK-lkn">
<rect key="frame" x="188" y="140" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="41"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="EfA-oe-WKg" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="64" id="52C-b0-rq7"/>
<constraint firstItem="rnv-MK-lkn" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="Axv-3t-IXc"/>
<constraint firstItem="EfA-oe-WKg" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="m7y-9w-hC6"/>
<constraint firstAttribute="trailing" secondItem="EfA-oe-WKg" secondAttribute="trailing" id="mvQ-gh-J4w"/>
<constraint firstItem="rnv-MK-lkn" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="140" id="rSs-Ny-eZP"/>
<constraint firstAttribute="bottom" secondItem="EfA-oe-WKg" secondAttribute="bottom" id="sEy-3b-Ses"/>
</constraints>
</view>
</objects>
</document>
@@ -20,6 +20,11 @@
- (void)awakeFromNib {
[super awakeFromNib];
[self.subTitleLable mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLbale.mas_right).offset(20);
make.centerY.height.mas_equalTo(self.titleLbale);
}];
[self.subTitleLable setTextColor:[UIColor colorWithRed:109/255.0 green:109/255.0 blue:109/255.0 alpha:1.0]];
// Initialization code
}
@@ -35,9 +40,9 @@
self.subTitleLable.text=vo.subTitle;
self.iconImgV.image=[UIImage imageNamed:vo.iconUrl];
self.arrowImgV.hidden=!vo.isShowArrow;
if (vo.phv<120&&[vo.title containsString:@"水循环"]) {
if (vo.phv!=499) {//无水
[self.subTitleLable setTextColor:[UIColor redColor]];
}else{
}else{//正常
[self.subTitleLable setTextColor:[UIColor colorWithRed:109/255.0 green:109/255.0 blue:109/255.0 alpha:1.0]];
}
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -34,8 +34,9 @@
<constraint firstAttribute="height" constant="10" id="ht2-GT-W7M"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bqk-eu-G7V">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bqk-eu-G7V">
<rect key="frame" x="41" y="46" width="0.0" height="0.0"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.42745098039215684" green="0.42745098039215684" blue="0.42745098039215684" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@@ -43,8 +44,6 @@
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="MDc-Sh-69Z" secondAttribute="trailing" constant="10" id="1u9-YP-oIE"/>
<constraint firstItem="bqk-eu-G7V" firstAttribute="leading" secondItem="JXp-mV-pUz" secondAttribute="leading" id="IHa-is-G3q"/>
<constraint firstItem="bqk-eu-G7V" firstAttribute="top" secondItem="JXp-mV-pUz" secondAttribute="bottom" constant="2" id="KaT-d3-W2s"/>
<constraint firstItem="4bv-OB-vC4" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="QSY-Vc-NAV"/>
<constraint firstItem="JXp-mV-pUz" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="fai-hr-fRt"/>
<constraint firstItem="JXp-mV-pUz" firstAttribute="leading" secondItem="4bv-OB-vC4" secondAttribute="trailing" constant="10" id="ffc-E4-hTy"/>
@@ -62,7 +61,7 @@
</tableViewCell>
</objects>
<resources>
<image name="温度图标" width="21" height="26"/>
<image name="箭头" width="21" height="15"/>
<image name="温度图标" width="21.5" height="26"/>
<image name="箭头" width="21.5" height="15.5"/>
</resources>
</document>
@@ -17,9 +17,13 @@
-(void)clickWormCode:(NSString*)code;
@end
/**
设置水温和设置预警温度分开显示
*/
@interface IFishWaterChangeView : UIView
@property (weak, nonatomic) IBOutlet UIPickerView *picker;
@property(nonatomic,weak)id<ChangeWaterDelegate> myDelegate;
@property(nonatomic,assign)NSInteger viewType;
@property(nonatomic,strong)IfishHotBarVo*hotVo;
@end
@@ -10,7 +10,6 @@
@interface IFishWaterChangeView()<UIPickerViewDelegate,UIPickerViewDataSource>
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *pickerBottom;
@property(nonatomic,strong)NSMutableArray*data1;
@property(nonatomic,strong)NSMutableArray*data2;
@property(nonatomic,strong)NSMutableArray*templetrueArr;
@@ -20,28 +19,174 @@
@property(nonatomic,copy)NSString*selectVaule2;
@property(nonatomic,copy)NSString*selectVaule3;
@property(nonatomic,copy)NSString*warnCode;
@property (weak, nonatomic) IBOutlet UIView *topTempPicker;
@property (weak, nonatomic) IBOutlet UIView *bottomPicker;
@property (weak, nonatomic) IBOutlet UIView *heightView;
@property (weak, nonatomic) IBOutlet UITextField *longTextF;
@property (weak, nonatomic) IBOutlet UITextField *widthTextF;
@property (weak, nonatomic) IBOutlet UITextField *heightTextF;
@property (weak, nonatomic) IBOutlet UIPickerView *topUiPick;
@property (weak, nonatomic) IBOutlet UIPickerView *bottomUiPicker;
@property (weak, nonatomic) IBOutlet UIButton *openBtn;
@property (weak, nonatomic) IBOutlet UILabel *bottomTextF;
//@property (weak, nonatomic) IBOutlet UIButton *bgButton;
//@property (weak, nonatomic) IBOutlet UIPickerView *topUiPick;
//@property (weak, nonatomic) IBOutlet UIPickerView *bottomUiPicker;
//@property (weak, nonatomic) IBOutlet UIImageView *titleImageView;
//@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
//@property (weak, nonatomic) IBOutlet UIButton *openBtn;//开关
//@property (weak, nonatomic) IBOutlet UIButton *sureBtn;
//@property (weak, nonatomic) IBOutlet UIImageView *sepImage;
Strong UIButton *bgButton;
Strong UIPickerView *topUiPick;
Strong UIPickerView *bottomUiPicker;
Strong UIImageView *titleImageView;
Strong UILabel *titleLabel;
Strong UIButton *openBtn;//开关
Strong UIButton *sureBtn;
Strong UIImageView *sepImage;
@end
@implementation IFishWaterChangeView
-(instancetype)init{
self = [super init];
if (self) {
[self addSubview:self.bgButton];
[self addSubview:self.topUiPick];
[self addSubview:self.bottomUiPicker];
[self addSubview:self.sepImage];
[self addSubview:self.titleImageView];
[self.titleImageView addSubview:self.titleLabel];
[self addSubview:self.openBtn];
[self addSubview:self.sureBtn];
[self loadLayout];
}
return self;
}
#pragma mark --lazyLoading
- (UIButton *)bgButton{
if (!_bgButton) {
_bgButton = InitObject(UIButton);
[_bgButton addTarget:self action:@selector(bgButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[_bgButton setBackgroundColor:RGBA(0, 0, 0, 0.3)];
}
return _bgButton;
}
- (UIPickerView *)topUiPick{
if (!_topUiPick) {
_topUiPick = [[UIPickerView alloc]init];
_topUiPick.delegate = self;
_topUiPick.backgroundColor = [UIColor whiteColor];
}
return _topUiPick;
}
- (UIPickerView *)bottomUiPicker{
if (!_bottomUiPicker) {
_bottomUiPicker = InitObject(UIPickerView);
_bottomUiPicker.delegate = self;
_bottomUiPicker.backgroundColor = [UIColor whiteColor];
}
return _bottomUiPicker;
}
- (UIImageView *)sepImage{
if (!_sepImage) {
_sepImage = InitObject(UIImageView);
[_sepImage setImage:IMAGEBYENAME(@"虚线")];
}
return _sepImage;
}
- (UIButton *)openBtn{
if (!_openBtn) {
_openBtn = InitObject(UIButton);
[_openBtn setBackgroundImage:IMAGEBYENAME(@"graybtn_big") forState:UIControlStateNormal];
[_openBtn setBackgroundImage:IMAGEBYENAME(@"greenbtn_big") forState:UIControlStateSelected];
[_openBtn addTarget:self action:@selector(openBtnClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _openBtn;
}
- (UIImageView *)titleImageView{
if (!_titleImageView) {
_titleImageView = InitObject(UIImageView);
[_titleImageView setImage:IMAGEBYENAME(@"change_tep_title")];
}
return _titleImageView;
}
- (UIButton *)sureBtn{
if (!_sureBtn) {
_sureBtn = InitObject(UIButton);
[_sureBtn setBackgroundImage:IMAGEBYENAME(@"change_tep_bottom") forState:UIControlStateNormal];
[_sureBtn.titleLabel setFont:[UIFont systemFontOfSize:13]];
[_sureBtn setTitleColor:XWhite forState:UIControlStateNormal];
[_sureBtn setTitle:@"确 定" forState:UIControlStateNormal];
[_sureBtn addTarget:self action:@selector(sureBtnClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _sureBtn;
}
- (UILabel *)titleLabel{
if (!_titleLabel) {
_titleLabel = InitObject(UILabel);
_titleLabel.textColor = XWhite;
_titleLabel.font = [UIFont systemFontOfSize:13];
_titleLabel.text = @"设置水温";
}
return _titleLabel;
}
//masonry
-(void)loadLayout{
[self.bgButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.topUiPick mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kSizeFrom750(690));
make.height.mas_equalTo(kSizeFrom750(280));
make.centerY.centerX.mas_equalTo(self);
}];
[self.titleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.width.mas_equalTo(self.topUiPick);
make.bottom.mas_equalTo(self.topUiPick.mas_top);
make.height.mas_equalTo(kSizeFrom750(60));
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.height.mas_equalTo(self.titleImageView);
make.left.mas_equalTo(kSizeFrom750(30));
}];
[self.openBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kSizeFrom750(86));
make.height.mas_equalTo(kSizeFrom750(50));
make.right.mas_equalTo(self.titleImageView.mas_right).offset(-kSizeFrom750(40));
make.centerY.mas_equalTo(self.titleImageView);
}];
[self.bottomUiPicker mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.width.height.centerX.mas_equalTo(self.topUiPick);
}];
[self.sepImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.mas_equalTo(self.bottomUiPicker);
make.width.mas_equalTo(kSizeFrom750(24));
make.height.mas_equalTo(kSizeFrom750(264));
}];
[self.sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.width.height.mas_equalTo(self.titleImageView);
make.top.mas_equalTo(self.bottomUiPicker.mas_bottom);
}];
}
-(NSMutableArray *)data1{
if (_data1==nil) {
_data1=[NSMutableArray array];
_data2=[NSMutableArray array];
if (!_data1) {
_data1=InitObject(NSMutableArray);
}
return _data1;
}
-(NSMutableArray *)data2{
if (!_data2) {
_data2=InitObject(NSMutableArray);
}
return _data2;
}
-(NSMutableArray *)timeArr{
if (_timeArr==nil) {
_timeArr=[NSMutableArray array];
@@ -78,34 +223,36 @@
-(void)setViewType:(NSInteger)viewType{
_viewType=viewType;
self.topTempPicker.hidden=YES;
self.heightView.hidden=YES;
self.bottomPicker.hidden=YES;
self.topUiPick.hidden=YES;
self.bottomUiPicker.hidden=YES;
self.sepImage.hidden = YES;
self.openBtn.hidden = YES;
[self.data1 removeAllObjects];
[self.data2 removeAllObjects];
if (viewType==0) {// 设置水温
self.topTempPicker.hidden=NO;
self.bottomPicker.hidden=NO;
self.bottomTextF.text=@"请输设置预警温度";
self.topUiPick.hidden=NO;
[self.data1 addObjectsFromArray:self.templetrueArr];
[self.data2 addObjectsFromArray:self.templetrueArr];
[self.topUiPick reloadAllComponents];
[self.bottomUiPicker reloadAllComponents];
self.openBtn.hidden=NO;
self.pickerBottom.constant=240.0;
if ([self.hotVo.wornCode isEqualToString:@"01"]) {
self.openBtn.selected=YES;
}else{
self.openBtn.selected=NO;
}
if ( self.hotVo.heaterNum) {
self.hotVo.heaterNum=[self.hotVo.heaterNum stringByReplacingOccurrencesOfString:@"°c" withString:@""];
NSInteger heaterNum=round([self.hotVo.heaterNum integerValue]-20) ;
[self.topUiPick selectRow:heaterNum inComponent:0 animated:NO];
self.selectVaule1=self.hotVo.heaterNum;
}
}else if(viewType==1){//设置预警温度
[self.data1 addObjectsFromArray:self.templetrueArr];
[self.data2 addObjectsFromArray:self.templetrueArr];
self.bottomUiPicker.hidden=NO;
self.sepImage.hidden = NO;
self.openBtn.hidden = NO;
self.titleLabel.text=@"请设置预警温度:";
[self.bottomUiPicker reloadAllComponents];
if ([self.hotVo.wornCode isEqualToString:@"01"]) {
self.openBtn.selected=YES;
}else{
self.openBtn.selected=NO;
}
if (self.hotVo.downTeamp) {
self.hotVo.downTeamp=[self.hotVo.downTeamp stringByReplacingOccurrencesOfString:@"°c" withString:@""];
NSInteger downTeamp=round([self.hotVo.downTeamp integerValue]-20);
@@ -113,7 +260,6 @@
[self.bottomUiPicker selectRow:downTeamp inComponent:0 animated:NO];
self.selectVaule2=self.hotVo.downTeamp;
}
if (self.hotVo.upTeamp) {
self.hotVo.upTeamp=[self.hotVo.upTeamp stringByReplacingOccurrencesOfString:@"°c" withString:@""];
NSInteger upTeamp=round([self.hotVo.upTeamp integerValue]-20) ;
@@ -121,37 +267,17 @@
[self.bottomUiPicker selectRow:upTeamp inComponent:1 animated:NO];
self.selectVaule3=self.hotVo.upTeamp;
}
}else if(viewType==1){//容器大小
self.bottomTextF.text=@"请输入水体部分尺寸:";
self.heightView.hidden=NO;
self.bottomPicker.hidden=NO;
self.openBtn.hidden=YES;
[self.longTextF becomeFirstResponder];
self.pickerBottom.constant=340.0;
if (self.hotVo.heater) {
if(self.hotVo.heater.heaterLong.length){
self.longTextF.text=self.hotVo.heater.heaterLong;
}
if(self.hotVo.heater.heaterWidth.length){
self.widthTextF.text=self.hotVo.heater.heaterWidth;
}
if(self.hotVo.heater.heaterHeight.length){
self.heightTextF.text=self.hotVo.heater.heaterHeight;
}
}
}else if (viewType==2){//流量
self.bottomPicker.hidden=NO;
// self.bottomUiPicker.hidden=NO;
}else if (viewType==4){//换水周期
self.bottomPicker.hidden=NO;
self.bottomUiPicker.hidden=NO;
self.openBtn.hidden = NO;
self.sepImage.hidden = NO;
[self.data1 addObjectsFromArray:self.dayArr];
[self.data2 addObjectsFromArray:self.timeArr];
[self.topUiPick reloadAllComponents];
[self.bottomUiPicker reloadAllComponents];
self.bottomTextF.text=@"换水周期选择:";
self.openBtn.hidden=NO;
self.titleLabel.text=@"换水周期选择:";
self.selectVaule2=self.data1[0];
if (self.hotVo.heater.heaterCycle!=nil) {
@@ -169,21 +295,22 @@
self.openBtn.selected=NO;
self.selectVaule3=@"5";
}
}
// if(self.data1.count>0){
// self.selectVaule1=self.data1[0];
// self.selectVaule2=self.data1[0];
// }
// if (self.data2.count>0) {
// self.selectVaule3=self.data2[0];
// }
}
- (IBAction)clickSubmit:(id)sender {
//点击open按钮
- (void)openBtnClick:(UIButton *)sender {
sender.selected=!sender.selected;
if(self.viewType==0){
self.hotVo.wornCode=sender.selected?@"01":@"00";
[self.myDelegate clickWormCode:self.hotVo.wornCode];
}
}
//点击背景按钮
- (void)bgButtonClick:(UIButton *)sender {
self.hidden=YES;
}
//点击确定按钮
- (void)sureBtnClick:(UIButton *)sender{
self.hidden=YES;
if(_viewType==5){
[self.myDelegate didSelectRow1:self.selectVaule2 andRow2:self.selectVaule3];
@@ -192,8 +319,6 @@
NSString*code=self.openBtn.selected?@"01":@"00";
[self.myDelegate didSelectTeamptrue:self.selectVaule3 andDown:self.selectVaule2 andT:self.selectVaule1 andWarnCode:code];
}else if (_viewType==1){
[self.myDelegate submitText:self.widthTextF.text andh:self.heightTextF.text andV:self.longTextF.text];
}else if(_viewType==4){
// [self.myDelegate didSelectRemindTime:self.selectVaule2];
if(self.openBtn.selected==NO){
@@ -205,13 +330,6 @@
}
-(void)awakeFromNib{
[super awakeFromNib];
}
- (IBAction)clickBg:(id)sender {
self.hidden=YES;
}
//返回多少列
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
if (pickerView==self.topUiPick) {
@@ -239,7 +357,6 @@
//选中时的效果
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
// self.selectValue = self.data[row];
if (pickerView==self.topUiPick) {
self.selectVaule1=self.data1[row];
}else{
@@ -254,29 +371,10 @@
//返回高度
-(CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component{
return 35.0f;
return kSizeFrom750(50);
}
//返回宽度
//-(CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component{
// return ZYAppWidth;
//}
//-(UIView*)pickerView:(UIPickerView*)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView*)view {
// UIView *cellView = view;
// if (!cellView) {
// cellView = [[UIView alloc] init];
// }
// cellView.backgroundColor = [UIColor redColor];
// return cellView;
//}
- (IBAction)clickOpenBtn:(UIButton *)sender {
sender.selected=!sender.selected;
if(self.viewType==0){
self.hotVo.wornCode=sender.selected?@"01":@"00";
[self.myDelegate clickWormCode:self.hotVo.wornCode];
}
}
@end
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -15,261 +15,89 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fFD-6v-pYn">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fFD-6v-pYn">
<rect key="frame" x="13" y="0.0" width="348" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="clickBg:" destination="iN0-l3-epB" eventType="touchUpInside" id="74b-Bj-5Fq"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sS3-bH-IDb">
<rect key="frame" x="12" y="239" width="351" height="188"/>
<subviews>
<pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RVp-L7-2i4">
<rect key="frame" x="2" y="30" width="347" height="121"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="121" id="IpS-8R-glg"/>
</constraints>
<connections>
<outlet property="dataSource" destination="iN0-l3-epB" id="bpf-F0-O6b"/>
<outlet property="delegate" destination="iN0-l3-epB" id="Iu9-eg-yXC"/>
</connections>
</pickerView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="C1u-7E-RB7">
<rect key="frame" x="0.0" y="0.0" width="351" height="32"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="请设置预警温度" translatesAutoresizingMaskIntoConstraints="NO" id="xAc-ty-lpS">
<rect key="frame" x="0.0" y="0.0" width="351" height="32"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="换水预警温度" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4pR-AW-f8n">
<rect key="frame" x="23" y="7.5" width="92" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="S6l-x3-P2c">
<rect key="frame" x="304" y="4" width="43" height="25"/>
<constraints>
<constraint firstAttribute="width" constant="43" id="loB-UO-c2h"/>
<constraint firstAttribute="height" constant="25" id="mhg-Yr-ruS"/>
</constraints>
<state key="normal" backgroundImage="graybtn_big">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<state key="selected" backgroundImage="greenbtn_big"/>
<connections>
<action selector="clickOpenBtn:" destination="iN0-l3-epB" eventType="touchUpInside" id="xHx-yK-bIy"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="4pR-AW-f8n" firstAttribute="centerY" secondItem="C1u-7E-RB7" secondAttribute="centerY" id="CRt-1B-fzV"/>
<constraint firstItem="S6l-x3-P2c" firstAttribute="top" secondItem="C1u-7E-RB7" secondAttribute="top" constant="4" id="Fnv-H5-nRL"/>
<constraint firstAttribute="trailing" secondItem="S6l-x3-P2c" secondAttribute="trailing" constant="4" id="IMy-aI-aAJ"/>
<constraint firstAttribute="bottom" secondItem="xAc-ty-lpS" secondAttribute="bottom" id="K6j-dv-bHW"/>
<constraint firstAttribute="trailing" secondItem="xAc-ty-lpS" secondAttribute="trailing" id="M5l-nx-wBd"/>
<constraint firstItem="4pR-AW-f8n" firstAttribute="leading" secondItem="C1u-7E-RB7" secondAttribute="leading" constant="23" id="QDK-TY-a4v"/>
<constraint firstItem="xAc-ty-lpS" firstAttribute="top" secondItem="C1u-7E-RB7" secondAttribute="top" id="iLT-E1-Khh"/>
<constraint firstAttribute="height" constant="32" id="sdG-zg-Ubs"/>
<constraint firstItem="xAc-ty-lpS" firstAttribute="leading" secondItem="C1u-7E-RB7" secondAttribute="leading" id="uv8-Vh-cfq"/>
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="确定" translatesAutoresizingMaskIntoConstraints="NO" id="uSM-gf-3du">
<rect key="frame" x="0.0" y="149" width="351" height="39"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DFn-St-4KQ">
<rect key="frame" x="0.0" y="149" width="351" height="39"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="确定">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="clickSubmit:" destination="iN0-l3-epB" eventType="touchUpInside" id="OjP-Px-OoZ"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="虚线" translatesAutoresizingMaskIntoConstraints="NO" id="QsD-Cm-E7o">
<rect key="frame" x="169" y="38" width="12" height="112"/>
<constraints>
<constraint firstAttribute="height" constant="112" id="Jgo-Kw-3Zi"/>
<constraint firstAttribute="width" constant="12" id="rvZ-WU-Mep"/>
</constraints>
</imageView>
</subviews>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="请设置加热温度" translatesAutoresizingMaskIntoConstraints="NO" id="F6q-ri-gcL">
<rect key="frame" x="63" y="117" width="250" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="设置加热温度" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SXA-fW-bql" userLabel="设置加热温度">
<rect key="frame" x="31" y="123" width="115" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<pickerView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QZi-AX-KLU">
<rect key="frame" x="37" y="273" width="300" height="120"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="dataSource" destination="iN0-l3-epB" id="zHJ-Xe-CPh"/>
<outlet property="delegate" destination="iN0-l3-epB" id="aDE-0l-Fdd"/>
</connections>
</pickerView>
<pickerView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RVp-L7-2i4">
<rect key="frame" x="62" y="149" width="250" height="120"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="dataSource" destination="iN0-l3-epB" id="bpf-F0-O6b"/>
<outlet property="delegate" destination="iN0-l3-epB" id="Iu9-eg-yXC"/>
</connections>
</pickerView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DFn-St-4KQ">
<rect key="frame" x="13" y="385" width="351" height="39"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="uSM-gf-3du" firstAttribute="top" secondItem="DFn-St-4KQ" secondAttribute="top" id="2Mm-TX-Ho8"/>
<constraint firstItem="QsD-Cm-E7o" firstAttribute="centerY" secondItem="sS3-bH-IDb" secondAttribute="centerY" id="3Jk-ON-XOc"/>
<constraint firstItem="DFn-St-4KQ" firstAttribute="top" secondItem="RVp-L7-2i4" secondAttribute="bottom" constant="-2" id="72H-6i-OnZ"/>
<constraint firstAttribute="trailing" secondItem="RVp-L7-2i4" secondAttribute="trailing" constant="2" id="BSX-ha-MSF"/>
<constraint firstItem="RVp-L7-2i4" firstAttribute="leading" secondItem="sS3-bH-IDb" secondAttribute="leading" constant="2" id="Duh-mE-cF7"/>
<constraint firstItem="DFn-St-4KQ" firstAttribute="leading" secondItem="sS3-bH-IDb" secondAttribute="leading" id="KP6-ro-VqG"/>
<constraint firstAttribute="height" constant="188" id="QO6-Fn-SJj"/>
<constraint firstAttribute="trailing" secondItem="uSM-gf-3du" secondAttribute="trailing" id="RRq-Hk-N77"/>
<constraint firstAttribute="trailing" secondItem="C1u-7E-RB7" secondAttribute="trailing" id="cG9-V3-y7h"/>
<constraint firstAttribute="bottom" secondItem="DFn-St-4KQ" secondAttribute="bottom" id="dMR-sN-atJ"/>
<constraint firstAttribute="bottom" secondItem="uSM-gf-3du" secondAttribute="bottom" id="fMd-o1-a2o"/>
<constraint firstItem="RVp-L7-2i4" firstAttribute="top" secondItem="C1u-7E-RB7" secondAttribute="bottom" constant="-2" id="jUy-wH-ERt"/>
<constraint firstAttribute="trailing" secondItem="DFn-St-4KQ" secondAttribute="trailing" id="ltS-Cj-2lG"/>
<constraint firstItem="C1u-7E-RB7" firstAttribute="top" secondItem="sS3-bH-IDb" secondAttribute="top" id="nWv-t9-wGe"/>
<constraint firstItem="QsD-Cm-E7o" firstAttribute="centerX" secondItem="sS3-bH-IDb" secondAttribute="centerX" id="zBn-X6-4WK"/>
<constraint firstItem="C1u-7E-RB7" firstAttribute="leading" secondItem="sS3-bH-IDb" secondAttribute="leading" id="zFi-SE-D7e"/>
<constraint firstItem="uSM-gf-3du" firstAttribute="leading" secondItem="sS3-bH-IDb" secondAttribute="leading" id="zwB-mw-2xl"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UWW-Ib-xQ3" userLabel="设置容器高度">
<rect key="frame" x="14" y="274" width="347" height="118"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="长宽" translatesAutoresizingMaskIntoConstraints="NO" id="VGT-Vs-9H2">
<rect key="frame" x="0.0" y="0.0" width="347" height="118"/>
</imageView>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="8cR-O7-A7z">
<rect key="frame" x="58" y="67" width="49" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="49" id="ITT-cl-rS3"/>
<constraint firstAttribute="height" constant="20" id="SZ5-OH-yXi"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="AC4-7c-ujI">
<rect key="frame" x="221" y="30" width="48" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="B1X-7U-tcD"/>
<constraint firstAttribute="width" constant="48" id="LVS-he-GHZ"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="2LO-Mp-im1">
<rect key="frame" x="58" y="30" width="49" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="2yd-7Q-Ykb"/>
<constraint firstAttribute="width" constant="49" id="ynt-rK-riP"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="VGT-Vs-9H2" secondAttribute="bottom" id="9TD-pz-c2u"/>
<constraint firstItem="2LO-Mp-im1" firstAttribute="top" secondItem="UWW-Ib-xQ3" secondAttribute="top" constant="30" id="9r2-wR-fa1"/>
<constraint firstItem="8cR-O7-A7z" firstAttribute="top" secondItem="2LO-Mp-im1" secondAttribute="bottom" constant="17" id="FoN-Ym-ygh"/>
<constraint firstItem="2LO-Mp-im1" firstAttribute="leading" secondItem="UWW-Ib-xQ3" secondAttribute="leading" constant="58" id="LeA-cK-gXT"/>
<constraint firstItem="VGT-Vs-9H2" firstAttribute="top" secondItem="UWW-Ib-xQ3" secondAttribute="top" id="ZMR-fp-1b0"/>
<constraint firstItem="AC4-7c-ujI" firstAttribute="top" secondItem="UWW-Ib-xQ3" secondAttribute="top" constant="30" id="eBB-wB-pPq"/>
<constraint firstAttribute="trailing" secondItem="VGT-Vs-9H2" secondAttribute="trailing" id="fwJ-As-qhZ"/>
<constraint firstItem="8cR-O7-A7z" firstAttribute="centerX" secondItem="2LO-Mp-im1" secondAttribute="centerX" id="iST-gw-MgC"/>
<constraint firstItem="VGT-Vs-9H2" firstAttribute="leading" secondItem="UWW-Ib-xQ3" secondAttribute="leading" id="rHT-K0-Jjm"/>
<constraint firstAttribute="trailing" secondItem="AC4-7c-ujI" secondAttribute="trailing" constant="78" id="tVe-FM-oCk"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GUi-mC-ZWy" userLabel="设置加热器">
<rect key="frame" x="12" y="89" width="351" height="150"/>
<subviews>
<pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QZi-AX-KLU">
<rect key="frame" x="2" y="32" width="347" height="121"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="121" id="2En-mk-g0A"/>
</constraints>
<connections>
<outlet property="dataSource" destination="iN0-l3-epB" id="zHJ-Xe-CPh"/>
<outlet property="delegate" destination="iN0-l3-epB" id="aDE-0l-Fdd"/>
</connections>
</pickerView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4IT-77-VkG">
<rect key="frame" x="0.0" y="0.0" width="351" height="32"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="请设置加热温度" translatesAutoresizingMaskIntoConstraints="NO" id="F6q-ri-gcL">
<rect key="frame" x="0.0" y="0.0" width="351" height="32"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="设置加热温度" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SXA-fW-bql" userLabel="设置加热温度">
<rect key="frame" x="23" y="7.5" width="92" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="F6q-ri-gcL" firstAttribute="top" secondItem="4IT-77-VkG" secondAttribute="top" id="8WV-X9-ZJM"/>
<constraint firstItem="SXA-fW-bql" firstAttribute="centerY" secondItem="4IT-77-VkG" secondAttribute="centerY" id="LIY-Xa-PVU"/>
<constraint firstItem="F6q-ri-gcL" firstAttribute="leading" secondItem="4IT-77-VkG" secondAttribute="leading" id="PSm-cp-l4I"/>
<constraint firstItem="SXA-fW-bql" firstAttribute="leading" secondItem="4IT-77-VkG" secondAttribute="leading" constant="23" id="Q12-gY-Hxf"/>
<constraint firstAttribute="trailing" secondItem="F6q-ri-gcL" secondAttribute="trailing" id="fzk-zq-gy8"/>
<constraint firstAttribute="height" constant="32" id="tQQ-CZ-UJn"/>
<constraint firstAttribute="bottom" secondItem="F6q-ri-gcL" secondAttribute="bottom" id="xCl-An-0fg"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="4IT-77-VkG" firstAttribute="top" secondItem="GUi-mC-ZWy" secondAttribute="top" id="3cb-gI-b1F"/>
<constraint firstAttribute="height" constant="150" id="5dQ-pp-J3A"/>
<constraint firstItem="QZi-AX-KLU" firstAttribute="top" secondItem="4IT-77-VkG" secondAttribute="bottom" id="C0u-k6-ihz"/>
<constraint firstItem="4IT-77-VkG" firstAttribute="leading" secondItem="GUi-mC-ZWy" secondAttribute="leading" id="Mqi-2O-6Gj"/>
<constraint firstItem="QZi-AX-KLU" firstAttribute="leading" secondItem="GUi-mC-ZWy" secondAttribute="leading" constant="2" id="NYh-fM-kU2"/>
<constraint firstAttribute="trailing" secondItem="QZi-AX-KLU" secondAttribute="trailing" constant="2" id="kEl-iA-pC4"/>
<constraint firstAttribute="trailing" secondItem="4IT-77-VkG" secondAttribute="trailing" id="zq2-39-h2m"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<state key="normal" title="确 定" backgroundImage="确定">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="clickSubmit:" destination="iN0-l3-epB" eventType="touchUpInside" id="OjP-Px-OoZ"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="虚线" translatesAutoresizingMaskIntoConstraints="NO" id="QsD-Cm-E7o">
<rect key="frame" x="181" y="273" width="12" height="112"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="S6l-x3-P2c">
<rect key="frame" x="306" y="120" width="43" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" backgroundImage="graybtn_big">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<state key="selected" backgroundImage="greenbtn_big"/>
<connections>
<action selector="clickOpenBtn:" destination="iN0-l3-epB" eventType="touchUpInside" id="xHx-yK-bIy"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.1347388698630137" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="fFD-6v-pYn" secondAttribute="trailing" id="2Ku-hM-Gmb"/>
<constraint firstItem="sS3-bH-IDb" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="12" id="47Y-la-C7u"/>
<constraint firstItem="sS3-bH-IDb" firstAttribute="top" secondItem="GUi-mC-ZWy" secondAttribute="bottom" id="51h-Fe-bOX"/>
<constraint firstItem="UWW-Ib-xQ3" firstAttribute="top" secondItem="sS3-bH-IDb" secondAttribute="top" constant="35" id="C3d-Jz-gnZ"/>
<constraint firstItem="fFD-6v-pYn" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="M3n-S0-Lmj"/>
<constraint firstItem="UWW-Ib-xQ3" firstAttribute="bottom" secondItem="sS3-bH-IDb" secondAttribute="bottom" constant="-35" id="N6X-0h-OQp"/>
<constraint firstAttribute="bottom" secondItem="sS3-bH-IDb" secondAttribute="bottom" constant="240" id="Wvv-fr-my6"/>
<constraint firstAttribute="bottom" secondItem="fFD-6v-pYn" secondAttribute="bottom" id="Xm7-Ep-fOQ"/>
<constraint firstAttribute="trailing" secondItem="sS3-bH-IDb" secondAttribute="trailing" constant="12" id="dTS-pW-dyJ"/>
<constraint firstItem="GUi-mC-ZWy" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="12" id="fUb-aa-feS"/>
<constraint firstAttribute="trailing" secondItem="UWW-Ib-xQ3" secondAttribute="trailing" constant="14" id="qxd-yx-0wN"/>
<constraint firstItem="UWW-Ib-xQ3" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="vEs-Cc-e6u"/>
<constraint firstItem="fFD-6v-pYn" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="vX9-W8-fdB"/>
<constraint firstAttribute="trailing" secondItem="GUi-mC-ZWy" secondAttribute="trailing" constant="12" id="xnk-A8-mY0"/>
</constraints>
<connections>
<outlet property="bottomPicker" destination="sS3-bH-IDb" id="dA5-DG-v9K"/>
<outlet property="bottomTextF" destination="4pR-AW-f8n" id="yMf-aj-etI"/>
<outlet property="bgButton" destination="fFD-6v-pYn" id="XRu-5N-NxG"/>
<outlet property="bottomUiPicker" destination="RVp-L7-2i4" id="n8s-6e-Ybu"/>
<outlet property="heightTextF" destination="8cR-O7-A7z" id="VIW-tJ-uOr"/>
<outlet property="heightView" destination="UWW-Ib-xQ3" id="cBM-Tc-aUU"/>
<outlet property="longTextF" destination="2LO-Mp-im1" id="UXa-Ec-lE2"/>
<outlet property="openBtn" destination="S6l-x3-P2c" id="rFd-hL-k2Q"/>
<outlet property="picker" destination="RVp-L7-2i4" id="kaf-wt-kXj"/>
<outlet property="pickerBottom" destination="Wvv-fr-my6" id="AR9-Ii-lU1"/>
<outlet property="topTempPicker" destination="GUi-mC-ZWy" id="wou-bx-Jr6"/>
<outlet property="sepImage" destination="QsD-Cm-E7o" id="Xh1-IW-SPc"/>
<outlet property="sureBtn" destination="DFn-St-4KQ" id="mVU-eX-94h"/>
<outlet property="titleImageView" destination="F6q-ri-gcL" id="Pm2-5L-NGm"/>
<outlet property="titleLabel" destination="SXA-fW-bql" id="95p-nV-DEx"/>
<outlet property="topUiPick" destination="QZi-AX-KLU" id="svk-gv-AnC"/>
<outlet property="widthTextF" destination="AC4-7c-ujI" id="oxg-lr-VbK"/>
</connections>
<point key="canvasLocation" x="33.5" y="103.5"/>
<point key="canvasLocation" x="32.799999999999997" y="102.99850074962519"/>
</view>
</objects>
<resources>
<image name="graybtn_big" width="86" height="47"/>
<image name="greenbtn_big" width="86" height="47"/>
<image name="确定" width="375" height="55"/>
<image name="虚线" width="12" height="111"/>
<image name="虚线" width="12" height="111.5"/>
<image name="请设置加热温度" width="375" height="48"/>
<image name="请设置预警温度" width="375" height="52"/>
<image name="长宽" width="347" height="120"/>
</resources>
</document>
@@ -10,4 +10,5 @@
@interface IfishChatView : UIView
@property(nonatomic,strong)NSArray*datas;
-(void)reloadHeater;//刷新流量状态
@end
+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;
+133 -12
View File
@@ -13,18 +13,142 @@
#import "SVProgressHUD.h"
@interface IfishHistoryView()
@property (strong, nonatomic)IfishChatView *chartView;
@property (weak, nonatomic) IBOutlet IfishChatView *chartHolder;
Strong UIButton *bgButton;
Strong UIView *bgView;
Strong IfishChatView *chartView;
Strong IfishChatView *chartHolder;
Strong UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *chartHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *chartWidth;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *lableHeight;
@property (weak, nonatomic) IBOutlet UILabel *curDatetitle;
Strong UIButton *predayButton;
Strong UIButton *nextdayButton;
Strong UIImageView *bgImage;
@property(nonatomic,strong)NSMutableArray*line1;
@end
@implementation IfishHistoryView
- (instancetype)init
{
self = [super init];
if (self) {
[self addSubview:self.bgButton];
[self addSubview:self.bgView];
[self.bgView addSubview:self.titleLabel];
[self.bgView addSubview:self.bgImage];
[self.bgView addSubview:self.chartHolder];
[self.bgView addSubview:self.predayButton];
[self.bgView addSubview:self.nextdayButton];
[self loadLayout];
}
return self;
}
- (UIButton *)bgButton{
if (!_bgButton) {
_bgButton = InitObject(UIButton);
[_bgButton setBackgroundColor:RGBA(0, 0, 0, 0.3)];
[_bgButton addTarget:self action:@selector(bgButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _bgButton;
}
- (UIView *)bgView{
if (!_bgView) {
_bgView = InitObject(UIView);
_bgView.backgroundColor = XWhite;
_bgView.layer.masksToBounds = YES;
_bgView.layer.cornerRadius = 15;
}
return _bgView;
}
- (UIImageView *)bgImage{
if (!_bgImage) {
_bgImage = InitObject(UIImageView);
[_bgImage setImage:IMAGEBYENAME(@"history_bg")];
}
return _bgImage;
}
- (IfishChatView *)chartHolder{
if (!_chartHolder) {
_chartHolder = InitObject(IfishChatView);
}
return _chartHolder;
}
- (UILabel *)titleLabel{
if (!_titleLabel) {
_titleLabel = InitObject(UILabel);
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = RGB(51, 51, 51);
_titleLabel.font = [UIFont systemFontOfSize:13];
}
return _titleLabel;
}
- (UIButton *)predayButton{
if (!_predayButton) {
_predayButton = InitObject(UIButton);
// [_predayButton setTitle:@"前一天" forState:UIControlStateNormal];
[_predayButton addTarget:self action:@selector(dayChangeClick:) forControlEvents:UIControlEventTouchUpInside];
[_predayButton.titleLabel setFont:[UIFont systemFontOfSize:13]];
// [_predayButton setTitleColor:RGB(51, 51, 51) forState:UIControlStateNormal];
_predayButton.tag = 10;
}
return _predayButton;
}
- (UIButton *)nextdayButton{
if (!_nextdayButton) {
_nextdayButton = InitObject(UIButton);
// [_nextdayButton setTitle:@"后一天" forState:UIControlStateNormal];
[_nextdayButton addTarget:self action:@selector(dayChangeClick:) forControlEvents:UIControlEventTouchUpInside];
[_nextdayButton.titleLabel setFont:[UIFont systemFontOfSize:13]];
// [_nextdayButton setTitleColor:RGB(51, 51, 51) forState:UIControlStateNormal];
_nextdayButton.tag = 11;
}
return _nextdayButton;
}
-(void)loadLayout{
[self.bgButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(315);
make.center.mas_equalTo(self);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.bgView);
make.top.mas_equalTo(4);
make.height.mas_equalTo(20);
}];
[self.bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(8);
make.centerX.width.mas_equalTo(self.bgView);
make.height.mas_equalTo(147);
make.bottom.mas_equalTo(self.bgView.mas_bottom).offset(-10);
}];
[self.chartHolder mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.width.mas_equalTo(self.bgImage);
make.height.mas_equalTo(130);
}];
[self.predayButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.height.mas_equalTo(30);
make.width.mas_equalTo(60);
make.bottom.mas_equalTo(self.bgView.mas_bottom);
}];
[self.nextdayButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.centerY.mas_equalTo(self.predayButton);
make.right.mas_equalTo(-20);
}];
[self.bgImage layoutIfNeeded];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
@@ -56,20 +180,17 @@
_chartView=nil;
}
self.chartView.datas=datas;
self.curDatetitle.text=self.curdateStr;
[self.chartView reloadHeater];
self.titleLabel.text=self.curdateStr;
// [self initLineChart];
}
- (IBAction)clickBg:(id)sender {
#pragma mark --buttonClick
-(void)bgButtonClick:(UIButton *)sender{
self.hidden=YES;
}
- (IBAction)clickBottomBar:(UIButton*)sender {
-(void)dayChangeClick:(UIButton *)sender{
[self.myDeleget clickBottomBarWithIdx:sender.tag];
}
@end
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -21,7 +21,7 @@
<action selector="clickBg:" destination="iN0-l3-epB" eventType="touchUpInside" id="d08-z9-v9h"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gCt-ke-ZyH">
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gCt-ke-ZyH">
<rect key="frame" x="10" y="164.5" width="355" height="338"/>
<subviews>
<button opaque="NO" tag="10" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Wvo-bU-MzQ">
@@ -35,7 +35,7 @@
</connections>
</button>
<button opaque="NO" tag="11" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="867-ay-tug">
<rect key="frame" x="305" y="300" width="40" height="28"/>
<rect key="frame" x="265" y="300" width="40" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="后一天">
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -44,11 +44,11 @@
<action selector="clickBottomBar:" destination="iN0-l3-epB" eventType="touchUpInside" id="ULN-iZ-cCh"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="走势图" translatesAutoresizingMaskIntoConstraints="NO" id="KOt-M2-Dd2">
<rect key="frame" x="20" y="9.5" width="315" height="270"/>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="history_bg" translatesAutoresizingMaskIntoConstraints="NO" id="KOt-M2-Dd2">
<rect key="frame" x="0.0" y="10" width="315" height="270"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Qbs-BN-bJI" customClass="IfishChatView">
<rect key="frame" x="20" y="10" width="315" height="270"/>
<rect key="frame" x="0.0" y="10" width="315" height="270"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dIS-Dw-qe1">
<rect key="frame" x="157.5" y="4" width="0.0" height="0.0"/>
@@ -66,7 +66,7 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="图表中温度,流量为0或不存在时图表中不体现" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gwB-Ff-4Go">
<rect key="frame" x="72" y="288" width="211" height="12"/>
<rect key="frame" x="52" y="288" width="211" height="12"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
@@ -84,6 +84,7 @@
<constraint firstItem="gwB-Ff-4Go" firstAttribute="top" secondItem="Qbs-BN-bJI" secondAttribute="bottom" constant="8" id="c6L-8J-cWA"/>
<constraint firstItem="KOt-M2-Dd2" firstAttribute="height" secondItem="Qbs-BN-bJI" secondAttribute="height" id="dld-AE-g6d"/>
<constraint firstItem="Wvo-bU-MzQ" firstAttribute="leading" secondItem="gCt-ke-ZyH" secondAttribute="leading" constant="10" id="e1d-jF-7D0"/>
<constraint firstAttribute="width" constant="315" id="gGB-dF-pUn"/>
<constraint firstItem="KOt-M2-Dd2" firstAttribute="centerX" secondItem="Qbs-BN-bJI" secondAttribute="centerX" id="kVe-Gj-il4"/>
<constraint firstItem="KOt-M2-Dd2" firstAttribute="top" secondItem="Qbs-BN-bJI" secondAttribute="top" id="sZQ-CQ-LGw"/>
<constraint firstAttribute="bottom" secondItem="867-ay-tug" secondAttribute="bottom" constant="10" id="ySi-fC-9Of"/>
@@ -93,21 +94,20 @@
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.20994755993150685" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="gCt-ke-ZyH" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="3wc-85-00z"/>
<constraint firstItem="gCt-ke-ZyH" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="10" id="55m-6M-dcc"/>
<constraint firstAttribute="bottom" secondItem="69h-Z5-zDB" secondAttribute="bottom" id="8ZV-V1-tgA"/>
<constraint firstItem="69h-Z5-zDB" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="OcJ-PS-bmM"/>
<constraint firstAttribute="trailing" secondItem="69h-Z5-zDB" secondAttribute="trailing" id="TYK-Fj-3Kv"/>
<constraint firstAttribute="trailing" secondItem="gCt-ke-ZyH" secondAttribute="trailing" constant="10" id="eMu-Wt-oOw"/>
<constraint firstItem="69h-Z5-zDB" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="lLw-5d-kFj"/>
</constraints>
<connections>
<outlet property="bgView" destination="gCt-ke-ZyH" id="iMM-jo-xud"/>
<outlet property="chartHolder" destination="Qbs-BN-bJI" id="FDp-Om-vbH"/>
<outlet property="curDatetitle" destination="dIS-Dw-qe1" id="brm-O7-fOG"/>
</connections>
<point key="canvasLocation" x="33.5" y="122.5"/>
<point key="canvasLocation" x="-102" y="120"/>
</view>
</objects>
<resources>
<image name="走势图" width="526" height="453"/>
<image name="history_bg" width="526" height="453.5"/>
</resources>
</document>