|
|
@@ -49,6 +49,7 @@ HJPageListViewDelegate
|
|
|
@property (nonatomic, strong) HJHomeDataBox *homeDataBox;
|
|
|
@property (nonatomic, strong) AMapLocationManager *locationManager;//高德定位
|
|
|
@property (nonatomic, strong) HJCheckVersionAPIManager *checkAPIManager;//版本更新
|
|
|
+@property (nonatomic, strong) UIButton *customerServiceBtn;//客服
|
|
|
|
|
|
@end
|
|
|
|
|
|
@@ -73,7 +74,7 @@ HJPageListViewDelegate
|
|
|
[super viewDidLoad];
|
|
|
NAVI_BACK_TITLE;
|
|
|
[self hj_setupNavBar];
|
|
|
- [self addSubViews];
|
|
|
+ [self addSubviewsMakeConstraints];
|
|
|
|
|
|
//检查更新
|
|
|
self.checkAPIManager.version = APP_VERSION;
|
|
|
@@ -83,8 +84,47 @@ HJPageListViewDelegate
|
|
|
[self.getBannerAPIManager start];
|
|
|
|
|
|
//定位
|
|
|
- HJCityPickerCity *locCity = [HJCityPickerCity locationCity];
|
|
|
+ [self positioningCity];
|
|
|
+
|
|
|
+ //添加城市选择通知
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cityPickerViewSelectCity:) name:HJCityPickerCitySelectedNotification object:nil];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)addSubviewsMakeConstraints {
|
|
|
+
|
|
|
+ // 添加列表视图
|
|
|
+ [self.view addSubview:self.navBarView];
|
|
|
+ [self.view insertSubview:self.pageListView belowSubview:self.navBarView];
|
|
|
+ [self.view addSubview:self.customerServiceBtn];
|
|
|
+
|
|
|
+ [self.navBarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.equalTo(self.view);
|
|
|
+ make.top.equalTo(self.view.mas_top).offset(0);
|
|
|
+ make.height.mas_equalTo(STATUS_H + 44);
|
|
|
+ }];
|
|
|
|
|
|
+ [self.pageListView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.navBarView.mas_bottom).offset(0);
|
|
|
+ make.left.right.bottom.equalTo(self.view).offset(0);
|
|
|
+ }];
|
|
|
+ [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ // 注意要加top
|
|
|
+ make.top.width.equalTo(self.pageListView.tableView);
|
|
|
+ }];
|
|
|
+ [self.customerServiceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.right.equalTo(self.view.mas_right).offset(-10);
|
|
|
+ make.bottom.equalTo(self.view.mas_bottom).offset(-15);
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
+/*
|
|
|
+ *定位
|
|
|
+ */
|
|
|
+- (void)positioningCity {
|
|
|
+
|
|
|
+ HJCityPickerCity *locCity = [HJCityPickerCity locationCity];
|
|
|
if (locCity == nil)
|
|
|
{
|
|
|
[self.locationManager requestLocationWithReGeocode:YES completionBlock:^(CLLocation *location, AMapLocationReGeocode *regeocode, NSError *error) {
|
|
|
@@ -108,30 +148,6 @@ HJPageListViewDelegate
|
|
|
self.getHotPositionAPIManager.cityCode = locCity.adcode;
|
|
|
[self.getHotPositionAPIManager start];
|
|
|
}
|
|
|
-
|
|
|
- //添加城市选择通知
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cityPickerViewSelectCity:) name:HJCityPickerCitySelectedNotification object:nil];
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-- (void)addSubViews {
|
|
|
-
|
|
|
- [self.view addSubview:self.navBarView];
|
|
|
- [self.navBarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.right.equalTo(self.view);
|
|
|
- make.top.equalTo(self.view.mas_top).offset(0);
|
|
|
- make.height.mas_equalTo(STATUS_H + 44);
|
|
|
- }];
|
|
|
- // 添加列表视图
|
|
|
- [self.view insertSubview:self.pageListView belowSubview:self.navBarView];
|
|
|
- [self.pageListView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.top.equalTo(self.navBarView.mas_bottom).offset(0);
|
|
|
- make.left.right.bottom.equalTo(self.view).offset(0);
|
|
|
- }];
|
|
|
- [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- // 注意要加top
|
|
|
- make.top.width.equalTo(self.pageListView.tableView);
|
|
|
- }];
|
|
|
}
|
|
|
|
|
|
#pragma mark - UITableViewDelegate
|
|
|
@@ -228,6 +244,28 @@ HJPageListViewDelegate
|
|
|
vc.hidesBottomBarWhenPushed = YES;
|
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
|
}
|
|
|
+/*
|
|
|
+ *客服
|
|
|
+ */
|
|
|
+- (void)customerServiceClick:(UIButton *)btn {
|
|
|
+
|
|
|
+ HJWebViewController *webView = [[HJWebViewController alloc] init];
|
|
|
+ webView.titleStr = @"客服";
|
|
|
+ webView.webUrl = kCustomerServiceURL;
|
|
|
+ webView.hidesBottomBarWhenPushed = YES;
|
|
|
+ [self.navigationController pushViewController:webView animated:YES];
|
|
|
+
|
|
|
+}
|
|
|
+/*
|
|
|
+ *平移手势
|
|
|
+ */
|
|
|
+- (void)pan:(UIPanGestureRecognizer *)pan{
|
|
|
+
|
|
|
+ UIButton * imageV = (UIButton *)pan.view ;
|
|
|
+ CGPoint point = [pan translationInView:imageV] ;
|
|
|
+ pan.view.transform =CGAffineTransformTranslate(pan.view.transform, point.x, point.y);
|
|
|
+ [pan setTranslation:CGPointZero inView:pan.view];
|
|
|
+}
|
|
|
|
|
|
#pragma mark - HJBannerScrollViewDelegate
|
|
|
|
|
|
@@ -357,7 +395,7 @@ HJPageListViewDelegate
|
|
|
|
|
|
#pragma mark - private methods
|
|
|
|
|
|
-#pragma mark - getters and setters
|
|
|
+#pragma mark - lazy
|
|
|
|
|
|
- (HJCheckVersionAPIManager *)checkAPIManager {
|
|
|
|
|
|
@@ -473,5 +511,17 @@ HJPageListViewDelegate
|
|
|
}
|
|
|
return _navBarView;
|
|
|
}
|
|
|
+- (UIButton *)customerServiceBtn {
|
|
|
+
|
|
|
+ if (_customerServiceBtn == nil)
|
|
|
+ {
|
|
|
+ _customerServiceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [_customerServiceBtn setImage:[UIImage imageNamed:@"customerService_icon"] forState:UIControlStateNormal];
|
|
|
+ [_customerServiceBtn addTarget:self action:@selector(customerServiceClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)] ;
|
|
|
+ [_customerServiceBtn addGestureRecognizer:pan] ;
|
|
|
+ }
|
|
|
+ return _customerServiceBtn;
|
|
|
+}
|
|
|
|
|
|
@end
|