[iOS微博项目 - 4.1] - cell的frame模型



//
// HVWStatusCell.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <UIKit/UIKit.h>
#import "HVWStatusFrame.h" @interface HVWStatusCell : UITableViewCell /** frame */
@property(nonatomic, strong) HVWStatusFrame *statusFrame; /** 创建方法 */
+ (instancetype) cellWithTableView:(UITableView *)tableView; @end
//
// HVWStatusCell.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusCell.h"
#import "HVWStatusContentView.h"
#import "HVWStatusToolbar.h" @interface HVWStatusCell() /** 微博内容控件 */
@property(nonatomic, weak) HVWStatusContentView *statusContentView; /** 微博工具条控件 */
@property(nonatomic, weak) HVWStatusToolbar *toolbar; @end @implementation HVWStatusCell /** 创建 */
+ (instancetype) cellWithTableView:(UITableView *)tableView {
static NSString *ID = @"HVWStatusCell";
HVWStatusCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (nil == cell) {
cell = [[self alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
} return cell;
} /** 初始化 */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // 初始化子控件开始
// 初始化微博内容控件
[self setupStatusContentView]; // 初始化工具条控件 */
// [self setupToolbar];
} return self;
} /** 初始化微博内容控件 */
- (void) setupStatusContentView {
HVWStatusContentView *statusContentView = [[HVWStatusContentView alloc] init];
self.statusContentView = statusContentView;
[self.contentView addSubview:statusContentView];
} /** 初始化工具条控件 */
- (void) setupToolbar {
HVWStatusToolbar *toolbar = [[HVWStatusToolbar alloc] init];
self.toolbar = toolbar;
[self.contentView addSubview:toolbar];
} /** 初始化frame */
- (void)setStatusFrame:(HVWStatusFrame *)statusFrame {
_statusFrame = statusFrame; // 设置微博内容frame
self.statusContentView.contentFrame = statusFrame.contentFrame; // 设置工具条frame
self.toolbar.toolbarFrame = statusFrame.toolbarFrame;
} @end
//
// HVWStatusContentView.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <UIKit/UIKit.h>
#import "HVWStatusContentFrame.h" @interface HVWStatusContentView : UIView /** frame */
@property(nonatomic, strong) HVWStatusContentFrame *contentFrame; @end
//
// HVWStatusContentView.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusContentView.h"
#import "HVWStatusOriginalView.h"
#import "HVWStatusRetweetedView.h" @interface HVWStatusContentView() /** 原创内容 */
@property(nonatomic, weak) HVWStatusOriginalView *originalView; /** 转发内容 */
@property(nonatomic, weak) HVWStatusRetweetedView *retweetedView; @end @implementation HVWStatusContentView - (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; if (self) { // 初始化子控件开始
// 初始化原创内容控件
[self setupOriginalView]; // 初始化转发内容控件
[self setupRetweetedView];
} return self;
} /** 初始化原创内容控件 */
- (void) setupOriginalView {
HVWStatusOriginalView *originalView = [[HVWStatusOriginalView alloc] init];
self.originalView = originalView;
[self addSubview:originalView];
} /** 初始化转发内容控件 */
- (void) setupRetweetedView {
HVWStatusRetweetedView *retweetedView = [[HVWStatusRetweetedView alloc] init];
self.retweetedView = retweetedView;
[self addSubview:retweetedView];
} /** 设置frame */
- (void)setContentFrame:(HVWStatusContentFrame *)contentFrame {
_contentFrame = contentFrame; // 原创微博frame
self.originalView.originalFrame = self.contentFrame.originalFrame; // 转发微博frame
self.retweetedView.retweetedFrame = self.contentFrame.retweetedFrame; // 设置自己的frame
self.frame = contentFrame.frame;
} @end
//
// HVWStatusOriginalView.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <UIKit/UIKit.h>
#import "HVWStatusOriginalFrame.h" @interface HVWStatusOriginalView : UIView /** frame */
@property(nonatomic, strong) HVWStatusOriginalFrame *originalFrame; @end
//
// HVWStatusOriginalView.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusOriginalView.h"
#import "HVWStatus.h"
#import "HVWUser.h"
#import "UIImageView+WebCache.h" @interface HVWStatusOriginalView() /** 昵称 */
@property(nonatomic, weak) UILabel *nameLabel; /** 头像 */
@property(nonatomic, weak) UIImageView *iconView; /** 微博发表时间 */
@property(nonatomic, weak) UILabel *timeLabel; /** 微博来源 */
@property(nonatomic, weak) UILabel *sourceLabel; /** 微博文本内容 */
@property(nonatomic, weak) UILabel *textLabel; @end @implementation HVWStatusOriginalView /** 代码初始化方法 */
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; if (self) { // 初始化子控件开始
// 昵称
UILabel *nameLabel = [[UILabel alloc] init];
nameLabel.font = HVWStatusOriginalNameFont;
self.nameLabel = nameLabel;
[self addSubview:nameLabel]; // 头像
UIImageView *iconView = [[UIImageView alloc] init];
self.iconView = iconView;
[self addSubview:iconView]; // 发表时间
UILabel *timeLabel = [[UILabel alloc] init];
self.timeLabel = timeLabel;
[self addSubview:timeLabel]; // self.timeLabel.backgroundColor = [UIColor greenColor]; // 来源
UILabel *sourceLabel = [[UILabel alloc] init];
self.sourceLabel = sourceLabel;
[self addSubview:sourceLabel]; // self.sourceLabel.backgroundColor = [UIColor yellowColor]; // 正文
UILabel *textLabel = [[UILabel alloc] init];
self.textLabel = textLabel;
[self addSubview:textLabel]; // self.backgroundColor = [UIColor redColor];
} return self;
} /** 设置frame */
- (void)setOriginalFrame:(HVWStatusOriginalFrame *)originalFrame {
_originalFrame = originalFrame; HVWStatus *status = originalFrame.status;
HVWUser *user = status.user; // 设置控件frame
// 头像
self.iconView.frame = originalFrame.iconFrame;
[self.iconView setImageWithURL:[NSURL URLWithString:user.profile_image_url] placeholderImage:[UIImage imageWithNamed:@"avatar_default_small"]]; // 昵称
self.nameLabel.frame = originalFrame.nameFrame;
self.nameLabel.font = HVWStatusOriginalNameFont;
self.nameLabel.text = user.name; // 发表时间
self.timeLabel.frame = originalFrame.timeFrame;
self.timeLabel.font = HVWStatusOriginalTimeFont;
self.timeLabel.text = status.created_at; // 来源
self.sourceLabel.frame = originalFrame.sourceFrame;
self.sourceLabel.font = HVWStatusOriginalSourceFont;
self.sourceLabel.text = status.source; /* 由于“发表时间”随着时间推移会产生变化
* 每次都要重新计算“发表时间”和“来源”的frame
*/
// 发表时间
CGFloat timeX = self.nameLabel.frame.origin.x;
CGFloat timeY = CGRectGetMaxY(self.nameLabel.frame);
CGSize timeBoundSize = CGSizeMake(HVWScreenWidth - timeX, MAXFLOAT);
NSDictionary *timeBoundParam = @{NSFontAttributeName : HVWStatusOriginalTimeFont};
CGSize timeSize = [status.created_at boundingRectWithSize:timeBoundSize options:NSStringDrawingUsesLineFragmentOrigin attributes:timeBoundParam context:nil].size;
self.timeLabel.frame = (CGRect){{timeX, timeY}, timeSize}; // 来源
CGFloat sourceX = CGRectGetMaxX(self.timeLabel.frame) + HVWStatusCellInset;
CGFloat sourceY = timeY;
CGSize sourceBoundSize = CGSizeMake(HVWScreenWidth - sourceX, MAXFLOAT);
NSDictionary *sourceBoundParam = @{NSFontAttributeName : HVWStatusOriginalSourceFont};
CGSize sourceSize = [status.source boundingRectWithSize:sourceBoundSize options:NSStringDrawingUsesLineFragmentOrigin attributes:sourceBoundParam context:nil].size;
self.sourceLabel.frame = (CGRect){{sourceX, sourceY}, sourceSize}; // 正文
self.textLabel.frame = originalFrame.textFrame;
self.textLabel.font = HVWStatusOriginalTextFont;
// 设置自动换行
self.textLabel.numberOfLines = ;
self.textLabel.text = status.text; // 设置自己的frame
self.frame = originalFrame.frame;
} @end
//
// HVWStatusRetweetedView.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <UIKit/UIKit.h>
#import "HVWStatusRetweetedFrame.h" @interface HVWStatusRetweetedView : UIView /** frame */
@property(nonatomic, strong) HVWStatusRetweetedFrame *retweetedFrame; @end
//
// HVWStatusRetweetedView.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusRetweetedView.h"
#import "HVWStatus.h"
#import "HVWUser.h" @interface HVWStatusRetweetedView() /** 昵称 */
@property(nonatomic, weak) UILabel *nameLabel; /** 微博文本内容 */
@property(nonatomic, weak) UILabel *textLabel; @end @implementation HVWStatusRetweetedView /** 代码初始化方法 */
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; if (self) { // 初始化子控件开始
// 昵称
UILabel *nameLabel = [[UILabel alloc] init];
nameLabel.font = HVWStatusOriginalNameFont;
self.nameLabel = nameLabel;
[self addSubview:nameLabel]; // 正文
UILabel *textLabel = [[UILabel alloc] init];
textLabel.font = HVWStatusRetweetedTextFont;
textLabel.numberOfLines = ; // 设置自动换行
self.textLabel = textLabel;
[self addSubview:textLabel]; self.backgroundColor = [UIColor grayColor];
} return self;
} /** 设置frame */
- (void)setRetweetedFrame:(HVWStatusRetweetedFrame *)retweetedFrame {
_retweetedFrame = retweetedFrame; HVWStatus *status = retweetedFrame.status; // 设置控件frame
// 昵称
self.nameLabel.frame = retweetedFrame.nameFrame;
self.nameLabel.text = [status retweetedName]; // 正文
self.textLabel.frame = retweetedFrame.textFrame;
self.textLabel.text = status.text; // 设置自己的frame
self.frame = retweetedFrame.frame;
} @end
//
// HVWStatusToolbar.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <UIKit/UIKit.h>
#import "HVWStatusToolbarFrame.h" @interface HVWStatusToolbar : UIView /** frame */
@property(nonatomic, strong) HVWStatusToolbarFrame *toolbarFrame; @end
//
// HVWStatusToolbar.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusToolbar.h" @implementation HVWStatusToolbar /** 代码自定义初始化方法 */
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; if (self) {
self.backgroundColor = [UIColor greenColor];
} return self;
} - (void)setToolbarFrame:(HVWStatusToolbarFrame *)toolbarFrame {
_toolbarFrame = toolbarFrame; // 设置自己的frame
self.frame = toolbarFrame.frame;
} @end

