// // JXSiDaiWebView.m // shiku_im // // Created by 123 on 2020/6/4. // Copyright © 2020 Reese. All rights reserved. // CYWebCustomerServiceVC #import "JXSiDaiWebView.h" #import "JXsiDaiTopView.h" #import "JXSiDaiCell.h" #import "JXChatViewC.h" #import "JXSiDaiIntroView.h" #import "MJPhotoBrowser.h" #import "MJPhoto.h" @interface JXSiDaiWebView () @property (nonatomic,weak) UITableView *tableVIew ; @end @implementation JXSiDaiWebView -(void)click{ [g_navigation dismissViewController:self animated:YES]; } - (void)defineNavBarSiDaiaaaa:(NSString *)title andRinghtBtnImg:(NSString *)image { UIView *navView = [[UIView alloc] init]; [self.view addSubview:navView]; navView.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH,JX_SCREEN_TOP); UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; backBtn.frame = CGRectMake(0,JX_SCREEN_HEIGHT>812?44:20,44, 44); [backBtn setImage:[UIImage imageNamed:@"photo_title_back_black"] forState:0]; backBtn.tag = 1001; [backBtn addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside]; [navView addSubview:backBtn]; UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom]; rightBtn.frame = CGRectMake(100,(JX_SCREEN_HEIGHT>812?44:20), JX_SCREEN_WIDTH-200, 44); [rightBtn setTitle:title forState:UIControlStateNormal]; [rightBtn setTitleColor:kRGBColor51 forState:UIControlStateNormal]; rightBtn.layer.cornerRadius=5; rightBtn.layer.masksToBounds=YES; [navView addSubview:rightBtn]; self.rightBtn=rightBtn; } - (void)viewDidLoad { [super viewDidLoad]; _dataArr=[NSMutableArray array]; [self defineNavBarSiDaiaaaa:@"私带" andRinghtBtnImg:@"sidaiDD"]; UIScrollView *imageScrollView =[[UIScrollView alloc]init]; if (@available(iOS 11.0, *)) { imageScrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; } else { // Fallback on earlier versionsÔ } imageScrollView.userInteractionEnabled=YES; imageScrollView.delegate=self; imageScrollView.backgroundColor=kRGBColor(145, 29, 19); [self.view addSubview:imageScrollView]; [imageScrollView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(JX_SCREEN_TOP); make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); }]; UIImageView *imageBackV=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"sidaiback2"]]; imageBackV.userInteractionEnabled=YES; [imageScrollView addSubview:imageBackV]; CGFloat imageYW = CGImageGetWidth(imageBackV.image.CGImage); // iamgeView的H = imageView的宽 / (原始图片的宽 / 原始图片的高)---根据宽高比得出imageView的宽 CGFloat imageH = JX_SCREEN_WIDTH / (imageYW / CGImageGetHeight(imageBackV.image.CGImage)); imageBackV.frame = CGRectMake(0, 0, JX_SCREEN_WIDTH, imageH+700); //xiaohaiRight JXsiDaiTopView *topVi=[[JXsiDaiTopView alloc]init]; topVi.userInteractionEnabled=YES; topVi.backgroundColor=[UIColor clearColor]; [imageBackV addSubview:topVi]; [topVi mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(JX_SCREEN_HEIGHT/2.8); make.left.and.right.mas_equalTo(0); make.height.mas_equalTo(250); }]; JXSiDaiIntroView *topIntro=[[JXSiDaiIntroView alloc]init]; topIntro.userInteractionEnabled=YES; topIntro.backgroundColor=[UIColor clearColor]; [imageBackV addSubview:topIntro]; [topIntro mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(topVi.mas_bottom).mas_offset(0); make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.height.mas_equalTo(240); }]; // UIImageView *rightIMG=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"xiaohaiRight"]]; rightIMG.userInteractionEnabled=YES; rightIMG.contentMode=UIViewContentModeScaleAspectFill; [imageBackV addSubview:rightIMG]; [rightIMG mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(topIntro.mas_bottom).mas_offset(-100); make.right.mas_equalTo(0); make.height.mas_equalTo(150); make.width.mas_equalTo(150); }]; UITableView *tableVIew = [[UITableView alloc]init]; tableVIew.backgroundColor=[UIColor clearColor]; tableVIew.scrollEnabled=NO; tableVIew.separatorStyle=UITableViewCellSeparatorStyleNone; [imageBackV addSubview:tableVIew]; tableVIew.sectionHeaderHeight=0; self.tableVIew=tableVIew; tableVIew.delegate=self; tableVIew.dataSource=self; tableVIew.tableFooterView=[UIView new]; [tableVIew mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(rightIMG.mas_bottom).mas_offset(10); make.left.and.right.mas_equalTo(0); make.bottom.mas_equalTo(0); }]; [_dataArr addObjectsFromArray:_sdaiArr]; imageScrollView.contentSize=CGSizeMake(0, imageH+700); // long time = (long)[[NSDate date] timeIntervalSince1970]; // time = (time *1000 + g_server.timeDifference); // NSString *salt = [NSString stringWithFormat:@"%ld", time]; // NSString *jid_room=[[NSUserDefaults standardUserDefaults] objectForKey:@"jid_roomJid"]; // [g_server getact_act_act_SilkPlanallByJidlist:salt jid:jid_room andToView:self]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 589; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return _dataArr.count; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ JXSiDaiCell *cell=[JXSiDaiCell cellWithTableView:tableView]; NSDictionary *dict=_dataArr[indexPath.row]; cell.dictData=dict; cell.yuyueblock = ^(UIButton *btn) { NSString *menberShipAccout = [NSString stringWithFormat:@"%@",dict[@"membershipAccount"]]; JXChatViewC *vc = [[JXChatViewC alloc] init]; //10000656 10000 JXUserObject *user = [[JXUserObject sharedInstance] getUserById:menberShipAccout]; vc.chatPerson = user; [g_navigation pushViewController:vc animated:YES]; }; id traget = self.navigationController.interactivePopGestureRecognizer.delegate; UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil]; [cell.teacherDetaiL addGestureRecognizer:pan]; UISwipeGestureRecognizer * swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction:)]; swipeLeft.direction = UISwipeGestureRecognizerDirectionUp; [cell.teacherDetaiL addGestureRecognizer:swipeLeft]; UISwipeGestureRecognizer * swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction:)]; swipeLeft.direction = UISwipeGestureRecognizerDirectionUp; [cell.teacherDetaiL addGestureRecognizer:swipeLeft]; [pan requireGestureRecognizerToFail:swipeLeft]; [pan requireGestureRecognizerToFail:swipeRight]; return cell; } -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ } - (void)swipeAction:(UITapGestureRecognizer *)gesture { //获得当前手势触发的在UITableView中的坐标 CGPoint location = [gesture locationInView:_tableVIew]; //获得当前坐标对应的indexPath NSIndexPath *indexPath = [_tableVIew indexPathForRowAtPoint:location]; if (indexPath) { //通过indexpath获得对应的Cell UITableViewCell *cell = [_tableVIew cellForRowAtIndexPath:indexPath]; //获得添加到cell.contentView中的UILabel //--------------------------------------------- UILabel *label = nil; for (UIView *view in cell.contentView.subviews) { //for ( UIView *view in _perCardView.subviews)->自定义view if ([view isKindOfClass:[UILabel class]]) { label = (UILabel *)view; //lable = (UILel *)[自定义view viewWithTag:2]; break; } } //获得当前手势点击在UILabe中的坐标 CGPoint p = [gesture locationInView:label]; //CGPoint p = [gesture locationInView:自定义view]; //看看手势点的坐标是不是在UILabel中 if (CGRectContainsPoint(label.frame, p)) { NSLog(@"label text : %@", label.text); } } } /* -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{ if([aDownload.action isEqualToString:act_SilkPlanallByJidlist]){ // act_UserGet [_dataArr addObjectsFromArray:dict[@"data"]]; [_tableVIew reloadData]; } } -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{ return show_error; } */ @end