前面说的有点乱,现在整理一下。 一、对于frame也就行分层。 ![]() 各个层拥有各个自己的frame。 整理一下,会很具有层次感,二、HMStatusFrame。整个微博数据的frame。 #import "HMStatusFrame.h"
#import "HMStatus.h" #import "HMStatusDetailFrame.h" @implementation HMStatusFrame - (void)setStatus:(HMStatus *)status { _status = status;
// 1.计算微博具体内容(微博整体) [self setupDetailFrame];
// 2.计算底部工具条 [self setupToolbarFrame];
// 3.计算cell的高度 self.cellHeight = CGRectGetMaxY(self.toolbarFrame); } /** * 计算微博具体内容(微博整体) */ - (void)setupDetailFrame { HMStatusDetailFrame *detailFrame = [[HMStatusDetailFrame alloc] init]; detailFrame.status = self.status;//把模型数据给detailFrame.status ,会重写它的set方法。 self.detailFrame = detailFrame; } /** * 计算底部工具条 */ - (void)setupToolbarFrame { CGFloat toolbarX = 0; CGFloat toolbarY = CGRectGetMaxY(self.detailFrame.frame); CGFloat toolbarW = HMScreenW; CGFloat toolbarH = 35; self.toolbarFrame = CGRectMake(toolbarX, toolbarY, toolbarW, toolbarH); } 三、传递数据的。会调用set方法,会一层一层往里面走。 这里会用到cell的内边距,这里定义为宏,因为很多地方会用到,在.pch中写。
// cell的内边距 #define HMStatusCellInset 10 在cell中设置字体。这里定义为宏。
// 原创微博昵称字体 #define HMStatusOrginalNameFont [UIFont systemFontOfSize:14] // 原创微博时间字体 #define HMStatusOrginalTimeFont [UIFont systemFontOfSize:12] // 原创微博来源字体 #define HMStatusOrginalSourceFont HMStatusOrginalTimeFont // 原创微博正文字体 #define HMStatusOrginalTextFont [UIFont systemFontOfSize:15] // 转发微博昵称字体 #define HMStatusRetweetedNameFont HMStatusOrginalNameFont // 转发微博正文字体
#define HMStatusRetweetedTextFont HMStatusOrginalTextFont |
|
来自: 雪柳花明 > 《ios 开发项目遇到的问题》