| | |
| | | BMKActionPaopaoView * pPaopaoView; |
| | | UILabel * titleLabel; |
| | | UILabel * addressLabel; |
| | | UILabel * macLabel; |
| | | NSTimer * myTimer; // 更新设备状态 |
| | | int hCurrentIndex; |
| | | } |
| | |
| | | annotationView.annotation = annotation; |
| | | |
| | | // 设定popView的高度 |
| | | CGFloat hWidth = 180; |
| | | CGFloat hWidth = 200; |
| | | CGFloat hHight = 80; |
| | | if(popView == nil) |
| | | { |
| | |
| | | // title |
| | | if(titleLabel==nil) |
| | | { |
| | | titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(AdaptedWidth(10), AdaptedHeight(10), AdaptedWidth(hWidth-20-10), AdaptedHeight(20))]; |
| | | titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(AdaptedWidth(10), AdaptedHeight(10), AdaptedWidth(hWidth-20-10), AdaptedHeight(15))]; |
| | | |
| | | titleLabel.font = AdaptedFontSize(10); |
| | | titleLabel.textColor = kUIColorFromRGB(0xff7800); |
| | |
| | | [popViewBk addSubview:titleLabel]; |
| | | } |
| | | |
| | | // title |
| | | if(macLabel==nil) |
| | | { |
| | | macLabel = [[UILabel alloc]initWithFrame:CGRectMake(AdaptedWidth(10), AdaptedHeight(10+15+2), AdaptedWidth(hWidth-20-10), AdaptedHeight(15))]; |
| | | |
| | | macLabel.font = AdaptedFontSize(9); |
| | | macLabel.textColor = kUIColorFromRGB(0x595959); |
| | | macLabel.textAlignment = NSTextAlignmentLeft; |
| | | [popViewBk addSubview:macLabel]; |
| | | } |
| | | |
| | | // 地址 |
| | | if(addressLabel==nil) |
| | | { |
| | | addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(AdaptedWidth(10), AdaptedHeight(10+20+2), AdaptedWidth(hWidth-20-10), AdaptedHeight(20))]; |
| | | addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(AdaptedWidth(10), AdaptedHeight(10+15+2+15+2), AdaptedWidth(hWidth-20-10), AdaptedHeight(15))]; |
| | | |
| | | addressLabel.textColor = kUIColorFromRGB(0x595959); |
| | | addressLabel.textAlignment = NSTextAlignmentLeft; |
| | | addressLabel.font = AdaptedFontSize(10); |
| | | addressLabel.font = AdaptedFontSize(9); |
| | | [popViewBk addSubview:addressLabel]; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | titleLabel.text = pModel.device_name; |
| | | addressLabel.text = pModel.address; |
| | | macLabel.text = [NSString stringWithFormat:@"MAC:%@",pModel.mac]; |
| | | addressLabel.text = [NSString stringWithFormat:@"地址:%@",pModel.address]; |
| | | |
| | | ((BMKPinAnnotationView *)annotationView).paopaoView = pPaopaoView; |
| | | popView = ((BMKPinAnnotationView *)annotationView).paopaoView ; |
| | |
| | | |
| | | -(void)clickPopView |
| | | { |
| | | DetailDataViewController * page = [[DetailDataViewController alloc] init]; |
| | | //[self presentViewController:page animated:YES completion:nil]; |
| | | page.deviceModel = [self.deviceSevice.deviceViewModels objectAtIndex:hCurrentIndex]; |
| | | [UserDefault setObject:page.deviceModel.mac forKey:@"mac"]; |
| | | [UserDefault setObject:page.deviceModel.state forKey:@"state"]; |
| | | [UserDefault synchronize];//使用synchronize强制立即将数据写入磁盘,防止在写完NSUserDefaults后程序退出导致的数据丢失 |
| | | [self.navigationController pushViewController:page animated:YES]; |
| | | NSLog(@"clickPopView"); |
| | | DeviceModel* model = [self.deviceSevice.deviceViewModels objectAtIndex:hCurrentIndex]; |
| | | |
| | | if([model.state intValue] == 4) |
| | | { |
| | | // Make toast with a title |
| | | [self.navigationController.view makeToast:@"该设备维保中,不能获取实时数据!" |
| | | duration:3.0 |
| | | position:CSToastPositionBottom |
| | | title:@"温馨提示" |
| | | image:nil |
| | | style:nil |
| | | completion:nil]; |
| | | |
| | | //[MBProgressHUD showWarn:@"该设备维保中,不能获取实时数据!" ToView:self.view]; |
| | | //[Global alertMessageEx:@"该设备维保中,不能获取实时数据!" title:@"系统提示" okTtitle:nil cancelTitle:@"确定" delegate:self]; |
| | | } |
| | | else |
| | | { |
| | | DetailDataViewController * page = [[DetailDataViewController alloc] init]; |
| | | //[self presentViewController:page animated:YES completion:nil]; |
| | | page.deviceModel = [self.deviceSevice.deviceViewModels objectAtIndex:hCurrentIndex]; |
| | | [UserDefault setObject:page.deviceModel.mac forKey:@"mac"]; |
| | | [UserDefault setObject:page.deviceModel.state forKey:@"state"]; |
| | | [UserDefault synchronize];//使用synchronize强制立即将数据写入磁盘,防止在写完NSUserDefaults后程序退出导致的数据丢失 |
| | | [self.navigationController pushViewController:page animated:YES]; |
| | | NSLog(@"clickPopView"); |
| | | } |
| | | } |
| | | |
| | | -(void)closePopView |
| | |
| | | { |
| | | DeviceModel *pModel = [self.deviceSevice.deviceViewModels objectAtIndex:[((BMKPointAnnotation*)view.annotation).customIndex intValue]]; |
| | | titleLabel.text = pModel.device_name; |
| | | addressLabel.text = pModel.address; |
| | | macLabel.text = [NSString stringWithFormat:@"MAC:%@",pModel.mac]; |
| | | addressLabel.text = [NSString stringWithFormat:@"地址:%@",pModel.address]; |
| | | hCurrentIndex = [((BMKPointAnnotation*)view.annotation).customIndex intValue]; |
| | | [popView setHidden:NO]; |
| | | NSLog(@"didSelectAnnotationView"); |
| | |
| | | } |
| | | else |
| | | { |
| | | [Global alertMessageEx:desc title:@"获取设备失败" okTtitle:nil cancelTitle:@"OK" delegate:self]; |
| | | // Make toast with a title |
| | | if(!bIsUpdate) |
| | | { |
| | | [Global alertMessageEx:desc title:@"获取设备失败" okTtitle:nil cancelTitle:@"OK" delegate:self]; |
| | | } |
| | | // [self.navigationController.view makeToast:@"该设备维保中,不能获取实时数据!" |
| | | // duration:3.0 |
| | | // position:CSToastPositionBottom |
| | | // title:@"温馨提示" |
| | | // image:nil |
| | | // style:nil |
| | | // completion:nil]; |
| | | } |
| | | }]; |
| | | } |