亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 系統 > iOS > 正文

IOS開發QQ空間/朋友圈類界面的搭建

2020-07-26 03:03:32
字體:
來源:轉載
供稿:網友

先來看下效果:

公司在做一個報修工單的功能,其中主要功能點在于,這個功能不完全是靜態顯示的, 它還可以點擊回復,在下面增加評論,可以點擊查看評論詳情,也可以收回評論詳情, 評論可以帶圖片,也可以不帶圖片,工單內容可以帶圖片,也可以不帶圖片。 并且回復內容的條數也不確定,就是因為這樣的不確定性,一定程度增加了開發的難度。

根據MVC的思想,最初Cell應該自帶一個數據模型dataModel,單現在我們多增加一個Frame模型, frame模型里面包含了各個子控件的frame值,并且自帶數據模型dataModel屬性,  我們就是在設置dataModel的時候 給frame計算每一個cell的高度

首先我們要準備數據模型,有了數據模型,才能計算文字的大小,才能得到Frame模型 

以下是數據模型的代碼:

#import <Foundation/Foundation.h>@interface RepairOrderModel : NSObject@property (nonatomic,strong) NSString * repair_id;@property (nonatomic,strong) NSString * faddress;@property (nonatomic,strong) NSArray * comment_imag_list;@property (nonatomic,strong) NSString * fservicecontent;@property (nonatomic,strong) NSString * frealname;@property (nonatomic,strong) NSString * fordernum;@property (nonatomic,strong) NSString * power_do;@property (nonatomic,strong) NSString * fusername;@property (nonatomic,strong) NSString * fcreatetime;@property (nonatomic,strong) NSString * fstatus;@property (nonatomic,strong) NSArray * reply_list;@property (nonatomic,strong) NSArray * repairs_imag_list;@property (nonatomic,strong) NSString * comment_score;@property (nonatomic,strong) NSString * normal_do;@property (nonatomic,strong) NSString * comment_content;@property (nonatomic,strong) NSString * fremindercount; // 加急狀態-(instancetype)initWithDict:(NSDictionary *)dict;+(instancetype)repairModelWithDict:(NSDictionary *)dict;@end

先來看看Frame模型的代碼: 

在.h文件里:

 #import <Foundation/Foundation.h>#import "RepairViewFrame.h" // 回復評論列表的區域frame@class RepairOrderModel;@interface RepairOrderFrame : NSObject/** 是否展開回復 默認是NO*/@property (nonatomic,assign) BOOL isOpenReply;/** * 頭像的frame ,結構體用assin */@property (nonatomic, assign, readonly) CGRect iconF;/** * 業主名的frame */@property (nonatomic, assign, readonly) CGRect nameF;/** * 訂單時間的frame */@property (nonatomic, assign, readonly) CGRect timeF;/** * 訂單內容的frame */@property (nonatomic, assign, readonly) CGRect desF;/** * 業主地址的frame */@property (nonatomic, assign, readonly) CGRect addF;/** * 訂單號碼的frame */@property (nonatomic, assign, readonly) CGRect orderNumF;/** * 加急狀態的frame */@property (nonatomic, assign, readonly) CGRect urgentF;/** * 配圖1的frame */@property (nonatomic, assign, readonly) CGRect image1ListF;/** * 配圖2的frame */@property (nonatomic, assign, readonly) CGRect image2ListF;/** * 配圖3的frame */@property (nonatomic, assign, readonly) CGRect image3ListF;/** * 派單按鈕的frame */@property (nonatomic, assign, readonly) CGRect sendOrdersBtnF;/** * 派單狀態的frame */@property (nonatomic, assign, readonly) CGRect sendStateF;/** * 接受按鈕的frame */@property (nonatomic, assign, readonly) CGRect acceptBtnF;/** * 評論按鈕的frame */@property (nonatomic, assign, readonly) CGRect commandBtnF;/** * 評論數量的frame */@property (nonatomic, assign, readonly) CGRect countLabelF;/** * 詳情按鈕的frame */@property (nonatomic, assign, readonly) CGRect detailBtnF;/** * 回復區域的frame */@property (nonatomic, assign, readonly) CGRect commandViewF;/** * 回復區域內部的frame模型數組 裝RepairViewFrame 模型 */@property (nonatomic,strong) NSMutableArray * repairViewFrameArr;//@property (nonatomic, assign, readonly) RepairViewFrame * commandFrameModel;/** * cell的高度 */@property (nonatomic, assign, readonly) CGFloat cellHeight;@property (nonatomic, strong) RepairOrderModel *model;  //只有拿到模型數據才能算這些屬性的frame,readonly:在這個模型里面的frame屬性別人不能亂改,只能訪問@end

