Initial commit

This commit is contained in:
ifish
2017-08-15 16:59:01 +08:00
commit bdc83e07ef
5766 changed files with 423223 additions and 0 deletions
@@ -0,0 +1,17 @@
//
// IfishKanKanListViewController.h
// Ifish
//
// Created by imac on 16/11/8.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "BaseVIewContorller.h"
/*
*老界面已废弃
*/
@interface IfishKanKanListViewController : BaseVIewContorller
@end
@@ -0,0 +1,536 @@
//
// IfishKanKanListViewController.m
// Ifish
//
// Created by imac on 16/11/8.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "IfishKanKanListViewController.h"
#import "IfishKankanListModel.h"
#import "LXAdScrollView.h"
#import "WoDeKanKanViewController.h"
#define TABBAR_H self.tabBarController.tabBar.frame.size.height
#import "KanKanListTableCell.h"
#import "IfishP2PLivePlayViewController.h"
#import "KanKanBanner.h"
#import "MineKankanEditViewController.h"
#import "JHRefresh.h"
#import "KanKanListDataHelper.h"
#import "PushMasssageWebViewController.h"
#import "IfishBannerData.h"
@interface IfishKanKanListViewController ()<UITableViewDelegate, UITableViewDataSource ,RecommendTableCellDelegate,MBProgressHUDDelegate>
{
BOOL _isRefreshing;
BOOL _isLoadMore;
BOOL _isPushEdit;
}
@property(nonatomic,copy) NSString* total;
@property(nonatomic,strong) LXAdScrollView *adView;
@property(nonatomic,strong) UITableView * tableView;
@property (nonatomic,strong) NSMutableArray *bannerArray;
@property (nonatomic,strong) NSMutableArray *bannerImgArr;
@property(nonatomic,strong) NSDictionary*para;
@property(nonatomic)BOOL isRefreshing;
@property(nonatomic)BOOL isLoadMore;
@property(nonatomic,copy) NSString *oders;
@property(nonatomic) int page;
@property(nonatomic,strong)NSMutableArray *dataArray;
@property(nonatomic,strong) MBProgressHUD *progressHud;
@end
/*
*老界面已废弃
*/
@implementation IfishKanKanListViewController
- (void)viewDidLoad {
[super viewDidLoad];
_isPushEdit = NO;
// Do any additional setup after loading the view.
_bannerArray = [[NSMutableArray alloc] init];
_bannerImgArr= [[NSMutableArray alloc] init];
_dataArray = [[NSMutableArray alloc] init];
[self loadPageData];
[self addTitleViewWithTitle:@"爱鱼看看"];
self.rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.rightButton.frame = CGRectMake(0, 0, 60, 44);
[self.rightButton setImage:[UIImage imageNamed:@"live_navicon_look"] forState:UIControlStateNormal];
[self.rightButton setImageEdgeInsets:UIEdgeInsetsMake(0, 30, 0, 0)];
[self.rightButton addTarget:self action:@selector(popAppear) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *rightItem =[[UIBarButtonItem alloc] init];
rightItem.customView =self.rightButton;
self.navigationItem.rightBarButtonItem = rightItem;
[self creatUI];
[self creatReatRefreshView];
//[self loadBannerData];
[self loadNewBannerData];
}
-(void)loadPageData{
NSInteger firstResult = 0;
NSInteger pageSize = 10;
NSString *startoders = @"";
NSString *userId = [dataContorl dataControlGetUserIdInfo];
[AFHttpTool getLiveRoomsfirstResult:firstResult pageSize:pageSize userId:userId orders:startoders success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSDictionary *dataDic=reDic[@"data"];
NSArray*roomArr=dataDic[@"liveRoomInfo"];
if ([reDic[@"result"] isEqualToString:@"100"]) {
NSString *fedbackOder=dataDic[@"orders"];
NSString *total=dataDic[@"total"];
[self.dataArray removeAllObjects];
for (NSDictionary *dic in roomArr) {
IfishKankanListModel *mode=[[IfishKankanListModel alloc] init];
[KanKanListDataHelper formatKanKanLisetData:mode liveRoomInfo:dic];
[self.dataArray addObject:mode];
}
self.oders = fedbackOder;
self.total = total;
//NSLog(@"_dataArray直播1列表%lu",(unsigned long)_dataArray.count);
}
[self.tableView reloadData];
} failure:^(NSError *err) {
[self.view makeToast:@"NSError请求异常"];
}];
}
-(void)popAppear{
[self pushMyKankan];
}
-(void)pushMyKankan{
self.hidesBottomBarWhenPushed = YES;
// WoDeKanKanViewController *wodeKakanVC=[[WoDeKanKanViewController alloc] init];
MineKankanEditViewController *editVC = [[MineKankanEditViewController alloc] init];
_isPushEdit = YES;
[self.navigationController pushViewController:editVC animated:YES];
}
#pragma mark -v4.1 前 看看banner
-(void)loadBannerData{
__weak typeof (self)weskSelf=self;
[AFHttpTool getLiveBannerSuccess:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
if ([reDic[@"result"] isEqualToString:@"100"]){
NSArray*bannerArr=reDic[@"data"];
for (NSDictionary *bannerDic in bannerArr) {
KanKanBanner *banner=[[KanKanBanner alloc] init];
banner.appShow = bannerDic[@"appShow"];
banner.bannerId = bannerDic[@"bannerId"];
banner.bannerImg = bannerDic[@"bannerImg"];
banner.bannerLink = bannerDic[@"bannerLink"];
banner.bannerType = bannerDic[@"bannerType"];
[_bannerImgArr addObject:banner.bannerImg];
[_bannerArray addObject:banner];
}
[weskSelf setingBannerViewData];
}
} failure:^(NSError *err) {
NSLog(@"loadBannererr%@",err);
}];
}
#pragma mark -v4.1 后看看banner
-(void)loadNewBannerData{
__weak typeof (self)weskSelf=self;
[AFHttpTool getIfishBannerData:IfishAdTypeKankan success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
if ([reDic[@"result"] isEqualToString:@"100"]){
NSArray*bannerArr=reDic[@"data"];
for (NSDictionary *bannerDic in bannerArr) {
IfishBannerData *banner=[[IfishBannerData alloc] initWithDict:bannerDic];
[_bannerImgArr addObject:banner.adImage];
[_bannerArray addObject:banner];
}
[weskSelf setingBannerViewData];
}
} failure:^(NSError *err) {
}];
}
-(void)creatUI{
//[self cratHUD];
_tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStyleGrouped];
_tableView.dataSource=self;
_tableView.delegate=self;
_tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor= TABLE_BACKGROUD_COLOR;
//_tableView.backgroundColor= [UIColor redColor];
UIView *footerView=[[UIView alloc] initWithFrame:CGRectMake(0,0, kScreenSize.width, 0.1)];
footerView.backgroundColor = [UIColor clearColor];
_tableView.tableFooterView = footerView;
LXAdScrollView *adView = [[LXAdScrollView alloc]initWithFrame:CGRectMake(0,0,kScreenSize.width,kScreenSize.width*0.427)];
adView.backgroundColor = [UIColor lightGrayColor];
_adView = adView;
_tableView.tableHeaderView=_adView;
[self.view addSubview:_tableView];
}
-(void)cratHUD{
if (self.progressHud) {
self.progressHud = [[MBProgressHUD alloc] initWithView:self.view];
}
[self.view addSubview:self.progressHud];
self.progressHud.mode=MBProgressHUDModeIndeterminate;
self.progressHud.customView = [[UIView alloc] init];
self.progressHud.delegate = self;
self.progressHud.labelText = @"加载中...";
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
if (_isPushEdit) {
[_tableView reloadData];
}
[self setingBannerViewData];
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.progressHud hide:YES];
}
-(void)setingBannerViewData{
// 取消导航影响 广告栏
// self.automaticallyAdjustsScrollViewInsets = NO;
__weak typeof (self)weskSelf=self;
if (_bannerArray.count !=0) {
_adView.adList = _bannerImgArr;
_adView.tapActionBlock = ^(LXAdScrollView *adScrollView) {
NSInteger adIndx=adScrollView.currentPage;
KanKanBanner *banner=weskSelf.bannerArray[adIndx];
[weskSelf tapBannerWith:banner];
};
}else{
_adView.adList = @[@"kankan_listbanner.jpg"];
_adView.tapActionBlock = ^(LXAdScrollView *adScrollView) {
[weskSelf pushMyKankan];
};
}
}
#pragma mark -banner 事件
-(void)tapBannerWith:(KanKanBanner *)banner
{
if (banner.bannerType) {
//打开网页
[self pushWebwithLink:banner.bannerLink];
}else{
[self.view makeToast:@"未知广告类型"];
}
}
#pragma mark 打开网页
-(void)pushWebwithLink:(NSString*)url{
_isPushEdit = NO;
PushMasssageWebViewController*webVC=[[PushMasssageWebViewController alloc]init];
webVC.pushlink =url;
webVC.pushtitle = @"网页";
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:webVC animated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identfire=@"RecommendTableCell";
KanKanListTableCell *cell=[tableView dequeueReusableCellWithIdentifier:identfire];
if (!cell) {
cell=[[KanKanListTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identfire];
}
cell.delegate = self;
cell.selectionStyle=UITableViewCellSelectionStyleNone;
[cell loadDta:self.dataArray];
cell.backgroundColor = TABLE_BACKGROUD_COLOR;
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//int sliderValue=(int)(slider.value+0.5);
//内容高度
int rowNumb = 0;
rowNumb = (int)(self.dataArray.count +1)/2 ;
//return (((270*KWidth_Scale-3*5)/2)*rowNumb)/2 + KWidth_Scale*100;
return ((270*KWidth_Scale-3*5)/2)*rowNumb + KWidth_Scale*100 + 5*rowNumb;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
-(void)TapRecommendTableCellDelegate:(IfishKankanListModel *)listModel
{
self.progressHud = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:self.progressHud];
self.progressHud.mode=MBProgressHUDModeCustomView;
self.progressHud.customView = [[UIView alloc] init];
self.progressHud.delegate = self;
self.progressHud.labelText = @"加载中...";
__weak typeof (self)weskSelf=self;
[self.progressHud showAnimated:YES whileExecutingBlock:^{
[weskSelf pushShareP2pView:listModel];
} onQueue:dispatch_get_main_queue()];
}
-(void)pushShareP2pView:(IfishKankanListModel *)listModel
{
KanHuListModel *kanHuCamera =[[KanHuListModel alloc] init];
//kanHuCamera.cameraId = @"3573889";
kanHuCamera.cameraId = listModel.cameraId;
IfishP2PLivePlayViewController *shareVideoVC=[[IfishP2PLivePlayViewController alloc] init];
self.hidesBottomBarWhenPushed = YES;
shareVideoVC.kanHuCamera = kanHuCamera;
shareVideoVC.listRoomInfo = listModel;
_isPushEdit = NO;
[self.navigationController pushViewController:shareVideoVC animated:YES];
}
-(void)hudWasHidden:(MBProgressHUD *)hud
{
}
-(void)creatReatRefreshView{
__weak typeof (self)weskSelf=self;
// 下拉刷新
[_tableView addRefreshHeaderViewWithAniViewClass:[JHRefreshAmazingAniView class] beginRefresh:^{
if (weskSelf.isRefreshing) {
return ;
}
weskSelf.isRefreshing=YES;
_page=0;
NSInteger firstResult = 0;
NSInteger pageSize = 10;
[weskSelf addRefreshHeaderTaskWithFirst:firstResult pageSize:pageSize isRefresh:YES];
}];
//上拉加载更多
[_tableView addRefreshFooterViewWithAniViewClass:[JHRefreshCommonAniView class] beginRefresh:^{
if (weskSelf.isLoadMore) {
return ;
}
weskSelf.isLoadMore=YES;
NSInteger pagecount =[self.total integerValue]/10+1;
if (weskSelf.page<pagecount-1) {
weskSelf.page++;
NSInteger first=(NSInteger)weskSelf.page*10;
NSInteger pageSize = 10;
[weskSelf addRefreshFooterTaskWithFirst:first pageSize:pageSize isRefresh:YES];
}else{
[weskSelf endRefreshing];
[weskSelf.view makeToast:@"已无更多数据"];
}
}];
}
-(void)endRefreshing{
if (self.isRefreshing) {
self.isRefreshing=NO;
[_tableView headerEndRefreshingWithResult:JHRefreshResultNone];
}
if (self.isLoadMore) {
self.isLoadMore=NO;
[_tableView footerEndRefreshing];
}
}
#pragma mark -刷新
-(void)addRefreshHeaderTaskWithFirst:(NSInteger)firstResult pageSize:(NSInteger)pageSize isRefresh:(BOOL)isRefresh{
if (isRefresh) {
[_dataArray removeAllObjects];
}
NSString*userId = [dataContorl dataControlGetUserIdInfo];
NSString *orders = @"";
[AFHttpTool getLiveRoomsfirstResult:firstResult pageSize:pageSize userId:userId orders:orders success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSDictionary *dataDic=reDic[@"data"];
NSArray*roomArr=dataDic[@"liveRoomInfo"];
if ([reDic[@"result"] isEqualToString:@"100"]) {
self.oders =dataDic[@"orders"];
self.total =dataDic[@"total"];
[_dataArray removeAllObjects];
for (NSDictionary *dic in roomArr) {
IfishKankanListModel *mode=[[IfishKankanListModel alloc] init];
[KanKanListDataHelper formatKanKanLisetData:mode liveRoomInfo:dic];
[_dataArray addObject:mode];
}
NSLog(@"_dataArray列表%lu",(unsigned long)_dataArray.count);
[_tableView reloadData];
[self endRefreshing];
}else{
[self endRefreshing];
}
} failure:^(NSError *err) {
[self endRefreshing];
[self.view makeToast:@"网络异常"];
}];
}
#pragma mark -加载更多
-(void)addRefreshFooterTaskWithFirst:(NSInteger)firstResult pageSize:(NSInteger)pageSize isRefresh:(BOOL)isRefresh
{
NSString*userId = [dataContorl dataControlGetUserIdInfo];
NSString *orders = self.oders;
[AFHttpTool getLiveRoomsfirstResult:firstResult pageSize:pageSize userId:userId orders:orders success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSDictionary *dataDic=reDic[@"data"];
NSArray*roomArr=dataDic[@"liveRoomInfo"];
if ([reDic[@"result"] isEqualToString:@"100"]) {
self.oders =dataDic[@"orders"];
self.total =dataDic[@"total"];
//[_dataArray removeAllObjects];
for (NSDictionary *dic in roomArr) {
IfishKankanListModel *mode=[[IfishKankanListModel alloc] init];
[KanKanListDataHelper formatKanKanLisetData:mode liveRoomInfo:dic];
[_dataArray addObject:mode];
}
[_tableView reloadData];
[self endRefreshing];
NSLog(@"_dataArray列表%lu",(unsigned long)_dataArray.count);
}else{
[self endRefreshing];
}
} failure:^(NSError *err) {
[self.view makeToast:@"网络异常"];
[self endRefreshing];
}];
}
@end
@@ -0,0 +1,45 @@
//
// IfishKankanListModel.h
// Ifish
//
// Created by imac on 16/11/8.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface IfishKankanListModel : NSObject
@property(nonatomic,strong)NSString *room_id; //房间号
@property(nonatomic,strong)NSString *room_name; //内容
@property(nonatomic,strong)NSString *nickname; //直播昵称
@property(nonatomic,strong)NSString *popularityValue; //人气值
@property(nonatomic,strong)NSString *roomDesc; //爱鱼宣言
@property(nonatomic,strong)NSString *numberDays; //开播时间
@property(nonatomic,strong)NSString *distance; //距离
@property(nonatomic,strong)NSString *cameraId; //
@property(nonatomic,strong)NSString *userImg; //用户头像
@property(nonatomic,strong)NSString *liveness; //活跃度
@property(nonatomic) BOOL isZan; //是否赞过1赞过
@property(nonatomic) CGFloat goldValue;
@property(nonatomic) int gradeNum;
@property(nonatomic) int zanNumber;
@property(nonatomic,strong)NSString *userId; //
@property(nonatomic,strong)NSString *userType; //用户类型 1 商家 0 普通用户
@property(nonatomic)int pinglunNum;
-(instancetype)initWithDict:(NSDictionary *)dict;
@end
@@ -0,0 +1,38 @@
//
// IfishKankanListModel.m
// Ifish
//
// Created by imac on 16/11/8.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "IfishKankanListModel.h"
@implementation IfishKankanListModel
-(instancetype)initWithDict:(NSDictionary *)dict{
if (self = [super init]) {
_room_id = [dict objectForKey:@"roomId"];
_room_name= [dict objectForKey:@"roomName"];
_nickname = [dict objectForKey:@"nickName"];
_popularityValue = [dict objectForKey:@"popularityValue"];
_roomDesc = [dict objectForKey:@"roomDesc"];
_numberDays = [dict objectForKey:@"numberDays"];
_distance = [dict objectForKey:@"distance"];
_cameraId = [dict objectForKey:@"cameraId"];
_userImg = [dict objectForKey:@"userImg"];
_liveness = [dict objectForKey:@"liveness"];
_isZan = [[dict objectForKey:@"isZan"] boolValue];
_goldValue = [[dict objectForKey:@"totalGoldValue"] floatValue];
_gradeNum = [[dict objectForKey:@"gradeNum"] intValue];
_zanNumber = [[dict objectForKey:@"zanNum"] intValue];
_userImg = [dict objectForKey:@"userImg"];
_userId = [dict objectForKey:@"userId"];
_userType = [dict objectForKey:@"userType"];
_pinglunNum = [[dict objectForKey:@"pinglunNum"] intValue];
}
return self;
}
@end
@@ -0,0 +1,18 @@
//
// IfishP2PLivePlayViewController.h
// Ifish
//
// Created by imac on 16/11/11.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "BaseVIewContorller.h"
#import "ShopKanHuP2PViewController.h"
#import "IfishKankanListModel.h"
#import "P2PShareViewBootomView.h"
@interface IfishP2PLivePlayViewController : ShopKanHuP2PViewController
@property(nonatomic,strong) P2PShareViewBootomView * subHbottomView;
@property (nonatomic,strong) IfishKankanListModel *listRoomInfo;
@end
@@ -0,0 +1,193 @@
//
// IfishP2PLivePlayViewController.m
// Ifish
//
// Created by imac on 16/11/11.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "IfishP2PLivePlayViewController.h"
#import "IfishP2PVideoPlayView.h"
#import "IfishSessionViewController.h"
@interface IfishP2PLivePlayViewController ()<P2PShareViewBootomViewDelegate>
@end
@implementation IfishP2PLivePlayViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"分享中"];
//自定义封装播放器 由于xib创建OPGLview 无法显示(暂未找到方法)暂时不用 纯代码建UI可以试试
//[self setupVideoPlayView];
//现采用继承ShopKanHuP2PViewController 替换底部 HbootmView
// self.HbootmView.hidden= YES;
self.view.backgroundColor = TABLE_BACKGROUD_COLOR;
[self resetBootomView];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
}
-(void)resetBootomView{
CGFloat playViewH= self.view.bounds.size.width * 9 / 16;
P2PShareViewBootomView *bootomView = [[P2PShareViewBootomView alloc] initWithFrame:CGRectMake(0,CGRectGetMaxY(self.canvasView.frame), self.view.frame.size.width,self.view.frame.size.height - playViewH)];
[bootomView initDataWithRoomId:self.listRoomInfo.room_id];
bootomView.roomModel = self.listRoomInfo;
if (self.HbootmView) {
[self.HbootmView removeFromSuperview];
}
self.subHbottomView = bootomView;
self.subHbottomView.delegate = self;
[self.view addSubview:self.subHbottomView];
[self.view bringSubviewToFront:self.subHbottomView];
}
//为用到
-(void)setupVideoPlayView{
IfishP2PVideoPlayView *playView=[IfishP2PVideoPlayView videoPlayView];
playView.delegate=self;
// 播放器显示位置(竖屏时)
playView.frame = CGRectMake(0,64, self.view.bounds.size.width, self.view.bounds.size.width * 9 / 16);
[self.view addSubview:playView];
// 指定一个作为播放的控制器
playView.contrainerViewController = self;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)popularityAdd:(int)onLineP
{
NSLog(@"人气涨1");
// dispatch_async(dispatch_get_main_queue(), ^{
// [self.view makeToast:[NSString stringWithFormat:@"当前在线人数%d",onLineP]];
//});
//人气涨+
NSString *userId = [dataContorl dataControlGetUserIdInfo];
[AFHttpTool popularityValueRoomId:self.listRoomInfo.room_id userId:userId success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
if ([reDic[@"result"] isEqualToString:@"100"]) {
NSString* popular = reDic[@"data"];
self.listRoomInfo.popularityValue = popular;
[self.subHbottomView.tableView reloadData];
}
} failure:^(NSError *err) {
}];
}
-(void)disHideSubControlerBootomm
{
self.subHbottomView.hidden= NO;
}
-(void)hideSubControlerBootomm
{
self.subHbottomView.hidden= YES;
}
#pragma mark -P2PShareViewBootomViewDelegate
//聊天
-(void)chatBtnClickAction
{
UserModel*model=[dataContorl getUserInfo];
NSString *myAcount = [NSString stringWithFormat:@"%@",model.userId];
NSString *tarGetAcount = [NSString stringWithFormat:@"%@",self.listRoomInfo.userId];
if ([myAcount isEqualToString:tarGetAcount]) {
[self.view makeToast:@"不能和自己聊天哦"];
return;
}
[[NIMSDK sharedSDK].loginManager login:myAcount token:model.neteaseToken completion:^(NSError *error) {
if (!error) {
NSLog(@"登录成功");
//创建session
NIMSession *session = [NIMSession session:tarGetAcount type:NIMSessionTypeP2P];
//创建聊天页,这个页面继承自 NIMKit 中的组件 NIMSessionViewController
self.hidesBottomBarWhenPushed = YES;
IfishSessionViewController *vc = [[IfishSessionViewController alloc] initWithSession:session];
//vc.targetChatname = listmodel.nickName;
[self stopP2PPlayingGLViewVideo];
[self.navigationController pushViewController:vc animated:YES];
}else{
NSLog(@"登录失败");
}
}];
}
#pragma mark- 暂停 挂断
-(void)stopP2PPlayingGLViewVideo{
if(!self.isReject){
self.isReject = !self.isReject;
while (self.isPlaying) {
usleep(50*1000);
}
[[P2PClient sharedClient] p2pHungUp];
self.remoteView.isQuitMonitorInterface = NO;//rtsp监控界面弹出修改
}
}
#pragma mark -已有人观看事件
-(void)alreadyHaveLookP
{
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提示" message:@"当前有人正在观看,请稍后再来观看" delegate:self cancelButtonTitle:@"知道了" otherButtonTitles:nil];
[alert show];
});
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//取消
[self stopP2PPlayingGLViewVideo];
///[self.remoteView getLastImgGoback];
[AppDelegate sharedDefault].canFullScreen = NO;
[self.remoteView releseromotViewSet];
[self.navigationController popViewControllerAnimated:YES];
}
@end
@@ -0,0 +1,19 @@
//
// KanKanBanner.h
// Ifish
//
// Created by imac on 16/11/18.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <Foundation/Foundation.h>
//v4.1 之前版本使用
@interface KanKanBanner : NSObject
@property(nonatomic,copy)NSString *appShow;
@property(nonatomic,copy)NSString *bannerId;
@property(nonatomic,copy)NSString *bannerImg;
@property(nonatomic,copy)NSString *bannerLink;
@property(nonatomic,copy)NSString *bannerType;
@end
@@ -0,0 +1,13 @@
//
// KanKanBanner.m
// Ifish
//
// Created by imac on 16/11/18.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "KanKanBanner.h"
@implementation KanKanBanner
@end
@@ -0,0 +1,16 @@
//
// KanKanListDataHelper.h
// Ifish
//
// Created by imac on 16/11/24.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "IfishKankanListModel.h"
@interface KanKanListDataHelper : NSObject
+(void)formatKanKanLisetData:(IfishKankanListModel*)mode liveRoomInfo:(NSDictionary*)dic;
@end
@@ -0,0 +1,29 @@
//
// KanKanListDataHelper.m
// Ifish
//
// Created by imac on 16/11/24.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "KanKanListDataHelper.h"
@implementation KanKanListDataHelper
+(void)formatKanKanLisetData:(IfishKankanListModel*)mode liveRoomInfo:(NSDictionary*)dic
{
mode.room_id = dic[@"roomId"];
mode.room_name = dic[@"roomName"];
mode.nickname = dic[@"nickName"];
mode.roomDesc = dic[@"roomDesc"];
mode.popularityValue = dic[@"popularityValue"];
mode.distance = dic[@"distance"];
mode.numberDays = dic[@"numberDays"];
mode.cameraId = dic[@"cameraId"];
mode.userImg = dic[@"userImg"];
mode.liveness = dic[@"liveness"];
mode.userId = dic[@"userId"];
mode.userType = dic[@"userType"];
}
@end
@@ -0,0 +1,29 @@
//
// KanKanListTableCell.h
// Ifish
//
// Created by imac on 16/11/11.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "IfishKankanListModel.h"
#import "MBProgressHUD.h"
//typedef void (^backOdersAddToal)(NSString *backOders,NSString *toal,NSMutableArray *dataA);
@protocol RecommendTableCellDelegate <NSObject>
-(void)TapRecommendTableCellDelegate:(IfishKankanListModel *)kankanListModel;
@end
@interface KanKanListTableCell : UITableViewCell <UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>
@property (nonatomic, assign) id<RecommendTableCellDelegate>delegate;
@property(nonatomic,strong) UICollectionView *collectionView;
@property(nonatomic,strong) NSMutableArray *dataArray;
//-(void)loadData:(NSMutableArray*)dataArray oders:(backOdersAddToal)oders;
-(void)loadDta:(NSMutableArray*)dataArray;
@end
@@ -0,0 +1,152 @@
//
// KanKanListTableCell.m
// Ifish
//
// Created by imac on 16/11/11.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "KanKanListTableCell.h"
#import "ZWCollectionViewFlowLayout.h"
#import "KankanListCollectionViewCell.h"
#define KWidth_Scale [UIScreen mainScreen].bounds.size.width/375.0f
static NSString *cellIdentifier = @"KankanListCollectionViewCell";
#import "KanKanListDataHelper.h"
@interface KanKanListTableCell () <ZWwaterFlowDelegate>
{
ZWCollectionViewFlowLayout *_flowLayout;//自定义layout
//int a;
}
@end
@implementation KanKanListTableCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.dataArray = [[NSMutableArray alloc] init];
//self.compArray = [[NSMutableArray alloc] init];
[self initContentView];
}
return self;
}
#pragma mark- 获取直播列表
/**
* 1、获取综合数据(5条距离用户最近的+5条用户最近浏览的+5条人气值最高的)直传userId,首先显示综合数据,剩下的数据按时间倒序返回,传firstResult和pageSize。
2、直播间封面默认是:
本地:http://192.168.61.128:81/room/${roomId}.png
正式云:http://app.ifish7.com/room/${roomId}.png
测试云:http://app.zhangxinyanv5.top/room/${roomId}.png
*/
-(void)loadDta:(NSMutableArray*)dataArray
{
self.dataArray = dataArray;
int rowNumb = 0;
rowNumb = (int)(self.dataArray.count+1)/2;
CGFloat HCELL= ((280*KWidth_Scale-3*5)/2)*rowNumb + 5*rowNumb;
_collectionView.frame = CGRectMake(0,0,kScreenSize.width, HCELL);
[_collectionView reloadData];
}
-(void)initContentView
{
//初始化自定义layout
_flowLayout = [[ZWCollectionViewFlowLayout alloc] init];
_flowLayout.colMagrin = 5;
_flowLayout.rowMagrin = 5;
_flowLayout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
_flowLayout.colCount = 2;
_flowLayout.degelate = self;
//CGFloat AdbarH =kScreenSize.width*0.47;
int rowNumb = 0;
rowNumb = (int)(_dataArray.count +1)/2 ;
CGFloat HCELL= ((270*KWidth_Scale-3*5)/2)*rowNumb + 5*rowNumb;
_collectionView=[[UICollectionView alloc]initWithFrame:CGRectMake(0,0,kScreenSize.width, HCELL) collectionViewLayout:_flowLayout];
_collectionView.delegate=self;
_collectionView.dataSource=self;
_collectionView.bounces=NO;
_collectionView.scrollEnabled=NO;
_collectionView.showsVerticalScrollIndicator=NO; //指示条
_collectionView.backgroundColor=TABLE_BACKGROUD_COLOR;
//_collectionView.backgroundColor = [UIColor blueColor];
[self addSubview:_collectionView];
//注册显示cell的类型
UINib *cellNib=[UINib nibWithNibName:@"KankanListCollectionViewCell" bundle:nil];
[self.collectionView registerNib:cellNib forCellWithReuseIdentifier:cellIdentifier];
}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return self.dataArray.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
KankanListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
IfishKankanListModel*model = _dataArray[indexPath.row];
cell.backgroundColor = TABLE_BACKGROUD_COLOR;
//cell.backgroundColor = [UIColor yellowColor];
[cell loadDataAt:indexPath withListModel:model];
return cell;
}
#pragma mark UICollectionViewDelegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
IfishKankanListModel *listModel=_dataArray[indexPath.row];
if (self.delegate && [self.delegate respondsToSelector:@selector(TapRecommendTableCellDelegate:)]) {
[self.delegate TapRecommendTableCellDelegate:listModel];
}
}
#pragma mark ZWwaterFlowDelegate
- (CGFloat)ZWwaterFlow:(ZWCollectionViewFlowLayout *)waterFlow heightForWidth:(CGFloat)width atIndexPath:(NSIndexPath *)indexPach
{
return (270*KWidth_Scale-3*5)/2;
}
@end
@@ -0,0 +1,22 @@
//
// KankanListCollectionViewCell.h
// Ifish
//
// Created by imac on 16/11/8.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "IfishKankanListModel.h"
@interface KankanListCollectionViewCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UIImageView *faceImg;
@property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *roomDesc;
-(void)loadDataAt:(NSIndexPath *)indexPath withListModel:(IfishKankanListModel*)model;
@property (weak, nonatomic) IBOutlet UIImageView *renZhengImg;
@property (weak, nonatomic) IBOutlet UILabel *punlunNumber;
@end
@@ -0,0 +1,58 @@
//
// KankanListCollectionViewCell.m
// Ifish
//
// Created by imac on 16/11/8.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "KankanListCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation KankanListCollectionViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
-(void)loadDataAt:(NSIndexPath *)indexPath withListModel:(IfishKankanListModel*)model
{
if (indexPath.section==1) {
}
self.userNameLabel.text = model.nickname;
self.userNameLabel.userInteractionEnabled = YES;
self.roomDesc.text = model.room_name;
self.roomDesc.userInteractionEnabled = YES;
//获取系统当前的时间戳 防止缓存
//NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];
//NSTimeInterval time=[dat timeIntervalSince1970]*1000;
//NSString *timeString = [NSString stringWithFormat:@"%.0f",time];
//NSString * imgUrl = [NSString stringWithFormat:@"%@/room/%@.png?time=%@",JIEKOUPORTHTTP,model.room_id,timeString];
NSString * imgUrl = [NSString stringWithFormat:@"%@/room/%@.png",JIEKOUPORTHTTP,model.room_id];
self.faceImg.userInteractionEnabled = YES;
[self.faceImg sd_setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:[UIImage imageNamed:@"live_hold"]];
if (!model.userType) {
model.userType = @"0";
}
if ([model.userType isEqualToString:@"1"]) {
self.renZhengImg.hidden =NO;
self.renZhengImg.image = [UIImage imageNamed:@"look_home_attestation"];
}else{
self.renZhengImg.image = nil;
self.renZhengImg.hidden =YES;
}
self.punlunNumber.text = [NSString stringWithFormat:@"%d",model.pinglunNum];
}
@end
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="KankanListCollectionViewCell">
<rect key="frame" x="0.0" y="0.0" width="219" height="134"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="219" height="134"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="shop_certification_header.png" translatesAutoresizingMaskIntoConstraints="NO" id="11A-sV-9Q9">
<rect key="frame" x="0.0" y="0.0" width="219" height="105"/>
<constraints>
<constraint firstAttribute="width" secondItem="11A-sV-9Q9" secondAttribute="height" multiplier="73:35" id="Vfi-Vh-tCr"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8g2-Yc-I6c">
<rect key="frame" x="0.0" y="84" width="219" height="21"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Img_kankanuser.png" translatesAutoresizingMaskIntoConstraints="NO" id="Nju-3t-Lwl">
<rect key="frame" x="0.0" y="1" width="18" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="6zN-6a-BRt"/>
<constraint firstAttribute="width" constant="18" id="sH5-S4-TZY"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="小陈主播" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rzo-fX-nZ7">
<rect key="frame" x="19" y="4" width="45" height="13"/>
<constraints>
<constraint firstAttribute="height" constant="13" id="11x-uL-LEJ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="livein_icon_comment.png" translatesAutoresizingMaskIntoConstraints="NO" id="qMG-I6-Rbp">
<rect key="frame" x="184" y="6" width="11" height="9"/>
<constraints>
<constraint firstAttribute="width" constant="11" id="edq-fy-8bq"/>
<constraint firstAttribute="height" constant="9" id="sk9-EI-hA1"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="100" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6ot-CK-ihH">
<rect key="frame" x="198" y="0.0" width="19" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="IQN-74-K5n"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="6ot-CK-ihH" firstAttribute="leading" secondItem="qMG-I6-Rbp" secondAttribute="trailing" constant="3" id="09R-I3-EVo"/>
<constraint firstAttribute="height" constant="21" id="4ew-sb-kzC"/>
<constraint firstItem="Nju-3t-Lwl" firstAttribute="centerY" secondItem="8g2-Yc-I6c" secondAttribute="centerY" id="4rh-pc-zxL"/>
<constraint firstItem="rzo-fX-nZ7" firstAttribute="leading" secondItem="Nju-3t-Lwl" secondAttribute="trailing" constant="1" id="Jr9-P3-RPh"/>
<constraint firstItem="qMG-I6-Rbp" firstAttribute="centerY" secondItem="6ot-CK-ihH" secondAttribute="centerY" id="Mfe-xa-ghq"/>
<constraint firstItem="qMG-I6-Rbp" firstAttribute="centerY" secondItem="rzo-fX-nZ7" secondAttribute="centerY" id="UdE-cg-M52"/>
<constraint firstAttribute="trailing" secondItem="6ot-CK-ihH" secondAttribute="trailing" constant="2" id="V6o-vO-2wV"/>
<constraint firstItem="Nju-3t-Lwl" firstAttribute="leading" secondItem="8g2-Yc-I6c" secondAttribute="leading" id="tWy-JP-QhL"/>
<constraint firstItem="rzo-fX-nZ7" firstAttribute="centerY" secondItem="8g2-Yc-I6c" secondAttribute="centerY" id="uya-xi-pmN"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="爱鱼宣言" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Vc5-cH-hcK">
<rect key="frame" x="0.0" y="110" width="219" height="13"/>
<constraints>
<constraint firstAttribute="height" constant="13" id="jcs-sC-tw8"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.20784313725490194" green="0.20784313725490194" blue="0.20784313725490194" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qfw-TX-xD4">
<rect key="frame" x="166" y="0.0" width="53" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="Paq-Lh-8wj"/>
<constraint firstAttribute="width" constant="53" id="gSB-2u-QKs"/>
</constraints>
</imageView>
</subviews>
</view>
<constraints>
<constraint firstItem="8g2-Yc-I6c" firstAttribute="top" secondItem="11A-sV-9Q9" secondAttribute="bottom" constant="-21" id="2f0-oI-0ZU"/>
<constraint firstItem="qfw-TX-xD4" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="LvX-Af-cMu"/>
<constraint firstItem="11A-sV-9Q9" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="M8V-S6-d9f"/>
<constraint firstItem="8g2-Yc-I6c" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="QnK-wT-1RO"/>
<constraint firstItem="11A-sV-9Q9" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="Vwq-Zt-cV4"/>
<constraint firstAttribute="trailing" secondItem="Vc5-cH-hcK" secondAttribute="trailing" id="aVD-AG-UqO"/>
<constraint firstItem="Vc5-cH-hcK" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="bjS-U5-tAK"/>
<constraint firstAttribute="trailing" secondItem="qfw-TX-xD4" secondAttribute="trailing" id="eHW-Qz-lFL"/>
<constraint firstItem="Vc5-cH-hcK" firstAttribute="top" secondItem="11A-sV-9Q9" secondAttribute="bottom" constant="5" id="f5m-dd-kZ7"/>
<constraint firstItem="Vc5-cH-hcK" firstAttribute="top" secondItem="8g2-Yc-I6c" secondAttribute="bottom" constant="5" id="nYN-vP-AAk"/>
<constraint firstAttribute="trailing" secondItem="8g2-Yc-I6c" secondAttribute="trailing" id="nnu-tA-eYS"/>
<constraint firstAttribute="trailing" secondItem="11A-sV-9Q9" secondAttribute="trailing" id="seg-jy-L6G"/>
</constraints>
<size key="customSize" width="219" height="125"/>
<connections>
<outlet property="faceImg" destination="11A-sV-9Q9" id="ZEk-8E-pIp"/>
<outlet property="punlunNumber" destination="6ot-CK-ihH" id="Qxc-BZ-pD4"/>
<outlet property="renZhengImg" destination="qfw-TX-xD4" id="jE0-Yh-qXI"/>
<outlet property="roomDesc" destination="Vc5-cH-hcK" id="i15-Ot-Cvu"/>
<outlet property="userNameLabel" destination="rzo-fX-nZ7" id="UxC-Vb-08r"/>
</connections>
<point key="canvasLocation" x="-237.5" y="40.5"/>
</collectionViewCell>
</objects>
<resources>
<image name="Img_kankanuser.png" width="16" height="16"/>
<image name="livein_icon_comment.png" width="11" height="9"/>
<image name="shop_certification_header.png" width="640" height="237"/>
</resources>
</document>
@@ -0,0 +1,23 @@
//
// ToolBarView.h
// BeautifulChina--test1
//
// Created by scsys on 15/7/20.
// Copyright (c) 2015年 . All rights reserved.
//
#import <UIKit/UIKit.h>
@class ZWCollectionViewFlowLayout;
@protocol ZWwaterFlowDelegate <NSObject>
-(CGFloat)ZWwaterFlow:(ZWCollectionViewFlowLayout*)waterFlow heightForWidth:(CGFloat)width atIndexPath:(NSIndexPath*)indexPach;
@end
@interface ZWCollectionViewFlowLayout : UICollectionViewLayout
@property(nonatomic,assign)UIEdgeInsets sectionInset;
@property(nonatomic,assign)CGFloat rowMagrin;
@property(nonatomic,assign)CGFloat colMagrin;
@property(nonatomic,assign)CGFloat colCount;
@property(nonatomic,weak)id<ZWwaterFlowDelegate>degelate;
@end
@@ -0,0 +1,97 @@
//
// ToolBarView.h
// BeautifulChina--test1
//
// Created by scsys on 15/7/20.
// Copyright (c) 2015年 . All rights reserved.
//
#import "ZWCollectionViewFlowLayout.h"
@interface ZWCollectionViewFlowLayout()
@property(nonatomic,retain)NSMutableDictionary * maxYdic;
@end
@implementation ZWCollectionViewFlowLayout
-(NSMutableDictionary *)maxYdic
{
if (!_maxYdic) {
self.maxYdic = [[NSMutableDictionary alloc] init];
}
return _maxYdic;
}
-(instancetype)init
{
if (self=[super init]) {
self.colMagrin = 10;
self.rowMagrin = 10;
self.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
self.colCount = 2;
}
return self;
}
-(void)prepareLayout
{
[super prepareLayout];
}
-(BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
{
return YES;
}
-(CGSize)collectionViewContentSize
{
__block NSString * maxCol = @"0";
//找出最短的列
[self.maxYdic enumerateKeysAndObjectsUsingBlock:^(NSString * column, NSNumber *maxY, BOOL *stop) {
if ([maxY floatValue]>[self.maxYdic[maxCol] floatValue]) {
maxCol = column;
}
}];
return CGSizeMake(0, [self.maxYdic[maxCol] floatValue]);
}
-(UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath
{
__block NSString * minCol = @"0";
//找出最短的列
[self.maxYdic enumerateKeysAndObjectsUsingBlock:^(NSString * column, NSNumber *maxY, BOOL *stop) {
if ([maxY floatValue]<[self.maxYdic[minCol] floatValue]) {
minCol = column;
}
}];
// 计算宽度
CGFloat width = (self.collectionView.frame.size.width-self.sectionInset.left-self.sectionInset.right-(self.colCount-1)*self.colMagrin)/self.colCount;
// 计算高度
CGFloat hight = [self.degelate ZWwaterFlow:self heightForWidth:width atIndexPath:indexPath];
// NSLog(@"-----%f",width);
// CGFloat hight =100+arc4random_uniform(100);
CGFloat x = self.sectionInset.left + (width+ self.colMagrin)* [minCol intValue];
CGFloat y =[self.maxYdic[minCol] floatValue]+self.rowMagrin;
// 跟新最大的y值
self.maxYdic[minCol] = @(y+hight);
// 计算位置
UICollectionViewLayoutAttributes * attri =[UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];
attri.frame = CGRectMake(x, y, width, hight);
return attri;
}
-(NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
{
for(int i = 0;i<self.colCount;i++)
{
NSString * col = [NSString stringWithFormat:@"%d",i];
self.maxYdic[col] = @0;
}
NSMutableArray * array = [NSMutableArray array];
NSInteger count = [self.collectionView numberOfItemsInSection:0];
for (int i = 0; i < count; i++) {
UICollectionViewLayoutAttributes * attrs = [self layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForItem:i inSection:0]];
[array addObject:attrs];
}
return array;
}
@end
@@ -0,0 +1,20 @@
//
// IfishCommentEditeView.h
// CollectionViewTest
//
// Created by imac on 17/2/22.
// Copyright © 2017年 xiang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface IfishCommentEditeView : UIView
@property (nonatomic, strong) UITextField *commentTextField;
@property (nonatomic, strong) UIButton *sendButton;
@property (nonatomic, copy) void (^SendCommentHandler)(NSString *content);
@property (nonatomic, strong) UIView *commentInputView;
@property (nonatomic, copy) NSString *palceholderText;
-(void)setPalceholderText:(NSString *)palceholderText;
@end
@@ -0,0 +1,164 @@
//
// IfishCommentEditeView.m
// CollectionViewTest
//
// Created by imac on 17/2/22.
// Copyright © 2017年 xiang. All rights reserved.
//
#import "IfishCommentEditeView.h"
@interface IfishCommentEditeView ()<UITextFieldDelegate>
@end
@implementation IfishCommentEditeView
-(instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
self.backgroundColor = [UIColor clearColor];
//self.alpha = 0.3;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissSelfViewTap)];
[self addGestureRecognizer:tap];
[self creatInpuView];
//黑色背景 个人强烈建议加上 需求不要去掉
UIView *holdView =[[UIView alloc] initWithFrame:frame];
holdView.backgroundColor = [UIColor blackColor];
holdView.alpha = 0.3;
//[self addSubview:holdView];
[self bringSubviewToFront:self.commentInputView];
}
return self;
}
-(void)creatInpuView{
NSArray *commentInputNibs = [[NSBundle mainBundle]loadNibNamed:@"IfishCommentEditeView" owner:self options:nil];
UIView *commentInputView = [commentInputNibs objectAtIndex:0];
self.commentInputView = commentInputView;
self.commentTextField = [commentInputView.subviews objectAtIndex:0];
self.sendButton = [commentInputView.subviews objectAtIndex:1];
self.sendButton.clipsToBounds = YES;
self.sendButton.layer.cornerRadius = self.sendButton.frame.size.height/2;
self.commentTextField.delegate = self;
[self.commentTextField becomeFirstResponder];
self.commentInputView.frame = CGRectMake(0, self.frame.size.height-self.commentInputView.frame.size.height, self.frame.size.width, self.commentInputView.frame.size.height);
[self addSubview:self.commentInputView];
[self bringSubviewToFront:self.commentInputView];
[self.sendButton addTarget:self action:@selector(sendCommend) forControlEvents:UIControlEventTouchUpInside];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
}
-(void)setPalceholderText:(NSString *)palceholderText
{
_palceholderText = palceholderText;
}
- (void)sendCommend
{
if (self.commentTextField.text.length > 200) {
[self makeToast:@"评论内容不能超过200字"];
return;
}
if (self.commentTextField.text.length == 0) {
[self makeToast:@"评论内容不能为空"];
return;
}
if (self.SendCommentHandler) {
self.SendCommentHandler(self.commentTextField.text);
}
[self dismissKeyboard];
}
- (void)dismissKeyboard
{
if ([self.commentTextField becomeFirstResponder]) {
[self.commentTextField resignFirstResponder];
}
}
-(void)dismissSelfViewTap{
[self removeFromSuperview];
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;
{
if (textField ==self.commentTextField) {
textField.placeholder = _palceholderText;
}
return YES;
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
if (textField ==self.commentTextField) {
[self sendCommend];
}
return YES;
}
- (void)keyboardWillShow:(NSNotification*)notification {
// get keyboard size and loctaion
CGRect keyboardBounds;
[[notification.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds];
NSNumber *duration = [notification.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [notification.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
// Need to translate the bounds to account for rotation.
keyboardBounds = [self convertRect:keyboardBounds toView:nil];
// get a rect for the textView frame
CGRect commentInputViewFrame = self.commentInputView.frame;
commentInputViewFrame.origin.y = self.bounds.size.height - (keyboardBounds.size.height + commentInputViewFrame.size.height);
// animations settings
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:[duration doubleValue]];
[UIView setAnimationCurve:[curve intValue]];
// set views with new info
self.commentInputView.frame = commentInputViewFrame;
[UIView commitAnimations];
}
- (void) keyboardWillHide:(NSNotification *)note
{
[self dismissSelfView];
}
-(void)dismissSelfView
{
[self removeFromSuperview];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
self.commentInputView = nil;
self.commentTextField = nil;
}
@end
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="320" height="50"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="mc2-cD-RYw">
<rect key="frame" x="16" y="10" width="222" height="30"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="send"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="SCm-6c-OCD">
<rect key="frame" x="254" y="11" width="58" height="28"/>
<color key="backgroundColor" red="0.15294117647058825" green="0.71764705882352942" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="58" id="4Fn-3i-gNh"/>
<constraint firstAttribute="height" constant="28" id="UeX-vo-O6B"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<state key="normal" title="发送"/>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="mc2-cD-RYw" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="2lI-WC-QPH"/>
<constraint firstItem="SCm-6c-OCD" firstAttribute="leading" secondItem="mc2-cD-RYw" secondAttribute="trailing" constant="16" id="LQB-HC-RMP"/>
<constraint firstItem="mc2-cD-RYw" firstAttribute="centerY" secondItem="SCm-6c-OCD" secondAttribute="centerY" id="UhS-oZ-neD"/>
<constraint firstItem="mc2-cD-RYw" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="Yh4-iu-B0Q"/>
<constraint firstAttribute="trailing" secondItem="SCm-6c-OCD" secondAttribute="trailing" constant="8" id="weA-Oq-B6n"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="-77" y="-189"/>
</view>
</objects>
</document>
@@ -0,0 +1,22 @@
//
// IfishFeedCellHeaghtCalculator.h
// CollectionViewTest
//
// Created by imac on 17/2/21.
// Copyright © 2017年 xiang. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "IfishFeedListData.h"
@interface IfishFeedCellHeaghtCalculator : NSObject
//系统计算高度后缓存进cache
-(void)setHeight:(CGFloat)height withCalculateheightModel:(IfishFeedListData *)model;
//根据model hash 获取cache中的高度,如过无则返回-1
-(CGFloat)heightForCalculateheightModel:(IfishFeedListData *)model;
//清空cache
-(void)clearCaches;
@end
@@ -0,0 +1,67 @@
//
// IfishFeedCellHeaghtCalculator.m
// CollectionViewTest
//
// Created by imac on 17/2/21.
// Copyright © 2017年 xiang. All rights reserved.
//
#import "IfishFeedCellHeaghtCalculator.h"
@interface IfishFeedCellHeaghtCalculator ()
@property (strong, nonatomic, readonly) NSCache *cache;
@end
@implementation IfishFeedCellHeaghtCalculator
#pragma mark - Init
-(instancetype)init
{
self = [super init];
if (self) {
[self defaultConfigure];
}
return self;
}
-(void)defaultConfigure
{
NSCache *cache = [NSCache new];
cache.name = @"IfishFeedCellHeaghtCalculator.cache";
cache.countLimit = 200;
_cache = cache;
}
#pragma mark - NSObject
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: cache=%@",
[self class], self.cache];
}
#pragma mark - Publci Methods
-(void)clearCaches
{
[self.cache removeAllObjects];
}
-(void)setHeight:(CGFloat)height withCalculateheightModel:(IfishFeedListData *)model
{
NSAssert(model != nil, @"Cell Model can't nil");
NSAssert(height >= 0, @"cell height must greater than or equal to 0");
[self.cache setObject:[NSNumber numberWithFloat:height] forKey:@(model.hash)];
}
-(CGFloat)heightForCalculateheightModel:(IfishFeedListData *)model
{
NSNumber *cellHeightNumber = [self.cache objectForKey:@(model.hash)];
if (cellHeightNumber) {
return [cellHeightNumber floatValue];
}else
return -1;
}
@end
@@ -0,0 +1,24 @@
//
// XuanYanCellHCaculator.h
// Ifish
//
// Created by imac on 17/2/21.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "IfishKankanListModel.h"
@interface XuanYanCellHCaculator : NSObject
//系统计算高度后缓存进cache
-(void)setHeight:(CGFloat)height withCalculateheightModel:(IfishKankanListModel *)model;
//根据model hash 获取cache中的高度,如过无则返回-1
-(CGFloat)heightForCalculateheightModel:(IfishKankanListModel *)model;
//清空cache
-(void)clearCaches;
@end
@@ -0,0 +1,67 @@
//
// XuanYanCellHCaculator.m
// Ifish
//
// Created by imac on 17/2/21.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "XuanYanCellHCaculator.h"
@interface XuanYanCellHCaculator ()
@property (strong, nonatomic, readonly) NSCache *cache;
@end
@implementation XuanYanCellHCaculator
#pragma mark - Init
-(instancetype)init
{
self = [super init];
if (self) {
[self defaultConfigure];
}
return self;
}
-(void)defaultConfigure
{
NSCache *cache = [NSCache new];
cache.name = @"XuanYanCellHCaculator.cache";
cache.countLimit = 200;
_cache = cache;
}
#pragma mark - NSObject
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: cache=%@",
[self class], self.cache];
}
#pragma mark - Publci Methods
-(void)clearCaches
{
[self.cache removeAllObjects];
}
-(void)setHeight:(CGFloat)height withCalculateheightModel:(IfishKankanListModel *)model
{
NSAssert(model != nil, @"Cell Model can't nil");
NSAssert(height >= 0, @"cell height must greater than or equal to 0");
[self.cache setObject:[NSNumber numberWithFloat:height] forKey:@(model.hash)];
}
-(CGFloat)heightForCalculateheightModel:(IfishKankanListModel *)model
{
NSNumber *cellHeightNumber = [self.cache objectForKey:@(model.hash)];
if (cellHeightNumber) {
return [cellHeightNumber floatValue];
}else
return -1;
}
@end
@@ -0,0 +1,24 @@
//
// IfishFeedListData.h
// CollectionViewTest
//
// Created by imac on 17/2/21.
// Copyright © 2017年 xiang. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface IfishFeedListData : NSObject
@property (nonatomic,copy) NSString *userImg;
@property (nonatomic,copy) NSString *userName;
@property (nonatomic,copy) NSString *messageId;
@property (nonatomic,copy) NSString *messageContent;
@property (nonatomic,copy) NSString *time;
@property (nonatomic,copy) NSString *userId;
@property (nonatomic,copy) NSString *roomId;
@property (nonatomic,copy) NSString *asUserId;
@property (nonatomic,copy) NSString *asUserName;
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
@end
@@ -0,0 +1,31 @@
//
// IfishFeedListData.m
// CollectionViewTest
//
// Created by imac on 17/2/21.
// Copyright © 2017年 xiang. All rights reserved.
//
#import "IfishFeedListData.h"
@implementation IfishFeedListData
-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
self = [super init];
if (self) {
_userImg = dictionary[@"userImg"];
_userId = dictionary[@"userId"];
_userName = dictionary[@"userName"];
_messageId = dictionary[@"messageId"];
_time = dictionary[@"createTime"];
_roomId = dictionary[@"roomId"];
_asUserId = dictionary[@"asUserId"];
_asUserName = dictionary[@"asUserName"];
_messageContent = dictionary[@"messageContent"];
}
return self;
}
@end
@@ -0,0 +1,20 @@
//
// P2PShareViewFeedMessageCell.h
// Ifish
//
// Created by imac on 17/2/21.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "IfishFeedListData.h"
@interface P2PShareViewFeedMessageCell : UITableViewCell
@property (strong, nonatomic) IfishFeedListData *model;
@property (weak, nonatomic) IBOutlet UIImageView *userImg;
@property (weak, nonatomic) IBOutlet UILabel *userName;
@property (weak, nonatomic) IBOutlet UILabel *messageContent;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@end
@@ -0,0 +1,57 @@
//
// P2PShareViewFeedMessageCell.m
// Ifish
//
// Created by imac on 17/2/21.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "P2PShareViewFeedMessageCell.h"
#import "UIImageView+WebCache.h"
@implementation P2PShareViewFeedMessageCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.userImg.layer.masksToBounds = YES;
self.userImg.layer.cornerRadius = CGRectGetHeight(self.userImg.frame)/2;
}
#pragma mark - Setters
-(void)setModel:(IfishFeedListData *)model
{
_model = model;
self.timeLabel.text = model.time;
NSString*str=[NSString stringWithFormat:@"%@%@",kGetIconUrl,model.userImg];
[self.userImg sd_setImageWithURL:[NSURL URLWithString:str]];
if ([model.asUserId isKindOfClass:[NSNull class]]) {
self.messageContent.text = model.messageContent;
}else{
NSString *messageContent = [NSString stringWithFormat:@"@%@ %@",model.asUserName,model.messageContent];
NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:messageContent];
[attri addAttribute:NSForegroundColorAttributeName value:RGB(42, 195, 247) range:NSMakeRange(0,model.asUserName.length+1)];
[attri addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0,model.asUserName.length+1)];
self.messageContent.attributedText = attri;
}
self.userName.text = model.userName;
;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="66" id="KGk-i7-Jjw" customClass="P2PShareViewFeedMessageCell">
<rect key="frame" x="0.0" y="0.0" width="375" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="66"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NKX-Ga-PGe">
<rect key="frame" x="58" y="8" width="36" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="mM7-Ji-Srk"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2019/01/01" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hzy-XI-fMn">
<rect key="frame" x="261" y="8" width="106" height="15"/>
<constraints>
<constraint firstAttribute="width" constant="106" id="bvZ-Dv-a47"/>
<constraint firstAttribute="height" constant="15" id="gG4-J0-ACH"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KuJ-EY-iya">
<rect key="frame" x="58" y="31" width="309" height="20.5"/>
<attributedString key="attributedText">
<fragment content="feed">
<attributes>
<color key="NSColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" metaFont="cellTitle"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pWI-bZ-4di">
<rect key="frame" x="0.0" y="65" width="375" height="1"/>
<color key="backgroundColor" red="0.82745098039999998" green="0.82745098039999998" blue="0.82745098039999998" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="zSB-ts-Kmb"/>
</constraints>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ebg-HG-SzQ">
<rect key="frame" x="8" y="8" width="42" height="42"/>
<constraints>
<constraint firstAttribute="width" constant="42" id="8gf-ZE-8e4"/>
<constraint firstAttribute="height" constant="42" id="MIa-Ch-k4D"/>
</constraints>
</imageView>
</subviews>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="hzy-XI-fMn" secondAttribute="trailing" id="8JN-jQ-weM"/>
<constraint firstAttribute="topMargin" secondItem="NKX-Ga-PGe" secondAttribute="top" id="G1Q-oS-0iD"/>
<constraint firstAttribute="trailingMargin" secondItem="KuJ-EY-iya" secondAttribute="trailing" id="J9S-vZ-1pT"/>
<constraint firstAttribute="trailingMargin" secondItem="pWI-bZ-4di" secondAttribute="trailing" constant="-8" id="NFf-yO-Tqn"/>
<constraint firstItem="ebg-HG-SzQ" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="PNv-mE-aik"/>
<constraint firstAttribute="topMargin" secondItem="ebg-HG-SzQ" secondAttribute="top" id="QYt-Ko-4N6"/>
<constraint firstItem="KuJ-EY-iya" firstAttribute="top" secondItem="NKX-Ga-PGe" secondAttribute="bottom" constant="8" id="RXh-hb-ksp"/>
<constraint firstAttribute="topMargin" secondItem="hzy-XI-fMn" secondAttribute="top" id="VKv-Oc-dJz"/>
<constraint firstItem="KuJ-EY-iya" firstAttribute="top" secondItem="hzy-XI-fMn" secondAttribute="bottom" constant="8" id="hd1-LH-1pk"/>
<constraint firstAttribute="bottomMargin" secondItem="KuJ-EY-iya" secondAttribute="bottom" constant="6" id="knN-sc-PgB"/>
<constraint firstAttribute="bottomMargin" secondItem="pWI-bZ-4di" secondAttribute="bottom" constant="-8" id="rig-Re-MId"/>
<constraint firstItem="pWI-bZ-4di" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="-8" id="sI2-oj-eaj"/>
<constraint firstItem="KuJ-EY-iya" firstAttribute="leading" secondItem="ebg-HG-SzQ" secondAttribute="trailing" constant="8" id="uV0-Iq-T5n"/>
<constraint firstItem="NKX-Ga-PGe" firstAttribute="leading" secondItem="ebg-HG-SzQ" secondAttribute="trailing" constant="8" id="wa8-Uy-Iyq"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="messageContent" destination="KuJ-EY-iya" id="Lto-KT-Hbl"/>
<outlet property="timeLabel" destination="hzy-XI-fMn" id="fRt-H0-D0k"/>
<outlet property="userImg" destination="ebg-HG-SzQ" id="XqC-Dl-ZZS"/>
<outlet property="userName" destination="NKX-Ga-PGe" id="2Fy-jZ-ezn"/>
</connections>
<point key="canvasLocation" x="25.5" y="30"/>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,16 @@
//
// P2pShareLiveCommitCell.h
// Ifish
//
// Created by imac on 17/2/21.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface P2pShareLiveCommitCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *userImg;
@property (weak, nonatomic) IBOutlet UITextField *inpuTextView;
@property (weak, nonatomic) IBOutlet UILabel *totalNumber;
@end
@@ -0,0 +1,38 @@
//
// P2pShareLiveCommitCell.m
// Ifish
//
// Created by imac on 17/2/21.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "P2pShareLiveCommitCell.h"
#import "UIImageView+WebCache.h"
@implementation P2pShareLiveCommitCell
- (void)awakeFromNib {
[super awakeFromNib];
UserModel *model = [dataContorl getUserInfo];
NSString*str=[NSString stringWithFormat:@"%@%@",kGetIconUrl,model.userImg];
[self.userImg sd_setImageWithURL:[NSURL URLWithString:str] placeholderImage:[UIImage imageNamed:@"account"]];
self.inpuTextView.layer.masksToBounds = YES;
self.inpuTextView.layer.cornerRadius = CGRectGetHeight(self.inpuTextView.frame)/2;
self.userImg.layer.masksToBounds = YES;
self.userImg.layer.cornerRadius = CGRectGetHeight(self.userImg.frame)/2;
// Initialization code
UIView*phoneView=[[UIView alloc]initWithFrame:CGRectMake(0,0,18, CGRectGetHeight(self.inpuTextView.frame))];
self.inpuTextView.leftView=phoneView;
self.inpuTextView.leftViewMode=UITextFieldViewModeAlways;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="P2pShareLiveCommitCell" rowHeight="100" id="KGk-i7-Jjw" customClass="P2pShareLiveCommitCell">
<rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="180" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BNP-Fc-NK2">
<rect key="frame" x="50" y="17" width="28" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="GGE-fh-K15"/>
<constraint firstAttribute="width" constant="28" id="VaT-gh-MF4"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="vt8-0m-Ykh">
<rect key="frame" x="8" y="46" width="42" height="42"/>
<constraints>
<constraint firstAttribute="width" constant="42" id="Thu-pd-zc7"/>
<constraint firstAttribute="height" constant="42" id="vg7-dr-yvH"/>
</constraints>
</imageView>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="我也说两句" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="4CN-0s-ZwI">
<rect key="frame" x="58" y="51" width="292" height="30"/>
<color key="backgroundColor" red="0.95686274509803915" green="0.96862745098039216" blue="0.97647058823529409" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="dZ9-6F-IPE"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="留言" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CVf-kW-p0x">
<rect key="frame" x="8" y="17" width="34" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="j69-ub-FhC"/>
<constraint firstAttribute="width" constant="34" id="sXP-kq-7s3"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="vt8-0m-Ykh" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="2eY-sa-vSf"/>
<constraint firstItem="BNP-Fc-NK2" firstAttribute="leading" secondItem="CVf-kW-p0x" secondAttribute="trailing" constant="8" id="3TQ-Uf-h1F"/>
<constraint firstItem="CVf-kW-p0x" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" constant="9" id="Apn-D6-8Cl"/>
<constraint firstItem="vt8-0m-Ykh" firstAttribute="top" secondItem="CVf-kW-p0x" secondAttribute="bottom" constant="8" id="KOG-A1-rhk"/>
<constraint firstAttribute="trailingMargin" secondItem="4CN-0s-ZwI" secondAttribute="trailing" constant="17" id="cAk-jR-tIB"/>
<constraint firstItem="4CN-0s-ZwI" firstAttribute="top" secondItem="BNP-Fc-NK2" secondAttribute="bottom" constant="13" id="jXV-5v-yRr"/>
<constraint firstItem="vt8-0m-Ykh" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" constant="38" id="kWx-IY-2FD"/>
<constraint firstItem="CVf-kW-p0x" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="uiC-iI-Sem"/>
<constraint firstItem="BNP-Fc-NK2" firstAttribute="top" secondItem="CVf-kW-p0x" secondAttribute="top" id="xdV-h3-fnJ"/>
<constraint firstItem="4CN-0s-ZwI" firstAttribute="leading" secondItem="vt8-0m-Ykh" secondAttribute="trailing" constant="8" id="zRe-YO-ImE"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="inpuTextView" destination="4CN-0s-ZwI" id="VsU-9R-Usu"/>
<outlet property="totalNumber" destination="BNP-Fc-NK2" id="FCe-Lb-8lK"/>
<outlet property="userImg" destination="vt8-0m-Ykh" id="Roy-xW-6lz"/>
</connections>
<point key="canvasLocation" x="-45.5" y="24"/>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,24 @@
//
// P2PShareView1Cell.h
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "IfishKankanListModel.h"
@interface P2PShareView1Cell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *roomOwnerImg;
@property (weak, nonatomic) IBOutlet UIButton *chatBtn;
-(void)loaDataWith:(IfishKankanListModel*)model;
@property (weak, nonatomic) IBOutlet UILabel *roomUserName;
@property (weak, nonatomic) IBOutlet UIImageView *renzhengImg;
@property (weak, nonatomic) IBOutlet UIButton *zanBtn;
@property (weak, nonatomic) IBOutlet UIButton *daShangBtn;
@property (weak, nonatomic) IBOutlet UILabel *levelLabel;
@end
@@ -0,0 +1,58 @@
//
// P2PShareView1Cell.m
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "P2PShareView1Cell.h"
#import "UIImageView+WebCache.h"
@implementation P2PShareView1Cell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.chatBtn.layer.masksToBounds = YES;
self.chatBtn.layer.cornerRadius = 5;
self.roomOwnerImg.layer.masksToBounds = YES;
self.roomOwnerImg.layer.cornerRadius = 2;
}
-(void)loaDataWith:(IfishKankanListModel*)model
{
[self.roomOwnerImg sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetIconUrl,model.userImg]] placeholderImage:[UIImage imageNamed:@"live_roomUser_holder"]];
self.roomUserName.text = model.nickname;
if (!model.userType) {
model.userType = @"0";
}
if ([model.userType isEqualToString:@"1"]) {
self.renzhengImg.hidden =NO;
}else{
self.renzhengImg.hidden =YES;
}
if (model.isZan) {
[self.zanBtn setBackgroundImage:[UIImage imageNamed:@"live_botton_uncheck_like"] forState:UIControlStateNormal];
}else{
[self.zanBtn setBackgroundImage:[UIImage imageNamed:@"live_botton_like"] forState:UIControlStateNormal];
}
NSString *title = [NSString stringWithFormat:@"LV%d",model.gradeNum];
NSAttributedString * str= [[NSAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont fontWithName:@"Arial-BoldItalicMT" size:14],NSForegroundColorAttributeName:RGB(252, 217, 94)}];
self.levelLabel.attributedText = str;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina5_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="P2PShareView1Cell" id="KGk-i7-Jjw" customClass="P2PShareView1Cell">
<rect key="frame" x="0.0" y="0.0" width="320" height="84"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="84"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="k8y-Xx-OXi">
<rect key="frame" x="15" y="11" width="60" height="60"/>
<constraints>
<constraint firstAttribute="height" constant="60" id="ia0-G0-X1J"/>
<constraint firstAttribute="width" constant="60" id="lRy-w4-dhc"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BP2-VQ-Obk">
<rect key="frame" x="0.0" y="85" width="320" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" red="0.9137254901960784" green="0.9137254901960784" blue="0.8901960784313725" alpha="1" colorSpace="calibratedRGB"/>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="live_label_v.png" translatesAutoresizingMaskIntoConstraints="NO" id="hTM-h8-mp0">
<rect key="frame" x="56" y="55" width="19" height="16"/>
<constraints>
<constraint firstAttribute="width" constant="19" id="PTp-XD-dcN"/>
<constraint firstAttribute="height" constant="16" id="zVK-Pt-hRL"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="用户名" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="e3s-Oh-KIo">
<rect key="frame" x="83" y="18" width="43" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="Z4Q-L2-TZQ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HtB-76-hbb">
<rect key="frame" x="83" y="44" width="68" height="27"/>
<color key="backgroundColor" red="0.1215686275" green="0.66274509800000003" blue="0.91372549020000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="27" id="lNO-kf-uSj"/>
<constraint firstAttribute="width" constant="68" id="w9c-ZE-aLF"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<inset key="imageEdgeInsets" minX="-10" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="私聊" image="live_sharechat_iocn.png"/>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3IN-fl-Exf">
<rect key="frame" x="244" y="44" width="68" height="27"/>
<constraints>
<constraint firstAttribute="width" constant="68" id="dju-Wj-8Dv"/>
<constraint firstAttribute="height" constant="27" id="eKn-Mh-R6q"/>
</constraints>
<state key="normal" backgroundImage="live_botton_exceptional.png"/>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" text="等级" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zHc-Gp-EDS">
<rect key="frame" x="140" y="18" width="29" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="Pli-e0-Tht"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.98823529409999999" green="0.85098039219999999" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ORC-xS-F3u">
<rect key="frame" x="168" y="44" width="68" height="27"/>
<constraints>
<constraint firstAttribute="height" constant="27" id="6Fv-N5-fAE"/>
<constraint firstAttribute="width" constant="68" id="qPo-iu-BbX"/>
</constraints>
<state key="normal" backgroundImage="live_botton_like.png"/>
</button>
</subviews>
<constraints>
<constraint firstItem="ORC-xS-F3u" firstAttribute="centerY" secondItem="HtB-76-hbb" secondAttribute="centerY" id="6E1-oC-2ct"/>
<constraint firstItem="3IN-fl-Exf" firstAttribute="leading" secondItem="ORC-xS-F3u" secondAttribute="trailing" constant="8" id="CY3-c2-fFQ"/>
<constraint firstItem="hTM-h8-mp0" firstAttribute="bottom" secondItem="k8y-Xx-OXi" secondAttribute="bottom" id="DH5-zy-27r"/>
<constraint firstAttribute="trailingMargin" secondItem="3IN-fl-Exf" secondAttribute="trailing" id="FXx-MM-eBm"/>
<constraint firstItem="zHc-Gp-EDS" firstAttribute="leading" secondItem="e3s-Oh-KIo" secondAttribute="trailing" constant="14" id="IVp-QS-6qi"/>
<constraint firstItem="k8y-Xx-OXi" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="LFn-aL-yDR"/>
<constraint firstItem="k8y-Xx-OXi" firstAttribute="top" secondItem="e3s-Oh-KIo" secondAttribute="bottom" constant="-23" id="MyI-IA-fou"/>
<constraint firstItem="3IN-fl-Exf" firstAttribute="centerY" secondItem="ORC-xS-F3u" secondAttribute="centerY" id="S0b-cS-qTp"/>
<constraint firstItem="hTM-h8-mp0" firstAttribute="trailing" secondItem="k8y-Xx-OXi" secondAttribute="trailing" id="Ttp-DS-CKm"/>
<constraint firstItem="e3s-Oh-KIo" firstAttribute="leading" secondItem="k8y-Xx-OXi" secondAttribute="trailing" constant="8" id="bXf-Sl-SZE"/>
<constraint firstItem="HtB-76-hbb" firstAttribute="bottom" secondItem="k8y-Xx-OXi" secondAttribute="bottom" id="fs5-1W-87x"/>
<constraint firstItem="zHc-Gp-EDS" firstAttribute="centerY" secondItem="e3s-Oh-KIo" secondAttribute="centerY" id="g9I-9i-yuV"/>
<constraint firstItem="HtB-76-hbb" firstAttribute="leading" secondItem="k8y-Xx-OXi" secondAttribute="trailing" constant="8" id="pwz-La-yK7"/>
<constraint firstItem="k8y-Xx-OXi" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="zgc-ug-DJe"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="chatBtn" destination="HtB-76-hbb" id="1Ie-GO-awa"/>
<outlet property="daShangBtn" destination="3IN-fl-Exf" id="BJe-gm-Fvk"/>
<outlet property="levelLabel" destination="zHc-Gp-EDS" id="Qu6-wi-k2r"/>
<outlet property="renzhengImg" destination="hTM-h8-mp0" id="b0f-Ko-L34"/>
<outlet property="roomOwnerImg" destination="k8y-Xx-OXi" id="seT-cP-K9d"/>
<outlet property="roomUserName" destination="e3s-Oh-KIo" id="iVQ-ni-gdk"/>
<outlet property="zanBtn" destination="ORC-xS-F3u" id="nPp-Ty-U2s"/>
</connections>
<point key="canvasLocation" x="-147" y="49"/>
</tableViewCell>
</objects>
<resources>
<image name="live_botton_exceptional.png" width="57" height="22"/>
<image name="live_botton_like.png" width="57" height="22"/>
<image name="live_label_v.png" width="19" height="15"/>
<image name="live_sharechat_iocn.png" width="11" height="11"/>
</resources>
</document>
@@ -0,0 +1,55 @@
//
// P2PShareViewBootomView.h
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "IfishKankanListModel.h"
//分享中 底部直播间信息 view
#import "IfishFeedListData.h"
#import "P2PShareViewFeedMessageCell.h"
#import "P2pShareLiveCommitCell.h"
#import "IfishFeedCellHeaghtCalculator.h"
#import "XuanYanCellHCaculator.h"
#import "P2PShareViewFour4Cell.h"
#import "IfishCommentEditeView.h"
@protocol P2PShareViewBootomViewDelegate <NSObject>
@optional
-(void)chatBtnClickAction;
-(void)daShangSuccsess;
@end
@interface P2PShareViewBootomView : UIView<
UITableViewDelegate,
UITableViewDataSource,UITextFieldDelegate>
{
IfishFeedCellHeaghtCalculator *heightCalculator;
XuanYanCellHCaculator *xYCalculator;
NSInteger _first;
NSInteger _total;
NSInteger _totalNumber;
BOOL _isRefreshing;
BOOL _isLoadMore;
}
@property(nonatomic)BOOL isRefreshing;
@property(nonatomic)BOOL isLoadMore;
@property(nonatomic) int page;
@property(nonatomic,assign) id<P2PShareViewBootomViewDelegate> delegate;
@property(nonatomic,strong) IfishKankanListModel *roomModel;
//评论
@property(nonatomic,strong) UITableView *tableView;
@property(nonatomic,strong) NSMutableArray *massageData;
@property (nonatomic, strong) P2PShareViewFeedMessageCell *prototypeCell;
@property (nonatomic, strong) P2PShareViewFour4Cell *xuanYanCell;
@property (strong, nonatomic) IfishCommentEditeView *commentEditView;
-(void)initDataWithRoomId:(NSString *)roomId;
@end
@@ -0,0 +1,532 @@
//
// P2PShareViewBootomView.m
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "P2PShareViewBootomView.h"
#import "P2PShareView1Cell.h"
#import "P2PShareViewsec2Cell.h"
#import "P2PShareViewTh3Cell.h"
#import "JHRefresh.h"
@implementation P2PShareViewBootomView
-(id)initWithFrame:(CGRect)frame{
self= [super initWithFrame:frame];
if (self) {
self.massageData = [[NSMutableArray alloc] init];
[self setUp];
[self creatReatRefreshView];
}
return self;
}
-(void)initDataWithRoomId:(NSString *)roomId{
_page = 0;
_first = 0;
NSInteger rooId =[roomId integerValue];
[self loadMeassgeDataWithFirst:_first addrommId:rooId isRefresh:NO];
}
-(void)loadMeassgeDataWithFirst:(NSInteger)firstResult addrommId:(NSInteger)roomId isRefresh:(BOOL)isRefresh{
NSInteger pageSize = 10;
__weak typeof(self) weakSelf = self;
[AFHttpTool ifishGetLiveMeassage:firstResult pageSize:pageSize roomId:roomId success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSString *result=reDic[@"result"];
//NSLog(@"roomId:%d pinglun::%@",roomId,reDic);
if ([result isEqualToString:@"100"]) {
NSString *first = reDic[@"firstResult"];
_first = [first intValue];
NSString *total = reDic[@"total"];
_total =[total intValue];
_totalNumber = [total intValue];
NSArray *array = [reDic objectForKey:@"data"];
for (NSDictionary *dic in array) {
IfishFeedListData *model = [[IfishFeedListData alloc]initWithDictionary:dic];
[self.massageData addObject:model];
}
[weakSelf.tableView reloadData];
}
[weakSelf endRefreshing];
} failure:^(NSError *err) {
[weakSelf endRefreshing];
[weakSelf makeToast:@"请求异常"];
}];
}
-(void)creatReatRefreshView{
__weak typeof (self)weskSelf=self;
// 下拉刷新
//[weskSelf.tableView addRefreshHeaderViewWithAniViewClass:[JHRefreshAmazingAniView class] beginRefresh:^{
// if (weskSelf.isRefreshing) {
// return ;
// }
// weskSelf.isRefreshing=YES;
// [weskSelf loadData];
// }];
//上拉加载更多
[weskSelf.tableView addRefreshFooterViewWithAniViewClass:[JHRefreshCommonAniView class] beginRefresh:^{
if (weskSelf.isLoadMore) {
return ;
}
weskSelf.isLoadMore=YES;
NSInteger pagecount =_total/10+1;
if (_page<pagecount-1) {
_page++;
_first= (NSInteger)_page*10;
NSInteger roomId = [weskSelf.roomModel.room_id integerValue];
[weskSelf loadMeassgeDataWithFirst:_first addrommId:roomId isRefresh:NO];
}else{
[weskSelf endRefreshing];
[weskSelf makeToast:@"已无更多数据"];
}
}];
}
-(void)endRefreshing{
if (self.isRefreshing) {
self.isRefreshing=NO;
[self.tableView headerEndRefreshingWithResult:JHRefreshResultNone];
}
if (self.isLoadMore) {
self.isLoadMore=NO;
[self.tableView footerEndRefreshing];
}
}
-(void)setUp{
// CGFloat videoViewH= self.bounds.size.width * 9 / 16;
_tableView=[[UITableView alloc]initWithFrame:CGRectMake(0,0,self.bounds.size.width, self.bounds.size.height - 60) style:UITableViewStyleGrouped];
_tableView.dataSource=self;
_tableView.delegate=self;
_tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor=TABLE_BACKGROUD_COLOR;
self.tableView.sectionFooterHeight = 0;
self.tableView.sectionHeaderHeight = 5;
[self addSubview:_tableView];
// UIView *tabeFooterView =[[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 30)];
//tabeFooterView.backgroundColor = [UIColor redColor];
// UIButton *footbtn = [UIButton buttonWithType:UIButtonTypeCustom];
//footbtn.frame = CGRectMake(10, 0,200, 30);
//[footbtn setTitle:@"点击加载更多" forState:UIControlStateNormal];
//[tabeFooterView addSubview:footbtn];
//self.tableView.tableFooterView = tabeFooterView;
self.tableView.estimatedRowHeight = 100;
[self.tableView registerNib:[UINib nibWithNibName:@"P2PShareViewFeedMessageCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"P2PShareViewFeedMessageCell"];
self.prototypeCell = [self.tableView dequeueReusableCellWithIdentifier:@"P2PShareViewFeedMessageCell"];
[self.tableView registerNib:[UINib nibWithNibName:@"P2PShareViewFour4Cell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"P2PShareViewFour4Cell"];
self.xuanYanCell = [self.tableView dequeueReusableCellWithIdentifier:@"P2PShareViewFour4Cell"];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section ==2) {
return self.massageData.count + 1;
}
return 2;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0 && indexPath.row ==0) {
P2PShareView1Cell *cell = [tableView dequeueReusableCellWithIdentifier:@"P2PShareView1Cell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"P2PShareView1Cell" owner:self options:nil]lastObject];
}
[cell loaDataWith:self.roomModel];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//cell.backgroundColor = TABLE_BACKGROUD_COLOR;
[cell.chatBtn addTarget:self action:@selector(chatBtnAction) forControlEvents:UIControlEventTouchUpInside];
[cell.zanBtn addTarget:self action:@selector(zanBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[cell.daShangBtn addTarget:self action:@selector(daShangBtnClick:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}else if (indexPath.section == 0 && indexPath.row ==1){
P2PShareViewsec2Cell *cell = [tableView dequeueReusableCellWithIdentifier:@"P2PShareViewsec2Cell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"P2PShareViewsec2Cell" owner:self options:nil]lastObject];
}
[cell loaDataWith:self.roomModel];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// cell.backgroundColor = TABLE_BACKGROUD_COLOR;
return cell;
}else if (indexPath.section == 1 && indexPath.row ==0){
P2PShareViewTh3Cell *cell = [tableView dequeueReusableCellWithIdentifier:@"P2PShareViewTh3Cell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"P2PShareViewTh3Cell" owner:self options:nil]lastObject];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//cell.backgroundColor = TABLE_BACKGROUD_COLOR;
cell.roomName.text = self.roomModel.room_name;
return cell;
}else if (indexPath.section == 1 && indexPath.row ==1){
P2PShareViewFour4Cell *cell= [tableView dequeueReusableCellWithIdentifier:@"P2PShareViewFour4Cell" forIndexPath:indexPath];
cell.model = self.roomModel;
//cell.backgroundColor = [UIColor redColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}else if (indexPath.section == 2 && indexPath.row ==0){
P2pShareLiveCommitCell *cell = [tableView dequeueReusableCellWithIdentifier:@"P2pShareLiveCommitCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"P2pShareLiveCommitCell" owner:self options:nil]lastObject];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.inpuTextView.delegate = self;
cell.totalNumber.text =[NSString stringWithFormat:@"%ld",(long)_totalNumber];
return cell;
}else if (indexPath.section == 2 && indexPath.row >0){
P2PShareViewFeedMessageCell *cell= [tableView dequeueReusableCellWithIdentifier:@"P2PShareViewFeedMessageCell" forIndexPath:indexPath];
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
return nil;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section==1||section ==2) {
return 5;
}
return 0.1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//int sliderValue=(int)(slider.value+0.5);
//内容高度
if (indexPath.section==0 &&indexPath.row ==1) {
return 50;
}else if (indexPath.section==0 &&indexPath.row ==0){
return 100;
}else if (indexPath.section == 1 && indexPath.row ==0){
return 40;
}else if (indexPath.section == 1 && indexPath.row ==1){
CGFloat height = [xYCalculator heightForCalculateheightModel:self.roomModel];
if (height>0) {
NSLog(@"cache height");
return height;
}else{
NSLog(@"calculate height");
}
P2PShareViewFour4Cell *cell = self.xuanYanCell;
cell.contentView.translatesAutoresizingMaskIntoConstraints = NO;
cell.model = self.roomModel;
CGFloat fittingHeight = [self getCellFittingHeightWhih:cell];
CGFloat cellHeight = fittingHeight+2*1/[UIScreen mainScreen].scale;//必须加上上下分割线的高度
[xYCalculator setHeight:cellHeight withCalculateheightModel:self.roomModel];
return cellHeight;
}
else if (indexPath.section == 2 && indexPath.row ==0){
//return kScreenSize.width * 0.27;
return 100;
}
IfishFeedListData *model = model = [self.massageData objectAtIndex:indexPath.row-1];
CGFloat height = [heightCalculator heightForCalculateheightModel:model];
if (height>0) {
NSLog(@"cache height");
return height;
}else{
NSLog(@"calculate height");
}
P2PShareViewFeedMessageCell *cell = self.prototypeCell;
cell.contentView.translatesAutoresizingMaskIntoConstraints = NO;
[self configureCell:cell atIndexPath:indexPath];
CGFloat fittingHeight = [self getCellFittingHeightWhih:cell];
CGFloat cellHeight = fittingHeight+2*1/[UIScreen mainScreen].scale;//必须加上上下分割线的高度
[heightCalculator setHeight:cellHeight withCalculateheightModel:model];
//NSLog(@"cellHeight***%f",cellHeight);
return cellHeight;
}
-(CGFloat)getCellFittingHeightWhih:(UITableViewCell*)cell
{
/*------------------------------重点这里必须加上contentView的宽度约束不然计算出来的高度不准确-------------------------------------*/
CGFloat contentViewWidth = CGRectGetWidth(self.tableView.bounds);
NSLayoutConstraint *widthFenceConstraint = [NSLayoutConstraint constraintWithItem:cell.contentView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:contentViewWidth];
[cell.contentView addConstraint:widthFenceConstraint];
// Auto layout engine does its math
CGFloat fittingHeight = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
[cell.contentView removeConstraint:widthFenceConstraint];
/*-------------------------------End------------------------------------*/
return fittingHeight;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section ==2) {
if (indexPath.row ==0) {
return;
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NSString *userId = [dataContorl dataControlGetUserIdInfo];
IfishFeedListData *model = self.massageData[indexPath.row-1];
NSString *palceholdT = [NSString stringWithFormat:@"@%@",model.userName];
NSString *atUSer=[NSString stringWithFormat:@"%@",model.userId];
if ([userId isEqual:atUSer]) {
[self.superview makeToast:@"不能@自己呦"];
return;
}
[self creatCommentEditeViewWithPalceholderText:palceholdT addAsUserId:model.userId];
}
}
#pragma mark-chatBtnAction
-(void)chatBtnAction{
[self.delegate chatBtnClickAction];
}
#pragma mark Configure Cell Data
- (void)configureCell:(P2PShareViewFeedMessageCell *)cell atIndexPath:(NSIndexPath *)indexPath {
cell.model = [self.massageData objectAtIndex:indexPath.row -1];
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
// Remove seperator inset
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
// Prevent the cell from inheriting the Table View's margin settings
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
// Explictly set your cell's layout margins
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
#pragma mark -textField 代理
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
NSLog(@"ShouldBeginEditing");
//处理评论事件
[self creatCommentEditeViewWithPalceholderText:@"我也说两句" addAsUserId:nil];
return NO;
}
#pragma mark - 评论输入框
-(void)creatCommentEditeViewWithPalceholderText:(NSString *)palceholderText addAsUserId:(NSString*)asUserId
{
__weak typeof(self) weakSelf = self;
IfishCommentEditeView *commentView =[[IfishCommentEditeView alloc] initWithFrame:[UIApplication sharedApplication].keyWindow.bounds];
commentView.palceholderText = palceholderText;
[[UIApplication sharedApplication].keyWindow addSubview:commentView];
commentView.SendCommentHandler = ^(NSString *conttent){
[weakSelf sendCommentWithContent:conttent addAsUserId:asUserId];
NSLog(@"conttent:%@",conttent);
};
self.commentEditView = commentView;
}
#pragma mark -sendCommentWithContent
-(void)sendCommentWithContent:(NSString*)content addAsUserId:(NSString*)asuserId{
NSString *userId = [dataContorl dataControlGetUserIdInfo];
__weak typeof(self) weakSelf = self;
[AFHttpTool IfishCommitLeaveMessage:userId roomId:self.roomModel.room_id asUserId:asuserId messageContent:content success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSString *result=reDic[@"result"];
if ([result isEqualToString:@"100"]) {
_totalNumber ++;
NSDictionary *dataDic =reDic[@"data"];
IfishFeedListData *model = [[IfishFeedListData alloc]initWithDictionary:dataDic];
[weakSelf.massageData insertObject:model atIndex:0];
NSIndexSet *indexSet=[NSIndexSet indexSetWithIndex:2];
[weakSelf.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationNone];
//每日评论 加金币
[[IfishUserObsever sharedInstance] addGoldWith:ROOMLEAVEMSG addType:IFISHADDGOLDTYPE0];
}else{
[weakSelf makeToast:@"请求错误"];
}
} failure:^(NSError *err) {
[weakSelf makeToast:@"请求异常"];
}];
}
#pragma mark - 点赞
-(void)zanBtnClick:(UIButton *)btn{
NSString *roomId = self.roomModel.room_id;
NSString *userID = [dataContorl dataControlGetUserIdInfo];
__weak typeof(self) weakSelf = self;
[AFHttpTool liveDianZanRoomId:roomId userId:userID success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSString *result=reDic[@"result"];
if ([result isEqualToString:@"100"]){
NSDictionary *dataDic =reDic[@"data"];
weakSelf.roomModel.zanNumber = [[dataDic objectForKey:@"zanNum"] intValue];
weakSelf.roomModel.isZan = [[dataDic objectForKey:@"isZan"] boolValue];
NSIndexSet *set = [NSIndexSet indexSetWithIndex:0];
[weakSelf.tableView reloadSections:set withRowAnimation:UITableViewRowAnimationNone];
//(通知)更新直播间列表数据 只更新对应 IfishKankanListModel 列表数据做缓存处理后可不用此操作
//@"liveRoomDataDidChange"
[[NSNotificationCenter defaultCenter] postNotificationName:@"liveRoomDataDidChange" object:weakSelf.roomModel];
}else{
[weakSelf makeToast:@"点赞出了点问题"];
}
} failure:^(NSError *err) {
[weakSelf makeToast:@"网络异常"];
}];
}
#pragma mark - 打赏
-(void)daShangBtnClick:(UIButton *)btn{
NSString *userID = [dataContorl dataControlGetUserIdInfo];
NSString *peeUsrId = [NSString stringWithFormat:@"%@",self.roomModel.userId];
if ([userID isEqual:peeUsrId]) {
[self makeToast:@"不能打赏给自己呦!"];
return;
}
__weak typeof(self) weakSelf = self;
[AFHttpTool liveRoomDaShang:userID payeeUserId:peeUsrId success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSString *result=reDic[@"result"];
if ([result isEqualToString:@"100"]){
NSDictionary *dataDic =reDic[@"data"];
//更新当前用户金币
IfishUserAsset *userAset =[dataContorl getAllIfishUserAsset];
userAset.goldValue = [[dataDic objectForKey:@"userGoldValue"] integerValue];
[dataContorl resetUserAsset:userAset];
//直播间用户总金额
weakSelf.roomModel.goldValue = [[dataDic objectForKey:@"totalGoldValue"] floatValue];
NSIndexPath *index =[NSIndexPath indexPathForRow:1 inSection:0];
NSArray *rowArr =@[index];
[weakSelf.tableView reloadRowsAtIndexPaths:rowArr withRowAnimation:UITableViewRowAnimationNone];
//(通知)更新直播间列表数据 只更新对应 IfishKankanListModel 列表数据做缓存处理后可不用此操作
//@"liveRoomDataDidChange"
[[NSNotificationCenter defaultCenter] postNotificationName:@"liveRoomDataDidChange" object:weakSelf.roomModel];
//打赏金额
CGFloat rewardvalue = [[dataDic objectForKey:@"rewardValue"] floatValue];
int gold = (int)rewardvalue;
[weakSelf makeToast:[NSString stringWithFormat:@"已打赏%d金币",gold]];
}else{
[weakSelf makeToast:@"打赏了出点问题"];
}
} failure:^(NSError *err){
[weakSelf makeToast:@"网络异常"];
}];
}
@end
@@ -0,0 +1,16 @@
//
// P2PShareViewFour4Cell.h
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "IfishKankanListModel.h"
@interface P2PShareViewFour4Cell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *xuanYanLabl;
@property (strong, nonatomic) IfishKankanListModel *model;
@end
@@ -0,0 +1,37 @@
//
// P2PShareViewFour4Cell.m
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "P2PShareViewFour4Cell.h"
@implementation P2PShareViewFour4Cell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
;
}
#pragma mark - Setters
-(void)setModel:(IfishKankanListModel *)model
{
_model = model;
self.xuanYanLabl.text = model.roomDesc;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="50" id="KGk-i7-Jjw" customClass="P2PShareViewFour4Cell">
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="49.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7CE-42-psD">
<rect key="frame" x="8" y="8" width="359" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="7CE-42-psD" secondAttribute="trailing" id="BFR-W5-Kyr"/>
<constraint firstAttribute="leadingMargin" secondItem="7CE-42-psD" secondAttribute="leading" id="JsP-h3-rKU"/>
<constraint firstItem="7CE-42-psD" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="tae-hV-EL5"/>
<constraint firstItem="7CE-42-psD" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="vDw-bd-Grk"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="xuanYanLabl" destination="7CE-42-psD" id="rJ9-zg-egg"/>
</connections>
<point key="canvasLocation" x="-56.5" y="-51"/>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,14 @@
//
// P2PShareViewTh3Cell.h
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface P2PShareViewTh3Cell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *roomName;
@end
@@ -0,0 +1,24 @@
//
// P2PShareViewTh3Cell.m
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "P2PShareViewTh3Cell.h"
@implementation P2PShareViewTh3Cell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="P2PShareViewTh3Cell" id="KGk-i7-Jjw" customClass="P2PShareViewTh3Cell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="r05-Ph-tkY">
<rect key="frame" x="0.0" y="43" width="320" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" red="0.91372549020000005" green="0.91372549020000005" blue="0.89019607840000003" alpha="1" colorSpace="calibratedRGB"/>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="房间名" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wOx-oW-6un">
<rect key="frame" x="8" y="11" width="104" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="roomName" destination="wOx-oW-6un" id="9yi-rK-Lge"/>
</connections>
<point key="canvasLocation" x="-103" y="13"/>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,19 @@
//
// P2PShareViewsec2Cell.h
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "IfishKankanListModel.h"
@interface P2PShareViewsec2Cell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *liveDays;
@property (weak, nonatomic) IBOutlet UILabel *renQiLab;
@property (weak, nonatomic) IBOutlet UILabel *zanLabel;
@property (weak, nonatomic) IBOutlet UILabel *shangLabel;
-(void)loaDataWith:(IfishKankanListModel*)model;
@end
@@ -0,0 +1,41 @@
//
// P2PShareViewsec2Cell.m
// Ifish
//
// Created by imac on 16/11/17.
// Copyright © 2016年 lianxiang. All rights reserved.
//
#import "P2PShareViewsec2Cell.h"
@implementation P2PShareViewsec2Cell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.liveDays.layer.masksToBounds = YES;
self.liveDays.layer.cornerRadius = 2;
self.renQiLab.layer.masksToBounds = YES;
self.renQiLab.layer.cornerRadius = 2;
self.shangLabel.layer.masksToBounds = YES;
self.shangLabel.layer.cornerRadius = 2;
self.zanLabel.layer.masksToBounds = YES;
self.zanLabel.layer.cornerRadius =2;
}
-(void)loaDataWith:(IfishKankanListModel*)model
{
self.liveDays.text = [NSString stringWithFormat:@"开播:%@天",model.numberDays];
self.renQiLab.text = [NSString stringWithFormat:@"人气:%@",model.popularityValue];
self.zanLabel.text = [NSString stringWithFormat:@"赞:%d",model.zanNumber];
int gold = (int)model.goldValue;
self.shangLabel.text = [NSString stringWithFormat:@"赏:%d",gold];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="P2PShareViewsec2Cell" id="KGk-i7-Jjw" customClass="P2PShareViewsec2Cell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="分享:100天" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dUx-cM-rT2">
<rect key="frame" x="8" y="11" width="67" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.91764705882352937" green="0.9137254901960784" blue="0.8901960784313725" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="人气:1000" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rxB-dn-1O6">
<rect key="frame" x="83" y="11" width="66" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.91764705879999997" green="0.91372549020000005" blue="0.89019607840000003" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="赞:100" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uzI-dI-VnP">
<rect key="frame" x="157" y="11" width="50" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.91764705879999997" green="0.91372549020000005" blue="0.89019607840000003" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="赏:100" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xic-fj-b52">
<rect key="frame" x="215" y="11" width="50" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.91764705879999997" green="0.91372549020000005" blue="0.89019607840000003" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="liveDays" destination="dUx-cM-rT2" id="weY-hN-UC7"/>
<outlet property="renQiLab" destination="rxB-dn-1O6" id="zei-8P-OIE"/>
<outlet property="shangLabel" destination="xic-fj-b52" id="41l-Pk-ed2"/>
<outlet property="zanLabel" destination="uzI-dI-VnP" id="adH-NQ-TXW"/>
</connections>
<point key="canvasLocation" x="-166" y="15"/>
</tableViewCell>
</objects>
</document>