//
// HVWStatusFrame.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <Foundation/Foundation.h>
#import "HVWStatus.h"
#import "HVWStatusContentFrame.h"
#import "HVWStatusToolbarFrame.h" @interface HVWStatusFrame : NSObject #pragma mark - 数据模型
/** cell内微博数据 */
@property(nonatomic, strong) HVWStatus *status; #pragma mark - frame模型
/** 微博内容frame */
@property(nonatomic, strong) HVWStatusContentFrame *contentFrame; /** 工具条frame */
@property(nonatomic, strong) HVWStatusToolbarFrame *toolbarFrame; /** cell高度 */
@property(nonatomic, assign) CGFloat cellHeight; #pragma mark - 方法
/** 使用status数组包装一个statusFrame数组 */
+ (NSArray *) statusFramesWithStatuses:(NSArray *)statuses; @end
//
// HVWStatusFrame.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusFrame.h"
#import "HVWStatusContentFrame.h"
#import "HVWStatusToolbarFrame.h" @implementation HVWStatusFrame /** 使用status数组包装一个statusFrame数组 */
+ (NSArray *) statusFramesWithStatuses:(NSArray *)statuses {
NSMutableArray *statusFrameArray = [NSMutableArray array];
for (HVWStatus *status in statuses) {
HVWStatusFrame *statusFrame = [[HVWStatusFrame alloc] init];
statusFrame.status = status;
[statusFrameArray addObject:statusFrame];
}
return statusFrameArray;
} /** 加载数据 */
- (void)setStatus:(HVWStatus *)status {
_status = status; // 设置子控件frame
// 微博内容frame
HVWStatusContentFrame *contentFrame = [[HVWStatusContentFrame alloc] init];
self.contentFrame = contentFrame;
contentFrame.status = status; // 工具条frame
HVWStatusToolbarFrame *toolbarFrame = [[HVWStatusToolbarFrame alloc] init];
self.toolbarFrame = toolbarFrame;
toolbarFrame.status = status;
CGRect tbFrame = toolbarFrame.frame;
tbFrame.origin.y = CGRectGetMaxY(contentFrame.frame); // cell高度
self.cellHeight = CGRectGetMaxY(tbFrame);
} @end
//
// HVWStatusContentFrame.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <Foundation/Foundation.h>
#import "HVWStatusOriginalFrame.h"
#import "HVWStatusRetweetedFrame.h"
#import "HVWStatus.h" @interface HVWStatusContentFrame : NSObject #pragma mark - frame模型
/** 原创微博frame */
@property(nonatomic, strong) HVWStatusOriginalFrame *originalFrame; /** 转发微博frame */
@property(nonatomic, strong) HVWStatusRetweetedFrame *retweetedFrame; /** 自己的frame */
@property(nonatomic, assign) CGRect frame; #pragma mark - 数据模型
/** 微博数据 */
@property(nonatomic, strong) HVWStatus *status; @end
//
// HVWStatusContentFrame.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusContentFrame.h"
#import "HVWStatusOriginalFrame.h"
#import "HVWStatusRetweetedFrame.h" @implementation HVWStatusContentFrame /** 加载微博数据 */
- (void)setStatus:(HVWStatus *)status {
_status = status; // 设置控件frame
// 原创微博
HVWStatusOriginalFrame *originalFrame = [[HVWStatusOriginalFrame alloc] init];
self.originalFrame = originalFrame;
originalFrame.status = status; // 转发微博
CGFloat contentHeight = ;
if (self.status.retweeted_status) { // 当转发了微博的时候
HVWStatusRetweetedFrame *retweetedFrame = [[HVWStatusRetweetedFrame alloc] init];
retweetedFrame.status = status.retweeted_status; // 设置frame
CGRect retFrame = retweetedFrame.frame;
retFrame.origin.y = CGRectGetMaxY(originalFrame.frame); retweetedFrame.frame = retFrame;
self.retweetedFrame = retweetedFrame; contentHeight = CGRectGetMaxY(retFrame);
} else {
contentHeight = CGRectGetMaxY(originalFrame.frame);
} // 自己的frame
CGFloat contentX = ;
CGFloat contentY = ;
CGFloat contentWidth = HVWScreenWidth;
self.frame = CGRectMake(contentX, contentY, contentWidth, contentHeight);
} @end
//
// HVWStatusOriginalFrame.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <Foundation/Foundation.h>
#import "HVWStatus.h" @interface HVWStatusOriginalFrame : NSObject #pragma mark - frame模型
/** 自己的frame */
@property(nonatomic, assign) CGRect frame; /** 昵称 */
@property(nonatomic, assign) CGRect nameFrame; /** 正文 */
@property(nonatomic, assign) CGRect textFrame; /** 来源 */
@property(nonatomic, assign) CGRect sourceFrame; /** 发表时间 */
@property(nonatomic, assign) CGRect timeFrame; /** 头像 */
@property(nonatomic, assign) CGRect iconFrame; #pragma mark - 数据模型
/** 微博数据 */
@property(nonatomic, strong) HVWStatus *status; @end
//
// HVWStatusOriginalFrame.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusOriginalFrame.h" @implementation HVWStatusOriginalFrame /** 加载微博数据 */
- (void)setStatus:(HVWStatus *)status {
_status = status; // 设置控件frame
// 头像
CGFloat iconX = HVWStatusCellInset;
CGFloat iconY = HVWStatusCellInset;
CGFloat iconWidth = ;
CGFloat iconHeight = ;
self.iconFrame = CGRectMake(iconX, iconY, iconWidth, iconHeight); // 昵称
CGFloat nameX = CGRectGetMaxX(self.iconFrame) + HVWStatusCellInset;
CGFloat nameY = iconY; HVWUser *user = status.user;
CGSize nameBoundSize = CGSizeMake(HVWScreenWidth - nameX, MAXFLOAT);
NSDictionary *nameBoundParam = @{NSFontAttributeName : HVWStatusOriginalNameFont};
CGSize nameSize = [user.name boundingRectWithSize:nameBoundSize options:NSStringDrawingUsesLineFragmentOrigin attributes:nameBoundParam context:nil].size;
self.nameFrame = (CGRect){{nameX, nameY}, nameSize}; /** 由于发表时间会随着时间推移变化,所以不能在这里一次性设置尺寸
* 而“来源”的位置尺寸和“发表时间”有关联,所以一起移走
* 移动到view,每次加载“发表时间”、“来源”都要重新计算size
// 发表时间
CGFloat timeX = nameX;
CGFloat timeY = CGRectGetMaxY(self.nameFrame);
CGSize timeBoundSize = CGSizeMake(HVWScreenWidth - timeX, MAXFLOAT);
NSDictionary *timeBoundParam = @{NSFontAttributeName : HVWStatusOriginalTimeFont};
CGSize timeSize = [status.created_at boundingRectWithSize:timeBoundSize options:NSStringDrawingUsesLineFragmentOrigin attributes:timeBoundParam context:nil].size;
self.timeFrame = (CGRect){{timeX, timeY}, timeSize}; // 来源
CGFloat sourceX = CGRectGetMaxX(self.timeFrame) + HVWStatusCellInset;
CGFloat sourceY = timeY;
CGSize sourceBoundSize = CGSizeMake(HVWScreenWidth - sourceX, MAXFLOAT);
NSDictionary *sourceBoundParam = @{NSFontAttributeName : HVWStatusOriginalSourceFont};
CGSize sourceSize = [status.source boundingRectWithSize:sourceBoundSize options:NSStringDrawingUsesLineFragmentOrigin attributes:sourceBoundParam context:nil].size;
self.sourceFrame = (CGRect){{sourceX, sourceY}, sourceSize};
*/ // 正文
CGFloat textX = iconX;
CGFloat textY = CGRectGetMaxY(self.iconFrame);
CGSize textBoundSize = CGSizeMake(HVWScreenWidth - textX * , MAXFLOAT);
NSDictionary *textBoundParam = @{NSFontAttributeName : HVWStatusOriginalTextFont};
CGSize textSize = [status.text boundingRectWithSize:textBoundSize options:NSStringDrawingUsesLineFragmentOrigin attributes:textBoundParam context:nil].size;
self.textFrame = (CGRect){{textX, textY}, textSize}; // 设置自己的frame
CGFloat x = ;
CGFloat y = ;
CGFloat width = HVWScreenWidth;
CGFloat height = CGRectGetMaxY(self.textFrame) + HVWStatusCellInset;
self.frame = CGRectMake(x, y, width, height);
} @end
//
// HVWStatusRetweetedFrame.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <Foundation/Foundation.h>
#import "HVWStatus.h" @interface HVWStatusRetweetedFrame : NSObject #pragma mark - frame模型
/** 自己的frame */
@property(nonatomic, assign) CGRect frame; /** 昵称 */
@property(nonatomic, assign) CGRect nameFrame; /** 正文 */
@property(nonatomic, assign) CGRect textFrame; #pragma mark - 数据模型
/** 微博数据 */
@property(nonatomic, strong) HVWStatus *status; @end
//
// HVWStatusRetweetedFrame.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusRetweetedFrame.h" @implementation HVWStatusRetweetedFrame /** 加载微博数据 */
- (void)setStatus:(HVWStatus *)status {
_status = status; // 设置控件frame
// 昵称
CGFloat nameX = HVWStatusCellInset;
CGFloat nameY = HVWStatusCellInset;
CGSize nameBoundSize = CGSizeMake(HVWScreenWidth - nameX * , MAXFLOAT);
NSDictionary *nameBoundParam = @{NSFontAttributeName : HVWStatusOriginalNameFont};
CGSize nameSize = [[status retweetedName] boundingRectWithSize:nameBoundSize options:NSStringDrawingUsesLineFragmentOrigin attributes:nameBoundParam context:nil].size;
self.nameFrame = (CGRect){{nameX, nameY}, nameSize}; // 正文
CGFloat textX = nameX;
CGFloat textY = CGRectGetMaxY(self.nameFrame);
CGSize textBoundSize = CGSizeMake(HVWScreenWidth - textX * , MAXFLOAT);
NSDictionary *textBoundParam = @{NSFontAttributeName : HVWStatusOriginalTextFont};
CGSize textSize = [status.text boundingRectWithSize:textBoundSize options:NSStringDrawingUsesLineFragmentOrigin attributes:textBoundParam context:nil].size;
self.textFrame = (CGRect){{textX, textY}, textSize}; // 设置自己的frame
CGFloat x = ;
CGFloat y = ;
CGFloat width = HVWScreenWidth;
CGFloat height = CGRectGetMaxY(self.textFrame) + HVWStatusCellInset;
self.frame = CGRectMake(x, y, width, height);
} @end
//
// HVWStatusToolbarFrame.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <Foundation/Foundation.h>
#import "HVWStatus.h" @interface HVWStatusToolbarFrame : NSObject #pragma mark - frame模型
/** 自己的frame */
@property(nonatomic, assign) CGRect frame; #pragma mark - 数据模型
/** 微博数据 */
@property(nonatomic, strong) HVWStatus *status; @end
//
// HVWStatusToolbarFrame.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/12.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWStatusToolbarFrame.h" @implementation HVWStatusToolbarFrame /** 加载数据 */
- (void)setStatus:(HVWStatus *)status {
_status = status; // 设计自己的frame
CGFloat x = ;
CGFloat y = ;
CGFloat width = HVWScreenWidth;
CGFloat height = ;
self.frame = CGRectMake(x, y, width, height);
} @end