因為我這個頁面比較復雜 子控件比較多 所以屬性也很多 

注意:我這里還有一個屬性是repairViewFrameArr 這個是裝載我回復區域的每一條回復的Frame

我把回復區域的每一條回復單獨做了另外一個View,所以每一個回復View就要對應一個回復Frame

我就把所有回復的Frame裝在這個數組里。(如果你們的頁面沒有回復區域,此處省略)

在設置Frame模型的實現文件.m里 

切記,在Frame模型中計算大小設置的字號應該和cell中展現一樣

// 小號字體#define SmallFont [UIFont systemFontOfSize:12]// 中號字體#define MiddleFont [UIFont systemFontOfSize:14]// 正常字體#define LargeFont [UIFont systemFontOfSize:16]#import "RepairOrderFrame.h" #import "RepairOrderModel.h" // 數據模型@implementation RepairOrderFrame-(instancetype)init{  if (self = [super init]) {    self.isOpenReply = NO;    self.repairViewFrameArr = [NSMutableArray array];  //回復數組(里面裝載回復的Frame模型)  }  return self;}/** * 計算文字尺寸 * * @param text  需要計算尺寸的文字 * @param font  文字的字體 * @param maxSize 文字的最大尺寸 */- (CGSize)sizeWithText:(NSString *)text font:(UIFont *)font maxSize:(CGSize)maxSize{  NSDictionary *attrs = @{NSFontAttributeName : font};  return [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;}- (void)setModel:(RepairOrderModel *)model //重寫set方法,接收模型數據為本類的屬性賦值{  _model = model;  // 子控件之間的間距  CGFloat padding = 10;  // 1.頭像  CGFloat iconX = padding;  CGFloat iconY = padding;  CGFloat iconW = 40;  CGFloat iconH = 40;  _iconF = CGRectMake(iconX, iconY, iconW, iconH);  // 2.業主名字  CGSize nameSize = [self sizeWithText:self.model.frealname font:LargeFont maxSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];  CGFloat nameX = CGRectGetMaxX(_iconF) + padding;  CGFloat nameY = iconY + 10;  _nameF = CGRectMake(nameX, nameY, nameSize.width, nameSize.height);  // 3.日期  CGSize timeSize = [self sizeWithText:self.model.fcreatetime font:SmallFont maxSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];  CGFloat timeX = CGRectGetMaxX(_iconF) + padding;  CGFloat timeY = nameY + nameSize.height;  _timeF = CGRectMake(timeX, timeY, timeSize.width, timeSize.height);  // 4.地址  CGSize addSize = [self sizeWithText:self.model.faddress font:LargeFont maxSize:CGSizeMake(120, MAXFLOAT)];  CGFloat addX = ScreenWidth - addSize.width - padding;  CGFloat addY = nameY;  _addF = CGRectMake(addX, addY, addSize.width, nameSize.height);  // 5.單號  CGSize orderNumSize = [self sizeWithText:[NSString stringWithFormat:@"單號:%@",self.model.fordernum] font:SmallFont maxSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];  CGFloat orderNumX = ScreenWidth - orderNumSize.width - padding;  CGFloat orderNumY = timeY;  _orderNumF = CGRectMake(orderNumX, orderNumY, orderNumSize.width, orderNumSize.height);  // 6.加急  CGSize urgentSize = [self sizeWithText:@"加急" font:MiddleFont maxSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];  CGFloat urgentX = timeX;  CGFloat urgentY = timeY + timeSize.height + 2 * padding;  _urgentF = CGRectMake(urgentX, urgentY, urgentSize.width, urgentSize.height);  // 7.服務內容  CGSize desSize = [self sizeWithText:self.model.fservicecontent font:MiddleFont maxSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];  CGFloat desX = urgentX + urgentSize.width + 2;  CGFloat desY = timeY + timeSize.height + 2 * padding;  _desF = CGRectMake(desX, desY, desSize.width, desSize.height);  // 8.圖片列表 (最多三張)  if (self.model.repairs_imag_list.count != 0) {// 有配圖    CGFloat width = 70;    switch (self.model.repairs_imag_list.count) {      case 3:      {        CGFloat pictureX = nameX + 2 * padding + 2 * width ;        CGFloat pictureY = CGRectGetMaxY(_desF) + 1.5 * padding;        _image3ListF = CGRectMake(pictureX, pictureY, width, width);      }      case 2:      {        CGFloat pictureX = nameX + padding + width;        CGFloat pictureY = CGRectGetMaxY(_desF) + 1.5 * padding;        _image2ListF = CGRectMake(pictureX, pictureY, width, width);      }      case 1:      {        CGFloat pictureX = nameX;        CGFloat pictureY = CGRectGetMaxY(_desF) + 1.5 * padding;        _image1ListF = CGRectMake(pictureX, pictureY, width, width);      }        break;    }  }  else{    _image1ListF = CGRectMake(0, CGRectGetMaxY(_desF) + 1.5 * padding , 0, 0);    _image2ListF = CGRectMake(0, CGRectGetMaxY(_desF) + 1.5 * padding , 0, 0);    _image3ListF = CGRectMake(0, CGRectGetMaxY(_desF) + 1.5 * padding , 0, 0);  }  // 9.派單button  CGFloat sendOrderX = 1.5 * padding;  CGFloat sendOrderY = CGRectGetMaxY(_image1ListF) + padding;  CGFloat sendOrderW = 30;  CGFloat sendOrderH = 30;  _sendOrdersBtnF = CGRectMake(sendOrderX, sendOrderY, sendOrderW, sendOrderH);  // 10.派單狀態  CGSize sendStateSize = [self sizeWithText:@"派單" font:MiddleFont maxSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];  CGFloat sendStateX = CGRectGetMaxX(_sendOrdersBtnF) + padding;  CGFloat sendStateY = sendOrderY + padding;  _sendStateF = CGRectMake(sendStateX, sendStateY, sendStateSize.width, sendStateSize.height);  // 11.接受button  CGFloat acceptX = CGRectGetMaxX(_sendStateF) +padding;  CGFloat acceptY = sendStateY;  CGFloat acceptW = 40;  CGFloat acceptH = 25;  _acceptBtnF = CGRectMake(acceptX, acceptY, acceptW, acceptH);  // 12.評論button  CGFloat commandX = ScreenWidth - padding - 120;  CGFloat commandY = sendOrderY;  CGFloat commandW = 30;  CGFloat commandH = 30;  _commandBtnF = CGRectMake(commandX, commandY, commandW, commandH);  // 13.評論數量  CGFloat countX = commandX + commandW + 2;  CGFloat countY = commandY + commandH - 15;  CGFloat countW = 20;  CGFloat countH = 15;  _countLabelF = CGRectMake(countX, countY, countW, countH);  // 14.詳情button  CGFloat detailBtnX = ScreenWidth - padding - 60;  CGFloat detailBtnY = sendOrderY + 10;  CGFloat detailBtnW = 40;  CGFloat detailBtnH = 25;  _detailBtnF = CGRectMake(detailBtnX, detailBtnY, detailBtnW, detailBtnH);  // 15.回復區域 (此處就是增加了每一條回復的Frame模型)  CGFloat reply_listHeight = 0.0;  if (model.reply_list.count != 0) {    [self.repairViewFrameArr removeAllObjects];    // 頭像 同派單一樣大小和高度    for (int i = 0; i < model.reply_list.count; i ++) {      RepairViewFrame * repairFrame = [[RepairViewFrame alloc]init];      repairFrame.replyDic = model.reply_list[i];      reply_listHeight += repairFrame.viewHeight;      [self.repairViewFrameArr addObject:repairFrame];    }  }  NSLog(@"回復區域的高度 === %f",reply_listHeight);  CGFloat commandViewX = 0;  CGFloat commandViewY = detailBtnY + detailBtnH + padding * 2;  CGFloat commandViewW = ScreenWidth;  CGFloat commandViewH = reply_listHeight;  _commandViewF = CGRectMake(commandViewX, commandViewY, commandViewW, commandViewH);  _cellHeight = CGRectGetMaxY(_detailBtnF) + 2 * padding;  if (self.isOpenReply) {    _cellHeight += reply_listHeight;  }}

