diff --git a/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate b/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate index 8b90228..f55da74 100644 Binary files a/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate and b/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 9d15ae8..0f1b99a 100644 --- a/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/tongxin.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -270,8 +270,8 @@ filePath = "tongxin/AppDelegate.m" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "237" - endingLineNumber = "237" + startingLineNumber = "240" + endingLineNumber = "240" landmarkName = "-pushRegistry:didReceiveIncomingPushWithPayload:forType:" landmarkType = "7"> @@ -286,8 +286,8 @@ filePath = "tongxin/AppDelegate.m" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "215" - endingLineNumber = "215" + startingLineNumber = "218" + endingLineNumber = "218" landmarkName = "-pushRegistry:didReceiveIncomingPushWithPayload:forType:" landmarkType = "7"> @@ -558,8 +558,8 @@ filePath = "tongxin/AppDelegate.m" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "151" - endingLineNumber = "151" + startingLineNumber = "154" + endingLineNumber = "154" landmarkName = "-showRootViewController" landmarkType = "7"> @@ -567,16 +567,16 @@ diff --git a/tongxin/AppDelegate.m b/tongxin/AppDelegate.m index 7e86ff2..6c60b1e 100644 --- a/tongxin/AppDelegate.m +++ b/tongxin/AppDelegate.m @@ -81,6 +81,9 @@ //高德 poi 搜索 [AMapServices sharedServices].apiKey = AMapKey; + [MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; + [MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree]; + [AMapSearchAPI updatePrivacyShow:(AMapPrivacyShowStatusDidShow) privacyInfo:(AMapPrivacyInfoStatusDidContain)]; [self initIQKeyBorard];//键盘自动调整 diff --git a/tongxin/MyTabBarViewController.h b/tongxin/MyTabBarViewController.h index 7ab914f..1137809 100644 --- a/tongxin/MyTabBarViewController.h +++ b/tongxin/MyTabBarViewController.h @@ -7,11 +7,12 @@ // #import +#import "MyTabBar.h" @interface MyTabBarViewController : UITabBarController - +@property (nonatomic ,strong) MyTabBar *mytabbar; -(void)removeTransitionImageView; @end diff --git a/tongxin/MyTabBarViewController.m b/tongxin/MyTabBarViewController.m index ad53b1b..2610f37 100644 --- a/tongxin/MyTabBarViewController.m +++ b/tongxin/MyTabBarViewController.m @@ -11,7 +11,6 @@ #import "myHelper.h" #import "MyMQTT.h" #import "User.h" -#import "MyTabBar.h" #import "JCManager.h" #import "WatchHomeViewController.h" #import "MoreViewController.h" @@ -37,7 +36,7 @@ @property (nonatomic,strong) UIImageView *TransitionImageView; -@property (nonatomic ,strong) MyTabBar *mytabbar; + @property (nonatomic ,strong) MapViewController *mapvc; diff --git a/tongxin/VC/Map/MapReviseViewController.m b/tongxin/VC/Map/MapReviseViewController.m index 2f9b382..0c8e5f0 100644 --- a/tongxin/VC/Map/MapReviseViewController.m +++ b/tongxin/VC/Map/MapReviseViewController.m @@ -58,9 +58,9 @@ make.height.mas_equalTo(Adapted(140)); }]; - //检查隐私合规 - [MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; - [MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree]; +// //检查隐私合规 +// [MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; +// [MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree]; //地图 _mapView = [[MAMapView alloc]initWithFrame:CGRectMake(0, iPhoneX_NavHeight, ScreenWidth, ScreenHeight-iPhoneX_NavHeight-Adapted(140))]; diff --git a/tongxin/VC/Map/MapViewController.m b/tongxin/VC/Map/MapViewController.m index 51e819d..904abac 100644 --- a/tongxin/VC/Map/MapViewController.m +++ b/tongxin/VC/Map/MapViewController.m @@ -18,7 +18,7 @@ //高德SDK #import #import - +#import //默认的定位位置 北京 #define DefineLocate CLLocationCoordinate2DMake(39.9086828351,116.3980865479) @@ -131,6 +131,10 @@ - (void)viewDidLoad { [super viewDidLoad]; + //检查隐私合规 + [MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; + [MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree]; + [AMapSearchAPI updatePrivacyShow:(AMapPrivacyShowStatusDidShow) privacyInfo:(AMapPrivacyInfoStatusDidContain)]; //self.title = @"定位"; self.zx_navTitleColor = KKTextColor; self.zx_navBarBackgroundColor = RGBA(255, 255, 255, .4); diff --git a/tongxin/VC/Map/TrackViewController.m b/tongxin/VC/Map/TrackViewController.m index d6955b9..58121d9 100644 --- a/tongxin/VC/Map/TrackViewController.m +++ b/tongxin/VC/Map/TrackViewController.m @@ -56,10 +56,10 @@ - (void)viewDidLoad { [super viewDidLoad]; self.zx_hideBaseNavBar = YES; - //检查隐私合规 - [MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; - [MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree]; - [AMapSearchAPI updatePrivacyShow:(AMapPrivacyShowStatusDidShow) privacyInfo:(AMapPrivacyInfoStatusDidContain)]; +// //检查隐私合规 +// [MAMapView updatePrivacyShow:AMapPrivacyShowStatusDidShow privacyInfo:AMapPrivacyInfoStatusDidContain]; +// [MAMapView updatePrivacyAgree:AMapPrivacyAgreeStatusDidAgree]; +// [AMapSearchAPI updatePrivacyShow:(AMapPrivacyShowStatusDidShow) privacyInfo:(AMapPrivacyInfoStatusDidContain)]; [self.myTableView registerNib:[UINib nibWithNibName:@"NewTrackMsgCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"NewTrackMsgCellID"]; //去线 diff --git a/tongxin/VC/More/MoreViewController.m b/tongxin/VC/More/MoreViewController.m index 981db5f..d527ef8 100644 --- a/tongxin/VC/More/MoreViewController.m +++ b/tongxin/VC/More/MoreViewController.m @@ -77,7 +77,7 @@ _moreTableView.backgroundColor = KKClearColor; _moreTableView.tableHeaderView = self.headerView; // _moreTableView.tableHeaderView.height = 255; - _moreTableView.tableHeaderView.height = 100; + _moreTableView.tableHeaderView.height = 120; [_moreTableView registerClass:MyTableViewCell.class forCellReuseIdentifier:NSStringFromClass(MyTableViewCell.class)]; } return _moreTableView; @@ -89,7 +89,7 @@ { _headerView = [[MyTableViewHeaderView alloc] init]; // _headerView.frame = CGRectMake(0, 0, ScreenWidth, 255); - _headerView.frame = CGRectMake(0, 0, ScreenWidth, 100); + _headerView.frame = CGRectMake(0, 0, ScreenWidth, 120); [_headerView seCellModel]; } return _headerView; diff --git a/tongxin/VC/WatchHome/NewHomeVC/HomeHeaderTableView.m b/tongxin/VC/WatchHome/NewHomeVC/HomeHeaderTableView.m index 82486e7..a055c07 100644 --- a/tongxin/VC/WatchHome/NewHomeVC/HomeHeaderTableView.m +++ b/tongxin/VC/WatchHome/NewHomeVC/HomeHeaderTableView.m @@ -11,13 +11,54 @@ #import "ZZBadgeButton.h" #import "User.h" #import "ContactsViewController.h" +#import +#import +#import +#import +#import "CustomAnnotationView.h" +#import "UserAnnotationView.h" +#import "AppDelegate.h" -@interface HomeHeaderTableView () +//默认的定位位置 北京 +#define DefineLocate CLLocationCoordinate2DMake(39.9086828351,116.3980865479) +@interface HomeHeaderTableView () @property (nonatomic ,strong) NSMutableArray *btnArr; @property (nonatomic ,weak) UILabel *titleLabel; +@property (nonatomic ,strong) MKMapView *mapView; + +@property (strong, nonatomic) Locate *curLocate;// 设备当前的 位置 +@property (strong, nonatomic) CLLocation *userLocate;// 用户当前的 位置 +@property (strong, nonatomic) MKPointAnnotation *curPointAnnotation; //设备 View +@property (strong, nonatomic) MKPointAnnotation *userPointAnnotation; //用户 View + +//逆地理编码 +@property (nonatomic, strong) AMapReGeocodeSearchRequest *regeo; +//逆地理编码使用的 +@property (nonatomic, strong) AMapSearchAPI *search; + +@property (nonatomic ,strong) UIView *msgView; + +// 定位类型的显示Image +@property (weak, nonatomic) UIImageView *locationTypeImageView; + +// 定位地址内容标题 +@property (weak, nonatomic) UILabel *locationAddressLabel; + +// 定位时间 +@property (weak, nonatomic) UILabel *locationTimeLabel; + +//定位类型 +@property (weak, nonatomic) UILabel *locationTypeLabel; + +//设备电量Image +@property (weak, nonatomic) UIImageView *deviceBatteryImage; + +//设备电量Label +@property (weak, nonatomic) UILabel *deviceBatteryLabel; + @end @implementation HomeHeaderTableView @@ -36,19 +77,45 @@ - (void)subHeaderView { - _tempCarouselView = [[XRCarouselView alloc] initWithFrame:CGRectMake(0, 10, ScreenWidth, ScreenWidth*0.4)]; - _tempCarouselView.changeMode = ChangeModeFade; - _tempCarouselView.time = 5.0f; - _tempCarouselView.imageArray = @[[UIImage imageNamed:@"img_banner"]]; - _tempCarouselView.placeholderImage = [UIImage imageNamed:@"img_banner"]; - [self addSubview:_tempCarouselView]; +// _tempCarouselView = [[XRCarouselView alloc] initWithFrame:CGRectMake(0, 10, ScreenWidth, ScreenWidth*0.4)]; +// _tempCarouselView.changeMode = ChangeModeFade; +// _tempCarouselView.time = 5.0f; +// _tempCarouselView.imageArray = @[[UIImage imageNamed:@"img_banner"]]; +// _tempCarouselView.placeholderImage = [UIImage imageNamed:@"img_banner"]; +// [self addSubview:_tempCarouselView]; + + + UIView *topView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKWhiteColorColor]; + [self addSubview:topView]; + [topView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self).inset(15); + make.top.equalTo(self).offset(15); + make.height.mas_equalTo(ScreenWidth*0.6); + }]; + + [topView addSubview:self.mapView]; + [self.mapView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(topView).inset(8); + make.top.equalTo(topView).offset(8); + make.bottom.equalTo(topView.mas_bottom).inset(8); + }]; + + + + [topView addSubview:self.msgView]; + [self.msgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(topView).inset(23); + make.bottom.equalTo(topView.mas_bottom).inset(15); + make.height.mas_equalTo(60); + }]; + UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKWhiteColorColor]; self.bgView = bgView; [self addSubview:bgView]; [bgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self).inset(15); - make.top.equalTo(_tempCarouselView.mas_bottom).offset(15); + make.top.equalTo(topView.mas_bottom).offset(15); make.height.mas_equalTo(113); }]; @@ -67,12 +134,12 @@ - (void)subBtnView { + [self loadData]; for (UIButton *views in self.bgView.subviews) { [views removeFromSuperview]; } self.btnArr = [NSMutableArray new]; - NSMutableArray *titleArray = [NSMutableArray new]; @@ -192,6 +259,359 @@ return customButton; } +-(MKMapView *)mapView +{ + if (!_mapView) + { + _mapView = [MKMapView new]; + _mapView.delegate=self; + UITapGestureRecognizer *tapPress = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(mapViewtapPressed)]; + [_mapView addGestureRecognizer:tapPress]; + } + return _mapView; +} + +- (void)loadData +{ + +// [self.locationManager startUpdatingLocation]; + if(cUser.cDevice.lastLocation){ + + self.curLocate = cUser.cDevice.lastLocation; + [self showCurPiont]; + [self mapView:self.mapView didSelectAnnotationView:[CustomAnnotationView new]]; + self.deviceBatteryImage.hidden = NO; + self.deviceBatteryLabel.hidden = NO; + self.locationTypeImageView.hidden = NO; + [self.locationAddressLabel mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.locationTypeImageView.mas_right).offset(15); + make.right.equalTo(self.msgView.mas_right).inset(15); + make.top.equalTo(self.locationTimeLabel.mas_bottom).offset(5); + }]; + } + else + { + [self setMapZoom:DefineLocate]; + self.locationTimeLabel.text = @""; + self.locationTypeLabel.text = @""; + self.locationAddressLabel.text = @"当前位置未知,请确保设备开机且能够联网,再点击定位按钮进行定位"; + self.deviceBatteryImage.hidden = YES; + self.deviceBatteryLabel.hidden = YES; + self.locationTypeImageView.hidden = YES; + [self.locationAddressLabel mas_remakeConstraints:^(MASConstraintMaker *make) { + make.right.left.equalTo(self.msgView).inset(15); + make.centerY.equalTo(self.msgView); + }]; + } + [self setBattery:cUser.cDevice.battery.intValue]; + +} + +- (void)setBattery:(int)battery +{ + // 电量 + NSString *imageName = @""; + if(battery == 0) + imageName = @"battery_0"; + else if (battery < 10) + imageName = @"battery_low"; + else if (battery < 20) + imageName = @"battery_1"; + else if (battery < 30) + imageName = @"battery_2"; + else if (battery < 40) + imageName = @"battery_3"; + else if (battery < 50) + imageName = @"battery_4"; + else if (battery < 60) + imageName = @"battery_4"; + else if (battery < 70) + imageName = @"battery_6"; + else if (battery < 80) + imageName = @"battery_7"; + else if (battery < 90) + imageName = @"battery_8"; + else if (battery < 100) + imageName = @"battery_9"; + else + imageName = @"battery_10"; + self.deviceBatteryImage.image = [myHelper getImageWithName:imageName]; + self.deviceBatteryLabel.text = [NSString stringWithFormat:@"%d%%",battery]; +} + +//MARK: 显示点 +/** + 显示点 + */ +-(void)showCurPiont +{ + + //要在地图上显示的点的数组 + NSMutableArray *pointArr = [NSMutableArray array]; + + CLLocationCoordinate2D coordinate2D = DefineLocate; + if (self.curLocate) { + //设置新的地图信息 + coordinate2D = CLLocationCoordinate2DMake([self.curLocate.lat doubleValue], + [self.curLocate.lon doubleValue]); + //删除原来的点 + if ([self.mapView.annotations containsObject:self.curPointAnnotation]) { + // NSInteger index = [self.mapView.annotations indexOfObject:curPointAnnotation]; + [self.mapView removeAnnotation:self.curPointAnnotation]; + } + self.curPointAnnotation.coordinate = coordinate2D; + + // 设备的 范围框 + if (self.curLocate.radius) { + CLLocationDistance radius = [self.curLocate.radius doubleValue]; + MKCircle *circle = [MKCircle circleWithCenterCoordinate:coordinate2D + radius:radius]; + [self.mapView removeOverlays:self.mapView.overlays]; + [self.mapView addOverlay:circle]; + } + [pointArr addObject:self.curPointAnnotation]; + } + + if(pointArr.count > 0){ + //如果 设备的位置存在则显示 设备的位置 + [self.mapView addAnnotations:pointArr]; + [self setMapZoom:coordinate2D]; + + }else{ + //调整位置 + //设置中心点为当前地图范围的中心点 + CLLocationCoordinate2D center = DefineLocate; + //不存在 则 显示用户的位置 + if(self.mapView.userLocation.isUpdating){ + center = self.mapView.userLocation.coordinate; + }else if(self.userLocate){ + center = self.userLocate.coordinate; + } + [self setMapZoom:center]; + } +} + +#pragma 缩小地图 +- (void)setMapZoom:(CLLocationCoordinate2D)centerCoordinate{ + // if (self.mapView.region.span.latitudeDelta > 20) { + + // MARK: carh update by lsz 22-5-12 增加坐标合法性判断 + @try { + if (CLLocationCoordinate2DIsValid(centerCoordinate)) { + MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(centerCoordinate, 2000, 2000); + [self.mapView setRegion:region animated:YES]; + } + } @catch (NSException *exception) { + + } @finally { + + } + + //} +} + +#pragma mark - 地图控件代理方法 +#pragma mark 显示大头针时调用,注意方法中的annotation参数是即将显示的大头针对象 +-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation{ + + if([annotation isEqual:self.curPointAnnotation]){ + //由于当前位置的标注也是一个大头针,所以此时需要判断,此代理方法返回nil使用默认大头针视图 + static NSString *key1=@"CustomAnnotationView"; + CustomAnnotationView *annotationView = (CustomAnnotationView*)[_mapView dequeueReusableAnnotationViewWithIdentifier:key1]; + //如果缓存池中不存在则新建 + if (!annotationView) { + annotationView =[[CustomAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:key1]; + annotationView.canShowCallout=NO;//不允许交互点击 + + }else{ + //重新设置此类大头针视图的大头针模型(因为有可能是从缓存池中取出来的,位置是放到缓存池时的位置) + annotationView.annotation = annotation; + } + //修改大头针视图 设置成头像 + [annotationView setImageWithURLString:cUser.cDevice.avator]; + //设置大小 + annotationView.frame = CGRectMake(0, 0, 40.5, 60); + //设置中心偏移量 + annotationView.centerOffset = CGPointMake(0, -26); + //定义详情视图偏移量 + annotationView.calloutOffset=CGPointMake(0, 12); + return annotationView; + }else if([annotation isKindOfClass:[MKUserLocation class]]){ + //由于当前位置的标注也是一个大头针,所以此时需要判断,此代理方法返回nil使用默认大头针视图 + static NSString *key1=@"UserAnnotationView"; + UserAnnotationView *annotationView = (UserAnnotationView*)[_mapView dequeueReusableAnnotationViewWithIdentifier:key1]; + //如果缓存池中不存在则新建 + if (!annotationView) { + annotationView =[[UserAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:key1]; + annotationView.canShowCallout=NO;//不允许交互点击 + + }else{ + //重新设置此类大头针视图的大头针模型(因为有可能是从缓存池中取出来的,位置是放到缓存池时的位置) + annotationView.annotation = annotation; + } + //修改大头针视图 设置成头像 + [annotationView setImageWithURLString:cUser.avator]; + //设置大小 + annotationView.frame = CGRectMake(0, 0, 40.5, 60); + //设置中心偏移量 + annotationView.centerOffset = CGPointMake(0, -26); + //定义详情视图偏移量 + annotationView.calloutOffset=CGPointMake(0, 12); + return annotationView; + } + return nil; +} + +//MARK: 点击地图 中的 标点 触发的方法 +-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view +{ + if([view isKindOfClass:[CustomAnnotationView class]]) + { + // 设备点 + self.locationTypeLabel.text = self.curLocate.loc_type; + if ([self.curLocate.loc_type isEqualToString:@"LBS"]) { + self.locationTypeImageView.image = [UIImage imageNamed:@"icon_base_station"]; + }else if([self.curLocate.loc_type isEqualToString:@"GPS"]){ + self.locationTypeImageView.image = [UIImage imageNamed:@"icon_positioning_g"]; + }else if([self.curLocate.loc_type isEqualToString:@"WIFI"]){ + self.locationTypeImageView.image = [UIImage imageNamed:@"icon_home_wifi"]; + }else{ + //是空的 LBS + self.locationTypeImageView.image = [UIImage imageNamed:@"icon_base_station"]; + self.locationTypeLabel.text = @"LBS"; + } + if(self.curLocate){ + NSString *dateStr = [myHelper distanceTimeWithBeforeTime:[self.curLocate.timestamp doubleValue]]; + self.locationTimeLabel.text = dateStr; + self.locationAddressLabel.text = self.curLocate.address.length > 0 ? self.curLocate.address : @"位置解析中..."; + } + + self.regeo.location = [AMapGeoPoint locationWithLatitude:[self.curLocate.lat floatValue] longitude:[self.curLocate.lon floatValue]]; + [self.search AMapReGoecodeSearch:self.regeo]; + + } +} +- (AMapReGeocodeSearchRequest *)regeo { + if (!_regeo) { + _regeo = [[AMapReGeocodeSearchRequest alloc]init]; + _regeo.requireExtension = YES; + } + return _regeo; +} + +- (AMapSearchAPI *)search { + if (!_search) { + _search = [[AMapSearchAPI alloc]init]; + _search.delegate = self; + } + return _search; +} + + +- (MKOverlayRenderer *)mapView:(MKMapView *)mapView viewForOverlay:(id )overlay +{ + if ([overlay isKindOfClass:[MKCircle class]]) + { + MKCircleRenderer *circle = [[MKCircleRenderer alloc] initWithOverlay:overlay]; + circle.strokeColor = [UIColor clearColor]; + + circle.fillColor = [[UIColor blueColor] colorWithAlphaComponent:0.1]; + + // circle.lineWidth = 1; + return circle; + } + + return nil; +} + +#pragma mark ====高德地图位置解析回调==== + +-(void)onReGeocodeSearchDone:(AMapReGeocodeSearchRequest *)request response:(AMapReGeocodeSearchResponse *)response{ + if (response.regeocode != nil) + { + NSString *name = response.regeocode.formattedAddress; + self.locationAddressLabel.text = name; + } +} + +- (UIView *)msgView +{ + if (!_msgView) + { + self.curPointAnnotation = [[MKPointAnnotation alloc] init]; + self.userPointAnnotation = [[MKPointAnnotation alloc] init]; + + _msgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:10 borderWidth:0 borderColor:KKClearColor]; + + UIImageView *locationTypeImageView = [UIImageView new]; + self.locationTypeImageView = locationTypeImageView; + [_msgView addSubview:locationTypeImageView]; + [locationTypeImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(_msgView).offset(15); + make.top.equalTo(_msgView).offset(14); + make.size.mas_equalTo(CGSizeMake(20, 18)); + }]; + + //定位类型 + UILabel *locationTypeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:KKTextColor text:@"" Radius:0]; + self.locationTypeLabel = locationTypeLabel; + [_msgView addSubview:locationTypeLabel]; + [locationTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(locationTypeImageView); + make.top.equalTo(locationTypeImageView.mas_bottom).offset(2); + }]; + + /// 时间 + UILabel *locationTimeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:KKTextColor text:@"" Radius:0]; + self.locationTimeLabel = locationTimeLabel; + [_msgView addSubview:locationTimeLabel]; + [locationTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(locationTypeImageView.mas_right).offset(15); + make.top.equalTo(_msgView).offset(7); + }]; + + //电量 + UILabel *deviceBatteryLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:Font_(12) textColor:KKTextColor text:@"" Radius:0]; + self.deviceBatteryLabel = deviceBatteryLabel; + [_msgView addSubview:deviceBatteryLabel]; + [deviceBatteryLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(_msgView.mas_right).inset(15); + make.centerY.equalTo(locationTimeLabel); + }]; + + /// 设备电量图片 + UIImageView *deviceBatteryImage = [UICommon ui_imageView:CGRectZero fileName:@""]; + self.deviceBatteryImage = deviceBatteryImage; + [_msgView addSubview:deviceBatteryImage]; + [deviceBatteryImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(deviceBatteryLabel.mas_left).inset(5); + make.centerY.equalTo(deviceBatteryLabel); + make.size.mas_equalTo(CGSizeMake(23, 8)); + }]; + + + UILabel *locationAddressLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:Font_(12) textColor:KKTextColor text:@"当前位置未知,请确保设备开机且能够联网,再点击定位按钮进行定位" Radius:0]; + self.locationAddressLabel = locationAddressLabel; + [_msgView addSubview:locationAddressLabel]; + [locationAddressLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(locationTypeImageView.mas_right).offset(15); + make.right.equalTo(_msgView.mas_right).inset(15); + make.top.equalTo(locationTimeLabel.mas_bottom).offset(5); + }]; + UITapGestureRecognizer *tapPress = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(mapViewtapPressed)]; + [_msgView addGestureRecognizer:tapPress]; + + } + return _msgView; +} + +- (void)mapViewtapPressed +{ + AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate; + [UICommon currentVC].tabBarController.selectedIndex = 2; + app.tabbarView.mytabbar.buttonSelectON = YES; +} + /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. @@ -201,3 +621,4 @@ */ @end + diff --git a/tongxin/VC/WatchHome/WatchHomeViewController.m b/tongxin/VC/WatchHome/WatchHomeViewController.m index 7dcb430..053c3a3 100644 --- a/tongxin/VC/WatchHome/WatchHomeViewController.m +++ b/tongxin/VC/WatchHome/WatchHomeViewController.m @@ -98,7 +98,7 @@ _homeTableView.separatorStyle = UITableViewCellSeparatorStyleNone; _homeTableView.backgroundColor = KKClearColor; _homeTableView.tableHeaderView = self.headerView; - _homeTableView.tableHeaderView.height = ScreenWidth*0.4+138; + _homeTableView.tableHeaderView.height = ScreenWidth*0.6+138+15; [_homeTableView registerClass:HomeMovementTableViewCell.class forCellReuseIdentifier:NSStringFromClass(HomeMovementTableViewCell.class)]; [_homeTableView registerClass:HomeMenuTableViewCell.class forCellReuseIdentifier:NSStringFromClass(HomeMenuTableViewCell.class)]; [_homeTableView registerClass:HomeMsgTableViewCell.class forCellReuseIdentifier:NSStringFromClass(HomeMsgTableViewCell.class)]; @@ -273,23 +273,22 @@ // 刷新轮播图 //加载轮播图 如果没加载到,就是使用默认的 img_banner - - [cUser getSlideshowInfoSuccess:^(id responseObject) { - if(responseObject[@"slideshow"]) - { - NSArray *slideshowArrs = responseObject[@"slideshow"]; - [weakSelf.slideshowArr removeAllObjects]; - for (NSDictionary *item in slideshowArrs) - { - SlideshowModel *model = [SlideshowModel mj_objectWithKeyValues:item]; - [weakSelf.slideshowArr addObject:model]; - } - - [weakSelf.headerView setData:weakSelf.slideshowArr WithPlaceholderImage:@"img_banner"]; - [weakSelf.homeTableView reloadData]; - } - } failure:^(id faiObject) { - }]; +// [cUser getSlideshowInfoSuccess:^(id responseObject) { +// if(responseObject[@"slideshow"]) +// { +// NSArray *slideshowArrs = responseObject[@"slideshow"]; +// [weakSelf.slideshowArr removeAllObjects]; +// for (NSDictionary *item in slideshowArrs) +// { +// SlideshowModel *model = [SlideshowModel mj_objectWithKeyValues:item]; +// [weakSelf.slideshowArr addObject:model]; +// } +// +// [weakSelf.headerView setData:weakSelf.slideshowArr WithPlaceholderImage:@"img_banner"]; +// [weakSelf.homeTableView reloadData]; +// } +// } failure:^(id faiObject) { +// }]; }