分享

48,精确计算所有的frame之一

 雪柳花明 2016-04-17

前面说的有点乱,现在整理一下。
一、对于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



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多