之后我們來看看Cell的頭文件.h里:

#import <UIKit/UIKit.h>#import "RepairOrderModel.h" // 工單數據模型頭文件#import "RepairOrderFrame.h" // 工單Frame模型頭文件typedef void (^PushPhotoBigVCBlock)(NSArray * imageList); //展示大圖typedef void (^PushRealBlock)(NSString * frealname);   //跳轉業主頁typedef void (^LookReplyBlock)(NSIndexPath * myIndexPath,BOOL isOpen);   //點擊查看回復詳情typedef void (^PushCommandVCBlock)();   //跳轉評論頁@interface RepairOrderTableViewCell : UITableViewCell@property (nonatomic,strong) RepairOrderModel* model;-(instancetype)initWithTableview:(UITableView *)tableview;+(instancetype)cellWithTableview:(UITableView *)tableview;@property (nonatomic, strong) RepairOrderFrame *statusFrame;@property (nonatomic,strong) NSIndexPath * currentIndexPath;@property (nonatomic,copy) PushPhotoBigVCBlock block;-(void)pushPhotoVC:(PushPhotoBigVCBlock)block;@property (nonatomic,copy) PushRealBlock block1;-(void)pushRealVC:(PushRealBlock)block1;@property (nonatomic,copy) LookReplyBlock block2;-(void)lookReplyDetailView:(LookReplyBlock)block2;@property (nonatomic,copy) PushCommandVCBlock block3;-(void)pushCommandViewController:(PushCommandVCBlock)block3;@end

