nbsp; CGFloat vipW = 14; self.vipViewF = CGRectMake(vipX, vipY, vipW, vipH); } /** 时间 */ CGFloat timeX = nameX; CGFloat timeY = CGRectGetMaxY(self.nameLabelF) + HWStatusCellBorderW; CGSize timeSize = [self sizeWithText:status.created_at font:HWStatusCellTimeFont]; self.timeLabelF = (CGRect){{timeX, timeY}, timeSize}; /** 来源 */ CGFloat sourceX = CGRectGetMaxX(self.timeLabelF) + HWStatusCellBorderW; CGFloat sourceY = timeY; CGSize sourceSize = [self sizeWithText:status.source font:HWStatusCellSourceFont]; self.sourceLabelF = (CGRect){{sourceX, sourceY}, sourceSize}; /** 正文 */ CGFloat contentX = iconX; CGFloat contentY = MAX(CGRectGetMaxY(self.iconViewF), CGRectGetMaxY(self.timeLabelF)) + HWStatusCellBorderW; CGFloat maxW = cellW - 2 * contentX; CGSize contentSize = [self sizeWithText:status.text font:HWStatusCellContentFont maxW:maxW]; self.contentLabelF = (CGRect){{contentX, contentY}, contentSize}; /** 配图 */ /** 原创微博整体 */ CGFloat originalX = 0; CGFloat originalY = 0; CGFloat originalW = cellW; CGFloat originalH = CGRectGetMaxY(self.contentLabelF) + HWStatusCellBorderW; self.originalViewF = CGRectMake(originalX, originalY, originalW, originalH); self.cellHeight = CGRectGetMaxY(self.originalViewF); } @end
---------------------------HWStatusCell.h---------------------------------------------
// // HWStatusCell.h // 黑马微博2期 // // Created by apple on 14-10-14. // Copyright (c) 2014年 heima. All rights reserved. //
#import <UIKit/UIKit.h> @class HWStatusFrame;
@interface HWStatusCell : UITableViewCell + (instancetype)cellWithTableView:(UITableView *)tableView;
@property (nonatomic, strong) HWStatusFrame *statusFrame; @end
---------------------------HWStatusCell.m---------------------------------------------
// HWStatusCell.m // // Created by apple on 14-10-14. // Copyright (c) 2014年 heima. All rights reserved. //
#import "HWStatusCell.h" #import "HWStatus.h" #import "HWUser.h" #import "HWStatusFrame.h" #import "UIImageView+WebCache.h"
@interface HWStatusCell() /* 原创微博 */ /** 原创微博整体 */ @property (nonatomic, weak) UIView *originalView; /** 头像 */ @property (nonatomic, weak) UIImageView *iconView; /** 会员图标 */ @property (nonatomic, weak) UIImageView *vipView; /** 配图 */ @property (nonatomic, weak) UIImageView *photoView; /** 昵称 */ @property (nonatomic, weak) UILabel *nameLabel; /** 时间 */ @property (nonatomic, weak) UILabel *timeLabel; /** 来源 */ @property (nonatomic, weak) UILabel *sourceLabel; /** 正文 */ @property (nonatomic, weak) UILabel *contentLabel;
@end
|