From 94217b294ccd75a34787eb04d6e273e99536e45b Mon Sep 17 00:00:00 2001 From: 重庆迈尖科技有限公司 Date: 星期三, 30 一月 2019 15:12:32 +0800 Subject: [PATCH] no message --- BuWanVideo2.0/LeftViewController.m | 154 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 140 insertions(+), 14 deletions(-) diff --git a/BuWanVideo2.0/LeftViewController.m b/BuWanVideo2.0/LeftViewController.m index 4effb65..14faab0 100755 --- a/BuWanVideo2.0/LeftViewController.m +++ b/BuWanVideo2.0/LeftViewController.m @@ -20,7 +20,9 @@ #import "UIButton+YYWebImage.h" #import "LoggingViewController.h" #import "Personal_informationViewController.h" -@interface LeftViewController ()<UITableViewDelegate,UITableViewDataSource>{ +#import <SafariServices/SafariServices.h> + +@interface LeftViewController ()<UITableViewDelegate,UITableViewDataSource,HXEasyCustomShareViewDelegate>{ NSArray *_iconArr; NSArray *_dataArr; @@ -30,6 +32,7 @@ @property (weak, nonatomic) IBOutlet UIButton *LeftImageIcon;//渚ф粦鏍忕殑澶村儚 @property (weak, nonatomic) IBOutlet UIButton *LeftLoginBtn;//绔嬪嵆鐧诲綍 +@property (weak, nonatomic) IBOutlet UIImageView *headerImageview; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *MarkToMain;//杩欎釜鐨勫�间负瀹藉害鐨勫洓鍒嗕箣涓� @property (weak, nonatomic) IBOutlet NSLayoutConstraint *LeftbackgroundH;//鏍规嵁鍥剧墖姣斾緥璁剧疆楂� @@ -59,8 +62,8 @@ self.MarkToMain.constant=0; self.LeftbackgroundH.constant=141; //澶村儚缁樺渾 - self.LeftImageIcon.layer.cornerRadius=self.LeftImageIcon.frame.size.height/2; - self.LeftImageIcon.layer.masksToBounds= YES; + self.headerImageview.layer.cornerRadius=self.headerImageview.frame.size.height/2; + self.headerImageview.layer.masksToBounds= YES; //tabelView鐨勯厤缃� _LeftTableView.delegate=self; _LeftTableView.dataSource=self; @@ -127,10 +130,10 @@ */ -(void)creatData{ if (!_iconArr) { - _iconArr=[NSArray arrayWithObjects:@"鎴戠殑鏀惰棌",@"瑙傜湅璁板綍",@"鎴戠殑鍏虫敞",@"鎴戠殑娑堟伅",@"鍒嗕韩鍑哄幓",@"甯姪鍜屽弽棣�",@"璁剧疆", nil]; + _iconArr=[NSArray arrayWithObjects:@"鎴戠殑鏀惰棌",@"瑙傜湅璁板綍",@"鎴戠殑鍏虫敞",@"鎴戠殑娑堟伅",@"鍒嗕韩鍑哄幓",@"甯姪鍜屽弽棣�",@"闅愮鏀跨瓥",@"璁剧疆", nil]; } if (!_dataArr) { - _dataArr=[NSArray arrayWithObjects:@"鎴戠殑鏀惰棌",@"瑙傜湅璁板綍",@"鎴戠殑鍏虫敞",@"鎴戠殑娑堟伅",@"鍒嗕韩杞欢",@"甯姪涓庡弽棣�",@"璁剧疆", nil]; + _dataArr=[NSArray arrayWithObjects:@"鎴戠殑鏀惰棌",@"瑙傜湅璁板綍",@"鎴戠殑鍏虫敞",@"鎴戠殑娑堟伅",@"鍒嗕韩杞欢",@"甯姪涓庡弽棣�",@"闅愮鏀跨瓥",@"璁剧疆", nil]; } } /** @@ -146,6 +149,7 @@ [self.navigationController pushViewController:Personal_informationVC animated:YES]; }else{//璺冲叆鐧诲綍鐣岄潰 LoggingViewController *loginVC=[[LoggingViewController alloc] init]; + loginVC.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController:loginVC animated:YES]; } [self.slideMenuController closeLeft]; @@ -161,9 +165,21 @@ switch (indexPath.row) { case 0:{ - CollectionController * cc = [CollectionController new]; - [cc setHidesBottomBarWhenPushed:YES]; - [self.navigationController pushViewController:cc animated:YES]; +// if([[NSUserDefaults standardUserDefaults] boolForKey:@"userOnLine"]){ +// + CollectionController * cc = [CollectionController new]; + [cc setHidesBottomBarWhenPushed:YES]; + [self.navigationController pushViewController:cc animated:YES]; +// +// }else{ + //鏈櫥褰曪紝寮曞鐢ㄦ埛鐧诲綍 +// LoggingViewController *loginVC=[[LoggingViewController alloc] init]; +// loginVC.ispresent=YES; +// [self presentViewController:loginVC animated:YES completion:^{ +// +// }]; +// } + } break; case 1:{ @@ -198,7 +214,7 @@ } break; case 4:{//鍒嗕韩 - [Share shareAPP:self.navigationController]; + [self shareAPP]; } break; // case 5:{//鍙戝竷涓滆タ @@ -213,7 +229,25 @@ [self.navigationController pushViewController:Help animated:YES]; } break; + case 6:{ + NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/api_control_ios.jsp",iconImageUrl]]; + SFSafariViewController *safariVC = [[SFSafariViewController alloc] initWithURL:url]; +// safariVC.delegate = self; + + + // self.navigationController.navigationBarHidden = YES; + // [self.navigationController pushViewController:safariVC animated:YES]; +// safariVC.title= @"闅愮鏀跨瓥"; +// safariVC.hidesBottomBarWhenPushed = YES; + // 寤鸿 +// [self.navigationController pushViewController:safariVC animated:YES]; + [self presentViewController:safariVC animated:YES completion:nil]; + + } + break; + + case 7:{ //璁剧疆 SettingController * setting = [SettingController new]; [setting setHidesBottomBarWhenPushed:YES]; @@ -244,14 +278,13 @@ _userOnLine= [[NSUserDefaults standardUserDefaults] boolForKey:@"userOnLine"]; if(_userOnLine){//濡傛灉褰撳墠鐘舵�佹槸鐧诲綍鐘舵�� - [self.LeftImageIcon setContentMode:UIViewContentModeScaleAspectFill]; - [self.LeftImageIcon yy_setImageWithURL:[[NSUserDefaults standardUserDefaults] objectForKey:@"iconURL"] - forState:UIControlStateNormal - placeholder:[UIImage imageNamed:@"鐢ㄦ埛榛樿"]]; + [self.headerImageview setYthImageWithURL:[[NSUserDefaults standardUserDefaults] objectForKey:@"iconURL"] placeholderImage:[UIImage imageNamed:@"鐢ㄦ埛榛樿"]]; + [self.LeftLoginBtn setTitle:[[NSUserDefaults standardUserDefaults] objectForKey:@"QQUserName"] forState:UIControlStateNormal]; }else{//褰撳墠鐘舵�佷负鏈櫥褰曠姸鎬� - [self.LeftImageIcon setImage:[UIImage imageNamed:@"鐢ㄦ埛榛樿"] forState:UIControlStateNormal]; + + self.headerImageview.image = [UIImage imageNamed:@"鐢ㄦ埛榛樿"] ; [self.LeftLoginBtn setTitle:@"绔嬪嵆鐧诲綍" forState:UIControlStateNormal]; } } @@ -279,6 +312,99 @@ return cell; } +- (void)shareAPP{//鍒嗕韩鍝嶅簲 鏍囬 鍐呭 鍒嗕韩閾炬帴 + NSMutableArray *shareAry=[NSMutableArray array]; + if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"mqq://"]]) { + NSArray *QQArr=@[@{@"image":@"newqq",@"title":@"QQ"},@{@"image":@"newqq绌洪棿",@"title":@"QQ绌洪棿"}]; + [shareAry addObjectsFromArray:QQArr]; + } + + if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weixin://"]]){ + NSArray *WXArr=@[@{@"image":@"new寰俊",@"title":@"寰俊"},@{@"image":@"new鏈嬪弸鍦�",@"title":@"鏈嬪弸鍦�"}]; + [shareAry addObjectsFromArray:WXArr]; + } + if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"sinaweibo://"]]){ + NSArray *XLArr=@[@{@"image":@"new寰崥",@"title":@"鏂版氮寰崥"}]; + [shareAry addObjectsFromArray:XLArr]; + } + + UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenW, 54)]; + headerView.backgroundColor = [UIColor clearColor]; + + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, headerView.frame.size.width, 15)]; + label.textAlignment = NSTextAlignmentCenter; + label.textColor = [UIColor blackColor]; + label.backgroundColor = [UIColor clearColor]; + label.font = [UIFont systemFontOfSize:15]; + label.text = @"鍒嗕韩鍒�"; + [headerView addSubview:label]; + + UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, headerView.frame.size.height-0.5, headerView.frame.size.width, 0.5)]; + lineLabel.backgroundColor = [UIColor colorWithRed:208/255.0 green:208/255.0 blue:208/255.0 alpha:1.0]; + [headerView addSubview:lineLabel]; + + UILabel *lineLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, headerView.frame.size.width, 0.5)]; + lineLabel1.backgroundColor = [UIColor colorWithRed:208/255.0 green:208/255.0 blue:208/255.0 alpha:1.0]; + + HXEasyCustomShareView *shareView = [[HXEasyCustomShareView alloc] initWithFrame:CGRectMake(0, 0, KScreenW, KScreenH)]; + shareView.backView.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0]; + shareView.headerView = headerView; + float height = [shareView getBoderViewHeight:shareAry firstCount:0]; + shareView.boderView.frame = CGRectMake(0, 0, shareView.frame.size.width, height); + shareView.middleLineLabel.hidden = YES; + [shareView.cancleButton addSubview:lineLabel1]; + shareView.cancleButton.frame = CGRectMake(shareView.cancleButton.frame.origin.x, shareView.cancleButton.frame.origin.y, shareView.cancleButton.frame.size.width, 54); + shareView.cancleButton.titleLabel.font = [UIFont systemFontOfSize:16]; + [shareView.cancleButton setTitleColor:[UIColor colorWithRed:184/255.0 green:184/255.0 blue:184/255.0 alpha:1.0] forState:UIControlStateNormal]; + [shareView setShareAry:shareAry delegate:self]; + [self.view addSubview:shareView]; +} +#pragma mark -HXEasyCustomShareViewDelegate +- (void)easyCustomShareViewButtonAction:(HXEasyCustomShareView *)shareView title:(NSString *)title { + if ([title isEqualToString:@"寰俊"]) { + [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession]; + }else if ([title isEqualToString:@"鏈嬪弸鍦�"]) { + [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine]; + }else if ([title isEqualToString:@"QQ"]) { + [self shareWebPageToPlatformType:UMSocialPlatformType_QQ]; + }else if ([title isEqualToString:@"鏂版氮寰崥"]) { + [self shareWebPageToPlatformType:UMSocialPlatformType_Sina]; + }else if ([title isEqualToString:@"QQ绌洪棿"]) { + [self shareWebPageToPlatformType:UMSocialPlatformType_Qzone]; + }else{ + //鍒拌繖閲屽氨閿欎簡 + } + [shareView tappedCancel]; +} + +/** + 鍒嗕韩 + */ +- (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType{ + + //鍒涘缓鍒嗕韩娑堟伅瀵硅薄 + UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject]; + + //鍒涘缓缃戦〉鍐呭瀵硅薄 + UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:@"甯冧父褰辫澶у叏" descr:[NSString stringWithFormat:@"%@!%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"ShareContent"],[[NSUserDefaults standardUserDefaults] objectForKey:@"ShareUrl"]] thumImage:[UIImage imageNamed:@"鍒嗕韩鍥炬爣"]]; + NSLog(@"%@---%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"ShareContent"],[[NSUserDefaults standardUserDefaults] objectForKey:@"ShareUrl"]); + //璁剧疆缃戦〉鍦板潃 + shareObject.webpageUrl =[[NSUserDefaults standardUserDefaults] objectForKey:@"ShareUrl"]; + NSLog(@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"ShareUrl"]); + //鍒嗕韩娑堟伅瀵硅薄璁剧疆鍒嗕韩鍐呭瀵硅薄 + messageObject.shareObject = shareObject; + NSLog(@"%@",shareObject); + //璋冪敤鍒嗕韩鎺ュ彛 + [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) { + if (error) { + [SVProgressHUD showErrorWithStatus:@"鍒嗕韩澶辫触!"]; + NSLog(@"************Share fail with error %@*********",error); + }else{ + NSLog(@"response data is %@",data); + } + }]; +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. -- Gitblit v1.8.0