cell實現文件.m中:

#import "RepairOrderTableViewCell.h"#import "ReplyDetailView.h" // 回復區域// 小號字體#define SmallFont [UIFont systemFontOfSize:12]// 中號字體#define MiddleFont [UIFont systemFontOfSize:14]// 正常字體#define LargeFont [UIFont systemFontOfSize:16]@interface RepairOrderTableViewCell()// 頂部點擊區域 (增加手勢)@property (nonatomic,strong) UIView * topView;@property (nonatomic,strong) UIImageView * iconView; //圖標@property (nonatomic,strong) UILabel * fnameLabel; //業主名@property (nonatomic,strong) UILabel * timeLabel; //訂單時間@property (nonatomic,strong) UILabel * desLabel;  //服務內容 fservicecontent@property (nonatomic,strong) UILabel * addLabel; //訂單地址 faddress@property (nonatomic,strong) UILabel * orderNumLabel; //工單號碼 fordernum@property (nonatomic,strong) UILabel * urgentLabel; //加急狀態 fremindercount@property (nonatomic,strong) UIView * imagesListView; //圖片列表 repairs_imag_list@property (nonatomic,strong) UIButton * sendOrdersBtn; //派單按鈕@property (nonatomic,strong) UILabel * sendStateLabel; //派單狀態@property (nonatomic,strong) UIButton * acceptBtn; //接受按鈕@property (nonatomic,strong) UIButton * commandBtn; //評論按鈕@property (nonatomic,strong) UILabel * countLabel; //評論數量@property (nonatomic,strong) UIButton * detailBtn; //詳情按鈕@property (nonatomic,strong) UIImageView * photo1;@property (nonatomic,strong) UIImageView * photo2;@property (nonatomic,strong) UIImageView * photo3;@end@implementation RepairOrderTableViewCell+(instancetype)cellWithTableview:(UITableView *)tableview{  return [[self alloc]initWithTableview:tableview];}-(instancetype)initWithTableview:(UITableView *)tableview{  static NSString * identify = @"RepairOrderCell";  RepairOrderTableViewCell * cell = [tableview dequeueReusableCellWithIdentifier:identify];  if (cell == nil) {    cell = [[RepairOrderTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify];  }  // cell的復用問題 先刪除所有的回復View 不刪除的話 復用cell會重影  [self deleteReplyView];  self.photo1.hidden = NO;   self.photo2.hidden = NO;  self.photo3.hidden = NO;  return cell;}-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{  if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {    self.selectionStyle = UITableViewCellSelectionStyleNone;    [self defaultSubViews];//這里初始化各個子視圖,不要給frame賦值  }  return self;}- (void)defaultSubViews{  // 1.頭像  self.iconView = [[UIImageView alloc] init];  [self.contentView addSubview:self.iconView];  // 2.業主名  self.fnameLabel = [[UILabel alloc] init];  self.fnameLabel.font = LargeFont;  [self.contentView addSubview:self.fnameLabel];  // 3.日期  self.timeLabel = [[UILabel alloc] init];  self.timeLabel.font = SmallFont;  [self.contentView addSubview:self.timeLabel];  // 4. 地址  self.addLabel = [[UILabel alloc] init];  self.addLabel.font = LargeFont;  [self.contentView addSubview:self.addLabel];  //5.單號  self.orderNumLabel = [[UILabel alloc] init];  self.orderNumLabel.font = SmallFont;  [self.contentView addSubview:self.orderNumLabel];  // 6.加急  self.urgentLabel = [[UILabel alloc] init];  self.urgentLabel.font = MiddleFont;  [self.contentView addSubview:self.urgentLabel];  // 7.服務內容  self.desLabel = [[UILabel alloc] init];  self.desLabel.font = MiddleFont;  [self.contentView addSubview:self.desLabel];  // 8.圖片列表  self.photo1 = [[UIImageView alloc]init];  self.photo1.userInteractionEnabled = YES;  [self.contentView addSubview:self.photo1];  self.photo2 = [[UIImageView alloc]init];  self.photo2.userInteractionEnabled = YES;  [self.contentView addSubview:self.photo2];  self.photo3 = [[UIImageView alloc]init];  self.photo3.userInteractionEnabled = YES;  [self.contentView addSubview:self.photo3];  UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(photoTap)];  [self.photo1 addGestureRecognizer:tap];  UITapGestureRecognizer * tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(photoTap)];  [self.photo2 addGestureRecognizer:tap2];  UITapGestureRecognizer * tap3 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(photoTap)];  [self.photo3 addGestureRecognizer:tap3];  // 9.派單按鈕  self.sendOrdersBtn = [[UIButton alloc] init];  self.sendOrdersBtn.backgroundColor = mainColor;  [self.contentView addSubview:self.sendOrdersBtn];  // 10.派單狀態  self.sendStateLabel = [[UILabel alloc] init];  self.sendStateLabel.font = MiddleFont;  [self.contentView addSubview:self.sendStateLabel];  // 11.接受按鈕  self.acceptBtn = [[UIButton alloc] init];  self.acceptBtn.backgroundColor = mainColor;  [self.contentView addSubview:self.acceptBtn];  // 12.評論按鈕  self.commandBtn = [[UIButton alloc] init];  self.commandBtn.backgroundColor = mainColor;  [self.contentView addSubview:self.commandBtn];  // 13.評論數量  self.countLabel = [[UILabel alloc] init];  self.countLabel.font = SmallFont;  [self.contentView addSubview:self.countLabel];  // 14.詳情按鈕  self.detailBtn = [[UIButton alloc] init];  self.detailBtn.backgroundColor = mainColor;  [self.contentView addSubview:self.detailBtn];  // 16.頂部點擊事件  self.topView = [[UIView alloc]init];  [self.contentView addSubview:self.topView];}/** * 在這個方法中設置子控件的frame和顯示數據 */- (void)setStatusFrame:(RepairOrderFrame *)statusFrame{  _statusFrame = statusFrame;  // 1.設置數據  [self settingData];  // 2.設置frame  [self settingFrame];}/** * 設置數據 */- (void)settingData{  // 微博數據  RepairOrderModel *dataModel = self.statusFrame.model;  // 1.頭像  self.iconView.backgroundColor = mainColor;  // 2.業主名  self.fnameLabel.text = dataModel.frealname;  // 3.日期  self.timeLabel.text = dataModel.fcreatetime;  // 4. 地址  self.addLabel.text = dataModel.faddress;  //5.單號  self.orderNumLabel.text = [NSString stringWithFormat:@"單號:%@",dataModel.fordernum];  // 6.加急  self.urgentLabel.text = @"加急";  // 7.服務內容  self.desLabel.text = dataModel.fservicecontent;  // 8.圖片列表  self.photo1.backgroundColor = [UIColor yellowColor];  NSArray * arr = dataModel.repairs_imag_list;  if (arr.count != 0) {    switch (arr.count) {      case 3:      {        self.photo3.hidden = NO;        [self.photo3 sd_setImageWithURL:[NSURL URLWithString:arr[2][@"fimagpath"]]];      }      case 2:      {        self.photo2.hidden = NO;        [self.photo2 sd_setImageWithURL:[NSURL URLWithString:arr[1][@"fimagpath"]]];      }      case 1:      {  self.photo1.hidden = NO;        [self.photo1 sd_setImageWithURL:[NSURL URLWithString:arr[0][@"fimagpath"]]];      }      break;    }  }  else{    self.photo1.hidden = YES;    self.photo2.hidden = YES;    self.photo3.hidden = YES;  }  // 9.派單按鈕  [self.sendOrdersBtn setTitle:@"派單" forState:UIControlStateNormal];  // 10.派單狀態  self.sendStateLabel.text = @"派單";  // 11.接受按鈕  [self.acceptBtn setTitle:@"接受" forState:UIControlStateNormal];  // 12.評論按鈕  [self.commandBtn setTitle:@"評論" forState:UIControlStateNormal];  [self.commandBtn addTarget:self action:@selector(pushCommand) forControlEvents:UIControlEventTouchUpInside];  // 13.評論數量  self.countLabel.text = [NSString stringWithFormat:@"%d",dataModel.reply_list.count];  // 14.詳情按鈕  [self.detailBtn setTitle:@"詳情" forState:UIControlStateNormal];  [self.detailBtn addTarget:self action:@selector(replyDetail) forControlEvents:UIControlEventTouchUpInside];  if (self.statusFrame.isOpenReply) {    NSLog(@"創建評論");    [self createReplyView];  }  else{    NSLog(@"刪除評論");    [self deleteReplyView];  }}/** * 計算文字尺寸 * * @param text  需要計算尺寸的文字 * @param font  文字的字體 * @param maxSize 文字的最大尺寸 */- (CGSize)sizeWithText:(NSString *)text font:(UIFont *)font maxSize:(CGSize)maxSize{  NSDictionary *attrs = @{NSFontAttributeName : font};  return [text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;}/** * 設置frame */- (void)settingFrame{  // 1.頭像  self.iconView.frame = self.statusFrame.iconF;  self.iconView.layer.cornerRadius = self.statusFrame.iconF.size.width/2;  // 2.業主名  self.fnameLabel.frame = self.statusFrame.nameF;  // 3.日期  self.timeLabel.frame = self.statusFrame.timeF;  // 4. 地址  self.addLabel.frame = self.statusFrame.addF;  //5.單號  self.orderNumLabel.frame = self.statusFrame.orderNumF;  // 6.加急  self.urgentLabel.frame = self.statusFrame.urgentF;  // 7.服務內容  self.desLabel.frame = self.statusFrame.desF;  // 8.圖片列表  if (self.statusFrame.model.repairs_imag_list.count != 0) {    switch (self.statusFrame.model.repairs_imag_list.count) {      case 3:      {        self.photo3.frame = self.statusFrame.image3ListF;      }      case 2:      {        self.photo2.frame = self.statusFrame.image2ListF;      }      case 1:      {        self.photo1.frame = self.statusFrame.image1ListF;      }        break;    }  }  // 9.派單按鈕  self.sendOrdersBtn.frame = self.statusFrame.sendOrdersBtnF;  self.sendOrdersBtn.layer.cornerRadius = self.statusFrame.sendOrdersBtnF.size.width/2;  // 10.派單狀態  self.sendStateLabel.frame = self.statusFrame.sendStateF;  // 11.接受按鈕  self.acceptBtn.frame = self.statusFrame.acceptBtnF;  // 12.評論按鈕  self.commandBtn.frame = self.statusFrame.commandBtnF;  self.commandBtn.layer.cornerRadius = self.statusFrame.commandBtnF.size.width/2;  // 13.評論數量  self.countLabel.frame = self.statusFrame.countLabelF;  // 14.詳情按鈕  self.detailBtn.frame = self.statusFrame.detailBtnF;  // 16.增加頂部點擊事件:  self.topView.frame = CGRectMake(0, 0, ScreenWidth, CGRectGetMaxY(self.iconView.frame));  self.topView.backgroundColor = [UIColor clearColor];  UITapGestureRecognizer * topViewClickTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(topViewClick)];  [self.topView addGestureRecognizer:topViewClickTap];}#pragma mark - 創建評論區域-(void)createReplyView{  [self deleteReplyView];  CGFloat viewY = self.statusFrame.cellHeight;  for (int i = self.statusFrame.repairViewFrameArr.count - 1; i >= 0 ; i --) {    NSLog(@"111111111111111111111111111111 %d",self.statusFrame.repairViewFrameArr.count);    RepairViewFrame * rFrame = self.statusFrame.repairViewFrameArr[i];    RepairViewFrame * rLastFrame;     viewY -= rFrame.viewHeight;    ReplyDetailView * view = [[ReplyDetailView alloc]init];    view.tag = 5000 + i;    view.frame = CGRectMake(0, viewY, ScreenWidth, rFrame.viewHeight);    view.backgroundColor = MYColor(random()%256, random()%256, random()%256);    [self.contentView addSubview:view];  }}#pragma mark - 刪除評論區域-(void)deleteReplyView{  for (int i = 0; i < self.statusFrame.repairViewFrameArr.count; i ++) {    ReplyDetailView * view = (ReplyDetailView *)[self.contentView viewWithTag:5000 + i];    [view removeFromSuperview];  }}#pragma mark - 查看大圖-(void)photoTap{  if (self.block) {    self.block(self.statusFrame.model.repairs_imag_list);  }}#pragma mark - 進入業主詳情-(void)topViewClick{  NSLog(@"業主詳情");  if (self.block1) {    self.block1(self.statusFrame.model.frealname);  }}#pragma mark - 查看回復詳情-(void)replyDetail{  //先判斷是否有回復  if (self.model.reply_list.count == 0) {    return;  }  self.statusFrame.isOpenReply = !self.statusFrame.isOpenReply;  if (self.statusFrame.isOpenReply) {    NSLog(@"打開評論");//    [self createReplyView];  }  else{    NSLog(@"關閉評論");    [self deleteReplyView];  }  if (self.block2) {    self.block2(self.currentIndexPath,self.statusFrame.isOpenReply);  }}#pragma mark - 跳轉去評論頁面-(void)pushCommand{  if (self.block3) {    self.block3();  }}-(void)pushPhotoVC:(PushPhotoBigVCBlock)block{  if (!self.block) {    self.block = block;  }}-(void)pushRealVC:(PushRealBlock)block1{  if (!self.block1) {    self.block1 = block1;  }}-(void)lookReplyDetailView:(LookReplyBlock)block2{  if (!self.block2) {    self.block2 = block2;  }}-(void)pushCommandViewController:(PushCommandVCBlock)block3{  if (!self.block3) {    self.block3 = block3;  }}

