类似qq控件评论列表
需要设计两个模型
一个是一级评论模型
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff; min-height: 13.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c2349b}span.s1 {font-variant-ligatures: no-common-ligatures; color: #c2349b}span.s2 {font-variant-ligatures: no-common-ligatures}span.s3 {font-variant-ligatures: no-common-ligatures; color: #00afca}span.s4 {font-variant-ligatures: no-common-ligatures; color: #ffffff}span.s5 {font-variant-ligatures: no-common-ligatures; color: #93c86a}
@interface DetailModel : NSObject
@property(nonatomic ,strong)NSString * name;
@property(nonatomic ,strong)NSString * message;
@property(nonatomic ,strong)NSMutableArray <CommentModel*>*commentArray;
@property(nonatomic ,assign)float height;
@end
一个是二级评论模型
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #c2349b}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff; min-height: 13.0px}span.s1 {font-variant-ligatures: no-common-ligatures; color: #c2349b}span.s2 {font-variant-ligatures: no-common-ligatures}span.s3 {font-variant-ligatures: no-common-ligatures; color: #00afca}span.s4 {font-variant-ligatures: no-common-ligatures; color: #ffffff}
@interface CommentModel : NSObject
@property(nonatomic ,strong)NSString * answer;
@property(nonatomic ,strong)NSString * asker;
@property(nonatomic ,strong)NSString * message;
@end
其中一个cell放一个UITableView子视图,每个cell使用一个静态变量计算这个cell的高度
demo链接:https://pan.baidu.com/s/1gfhWMJL