iOS实现搭建聊天页面的实例代码

2020-01-20 23:56:01王旭

模型


//
// WDPersonMessageDetailModel.m
// WestDevelopment
//
// Created by wangtao on 2017/6/23.
// Copyright © 2017年 xikaijinfu. All rights reserved.
//

#import "WDPersonMessageDetailModel.h"

@implementation WDPersonMessageDetailModel

- (CGFloat)commentW
{
  if (_commentW == 0) {
    _commentW = [self.comment wt_calculateStringSizeWithFontOfSize:13 maxWidth:kMainScreenWidth / 2].width + 20;
  }
  return _commentW;
}

- (CGFloat)commentH
{
  if (_commentH == 0) {
    CGFloat textH = [self.comment wt_calculateStringSizeWithFontOfSize:13 maxWidth:kMainScreenWidth / 2].height;
    // 一行字体是15高,一行的情况就和头像一样高
    _commentH = (textH < 20) ? 35 : (textH + 20);    
  }
  return _commentH;
}

- (CGFloat)height
{
  if (_height == 0) {
    _height = self.commentH + 20;
    if ([self.isShow isEqualToString:@"1"]) {
      _height += 20;
    }

  }
  return _height;
}

@end

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持ASPKU。


注:相关教程知识阅读请移步到IOS开发频道。