[iOS微博项目 - 4.1] - cell的frame模型的更多相关文章
- [iOS微博项目 - 4.0] - 自定义微博cell
github: https://github.com/hellovoidworld/HVWWeibo A.自定义微博cell基本结构 1.需求 创建自定义cell的雏形 cell包含:内容.工具条 内 ...
- [iOS微博项目 - 3.0] - 手动刷新微博
github: https://github.com/hellovoidworld/HVWWeibo A.下拉刷新微博 1.需求 在“首页”界面,下拉到一定距离的时候刷新微博数据 刷新数据的时候使 ...
- [iOS微博项目 - 4.5] - 每条微博的底部工具条
github: https://github.com/hellovoidworld/HVWWeibo A.每条微博的底部工具条 1.需求 每条微博底部都有一个工具条 显示3个按钮:评论.转发.赞 按钮 ...
- [iOS微博项目 - 3.5] - 封装业务
github: https://github.com/hellovoidworld/HVWWeibo A.封装微博业务 1.需求 把微博相关业务(读取.写微博) 界面控制器不需要知道微博操作细节( ...
- [iOS微博项目 - 4.4] - 会员标识
github: https://github.com/hellovoidworld/HVWWeibo A.会员标识 1.需求 给vip会员打上会员标识 不同等级的vip会员使用不同的标识 使用橙色作为 ...
- [iOS微博项目 - 4.3] - 设置每条微博边框样式
github: https://github.com/hellovoidworld/HVWWeibo A.设置每条微博边框样式 1.需求 不需要分割线 每个微博之间留有一定的间隙 2.思路 直接设 ...
- [iOS微博项目 - 3.1] - 发微博界面
github: https://github.com/hellovoidworld/HVWWeibo A.发微博界面:自定义UITextView 1.需求 用UITextView做一个编写微博的输 ...
- [iOS微博项目 - 2.6] - 获取微博数据
github: https://github.com/hellovoidworld/HVWWeibo A.新浪获取微博API 1.读取微博API 2.“statuses/home_time ...
- [iOS微博项目 - 1.7] - 版本新特性
A.版本新特性 1.需求 第一次使用新版本的时候,不直接进入app,而是展示新特性界面 github: https://github.com/hellovoidworld/HVWWeibo ...
随机推荐
- xa
题目描述把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法.输入每个用例包含二个整数M和N.0<=m<=1 ...
- 进程控制函数(3)-getsid()和setsid()获取当前会话和建立新会话
pid_t setsid(void) 1.调用进程不能是进程组组长,该进程变成新会话首进程(session header) 2.该进程成为一个新进程组的组长进程. 3.需有root权限(ubuntu不 ...
- spring 注解@Resource @Autowired区别
1.@Autowired寻找类的时候默认是ByType,也就是通过类的类型来寻找类.不过,也可以通过借助@Qualifier("name")来指定寻找的类名 @Autowired ...
- aix 常用命令
官网上的介绍: AIX 常用命令汇总 http://www.ibm.com/developerworks/cn/aix/library/au-dutta_cmds.html 我们先SSH 到AIX 系 ...
- 如何在iOS上实现对HTTPS的支持(转)
原文地址:http://blog.5ibc.net/p/101504.html 首先,需要明确你使用HTTP/HTTPS的用途,因为OSX和iOS平台提供了多种API,来支持不同的用途,官方文档< ...
- Odoo 8.0 new API 之one装饰
one装饰器的作用是对每一条记录都执行对应的方法,相当于traditional-style中的function 应用举例: 定义的columns now = fields.Datetime(compu ...
- 在MySQL应用上的挑战
本期采访的讲师是来自腾讯高级软件工程师 雷海林,他有着10年以上的Linux后台Server开发经验,目前主要从事分布式Cache.实时大数据处理引擎,分布式MySQL(TDSQL)设计和开发工作. ...
- Entity Framework中的实体类添加复合主键
使用Code First模式实现给实体类添加复合主键,代码如下: using System; using System.Collections.Generic; using System.Compon ...
- (转)java泛型
转自:http://blog.csdn.net/lonelyroamer/article/details/7868820 java泛型(二).泛型的内部原理:类型擦除以及类型擦除带来的问题 参考:j ...
- linux通过shell脚本修改文件内容
sed -i 's/abc/xxx/g' file abc修改前的字符串xxx是修改后的字符串file是要被修改的文件