Controller界面就是把model放入cell里 

主要代碼:

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {  RepairOrderTableViewCell *cell = [RepairOrderTableViewCell cellWithTableview:tableView];  cell.currentIndexPath = indexPath;  NSLog(@"改變前cell高度: %f",cell.statusFrame.cellHeight);  [cell pushPhotoVC:^(NSArray *imageList) {    //圖片展示    self.lookImageList = imageList;    [self photoTap];  }];  [cell pushRealVC:^(NSString *frealname) {    //跳轉業主詳情頁    OwnerViewController * ownerVC = [[OwnerViewController alloc]init];    [self.navigationController pushViewController:ownerVC animated:YES];  }];  [cell lookReplyDetailView:^(NSIndexPath *myIndexPath,BOOL isOpen) {    cell.statusFrame.isOpenReply = isOpen;    [cell.statusFrame setModel:cell.statusFrame.model];    NSLog(@"indexPath.row == %d",myIndexPath.row);    //刷新這一行    [tableView reloadRowsAtIndexPaths:@[myIndexPath] withRowAnimation:UITableViewRowAnimationNone];    //    [tableView reloadData];  }];  [cell pushCommandViewController:^{    //跳轉去評論頁面    OrderCommandViewController * commandVC = [[OrderCommandViewController alloc]init];    [self.navigationController pushViewController:commandVC animated:YES];  }];  cell.model = ((RepairOrderFrame *)self.framesArr[indexPath.row]).model;  cell.statusFrame = self.framesArr[indexPath.row];  return cell;}

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
秋霞成人午夜鲁丝一区二区三区| 日韩成人激情视频| 成人免费午夜电影| 国产欧美在线播放| 亚洲欧洲黄色网| 久久在线免费视频| 亚洲黄在线观看| 一区二区三区亚洲| 亚洲综合日韩在线| www.99久久热国产日韩欧美.com| 国产一区二区三区在线观看网站| 最近中文字幕2019免费| 国产精品白丝jk喷水视频一区| 亚洲偷熟乱区亚洲香蕉av| 在线播放国产一区中文字幕剧情欧美| 欧美日韩国产在线播放| 欧美主播福利视频| 中文字幕精品视频| 成人黄色免费网站在线观看| 久久视频这里只有精品| 日本视频久久久| 欧美一级高清免费播放| 国产精品99久久99久久久二8| 自拍亚洲一区欧美另类| 国产女人精品视频| 成人黄色午夜影院| 日韩一级裸体免费视频| 亚洲人成亚洲人成在线观看| 欧美激情免费看| 亚洲国产日韩欧美在线图片| 久久久之久亚州精品露出| 亚洲欧美激情在线视频| 黑人巨大精品欧美一区二区免费| 欧美激情视频一区二区三区不卡| 欲色天天网综合久久| 欧美视频在线观看 亚洲欧| 久久天天躁夜夜躁狠狠躁2022| 国产精品视频网址| 亚洲自拍欧美另类| 成人午夜在线影院| 欧美日韩免费一区| 国产女同一区二区| 久久久久久久久亚洲| 精品国产区一区二区三区在线观看| 国产精品美女www| 亚洲国模精品一区| 国产精品日韩欧美| 日本高清视频精品| 日本高清视频精品| 91av视频导航| 亚洲天堂视频在线观看| 亚洲精品一区二区三区婷婷月| 亚洲网站在线观看| 日韩精品在线影院| 国产suv精品一区二区三区88区| 欧美午夜性色大片在线观看| 久久久久久久一区二区三区| 91丝袜美腿美女视频网站| 日韩av中文字幕在线播放| 国产精品美女主播在线观看纯欲| 国产精品美女无圣光视频| 午夜精品久久久久久99热软件| 国产专区欧美专区| 91色视频在线观看| 丝袜情趣国产精品| 欧美一区二区三区四区在线| 国产中文字幕日韩| 亚洲国产成人精品一区二区| 欧美在线免费观看| 成人精品久久一区二区三区| 日韩高清电影好看的电视剧电影| 成人福利在线视频| 欧美一区二区三区精品电影| 日韩专区在线播放| 91国语精品自产拍在线观看性色| 国产在线999| 亚洲精品视频在线观看视频| 国外成人免费在线播放| 福利视频导航一区| 欧美成人午夜视频| www.亚洲人.com| 久久精品国产亚洲精品| 欧美日韩国产丝袜另类| 亚洲综合视频1区| 欧美成人免费一级人片100| 日韩免费视频在线观看| 亚洲女人天堂网| 中日韩美女免费视频网站在线观看| 91久久久久久久久久| 中文字幕亚洲综合| 亚洲天堂成人在线| 久久97精品久久久久久久不卡| 亚洲第一网站免费视频| 91免费版网站入口| 亚洲欧洲日产国产网站| 狠狠色香婷婷久久亚洲精品| 1769国内精品视频在线播放| 久久这里有精品| 欧美激情亚洲综合一区| 国产精品国产亚洲伊人久久| 国产经典一区二区| 欧美性开放视频| 亚洲free性xxxx护士白浆| 欧美精品免费在线观看| 欧美多人乱p欧美4p久久| 永久免费精品影视网站| 国内久久久精品| 亚洲欧美日韩在线一区| 日韩欧美在线免费观看| 日韩美女写真福利在线观看| 成人做爽爽免费视频| 日韩黄在线观看| 亚洲精品国产精品国产自| 国产精品18久久久久久首页狼| 亚洲午夜精品久久久久久性色| 8090理伦午夜在线电影| 日韩电影免费在线观看中文字幕| 欧美日韩中国免费专区在线看| 成人av资源在线播放| 日本免费久久高清视频| 国产一区二中文字幕在线看| 亚洲欧洲偷拍精品| 日韩成人av一区| 日韩电影免费观看在线| 国产精品丝袜视频| 日韩精品视频免费专区在线播放| 精品视频9999| 亚洲va久久久噜噜噜| 97久久精品国产| 亚洲九九九在线观看| 国产精品免费在线免费| 欧美性猛交xxxx免费看久久久| 永久555www成人免费| 亚洲第一区第一页| 成人精品网站在线观看| 91精品国产综合久久久久久蜜臀| 日韩视频免费中文字幕| 国模私拍视频一区| 亚洲国产欧美一区二区三区久久| 欧美大肥婆大肥bbbbb| 欧美日韩在线看| 国产日韩欧美日韩| 色综合色综合久久综合频道88| 少妇av一区二区三区| 欧美大片欧美激情性色a∨久久| 日韩av电影手机在线| 久久久伊人欧美| 国产一级揄自揄精品视频| 欧洲日本亚洲国产区| 九九热精品视频国产| 久久精品国产视频| 日韩av电影院| 国产精品视频一| 国产精品99久久久久久久久久久久| 久久久久久久久网站| 亚洲第一页自拍| 欧美激情精品久久久久久蜜臀| 国产一区二区三区免费视频| 国产精品mp4| www高清在线视频日韩欧美| 国产成人精品一区二区三区| 在线精品国产成人综合| 91精品国产91久久| 亚洲国产精品久久久久|