[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 ...
随机推荐
- 452. Remove Linked List Elements【Naive】
Remove all elements from a linked list of integers that have value val. Example Given 1->2->3- ...
- sass 的使用
普通变量 ? 1 $fontSize:12px; 默认变量 ? 1 $fontSize:12px; !default; 变量覆盖:只需要在默认变量之前重新声明下变量即可 ? 1 2 $fontSize ...
- SQL Server 2008 允许远程链接 解决方法
用户在使用SQL Server 2008远程链接时,可能会弹出如下对话框: 在链接SQL服务器时发生网络链接错误或特定实例错误.SQL服务器不存在或者链接不成功.请验证用户名是否正确或SQL服务器是否 ...
- 设置root密码,su与sudo的区别
sudo passwd root 可以修改root密码,但首先会要求你输入当前用户的密码 sudo的意思是switch user do,默认切换到root,要求当前用户的密码,会自动调用exit返回到 ...
- [C++]文件头引入#ifndef与#define有什么作用
相关资料:https://zhidao.baidu.com/question/15822506.html 在c.h文件中,a.h文件被包含了两次.而C++规定在同一文件中只能将同一个头文件包含一次.# ...
- Python操作Word【批量生成文章】
http://www.cnblogs.com/codex/p/4668396.html 需要做一些会议记录.总共有多少呢?五个地点x7个月份x每月4篇=140篇.虽然不很重要,但是140篇记录完全雷同 ...
- Windows Phone 修改系统定义的资源颜色
[问题的背景] 相信有些经验的WP研发同学都会遇到下面的问题: 系统控件以及WPToolkit中大量使用了PhoneAccentBrush这个画刷(这个画刷定义的是系统的强调色,即用户选择的主题颜色) ...
- c#生成方案里预生成拷贝文件
我们在做项目时,可能是多人合作,这样每个人的目录层次级别是不一样的,如果用VS自带的OUTPUT输出目录,改变路径,把DLL集中生成到一个文件夹,那么不同人的机器上结果是不一样的,这就造成了,我这台机 ...
- C语言 · c++_ch02_01(打印元音字母的ASCII码)
算法提高 c++_ch02_01 时间限制:1.0s 内存限制:512.0MB 编写一个程序,利用强制类型转换打印元音字母大小写10种形式的ASCII码. 输出的顺序为:大写的字母A ...
- Android——OnCreate
OnCreate OnCreate是Android中的一个特别的函数,用来“表示一个窗口正在生成”.其不产生窗口,只是在窗口显示前设置窗口的属性如风格.位置等. 性 质 函数 特 点 不产 ...