// MyweiboDetailFrame.h
// 新浪微博
//
// Created by Jose on 15-4-20.
// Copyright (c) 2015年 jose. All rights reserved.
// 原创和转发微博的frame
#import <Foundation/Foundation.h>
#import "UIView+Extension.h"
@class MyWeiboModel,MyweiboOriginalFrame,MyweiboRetweetedFrame;
@interface MyweiboDetailFrame : NSObject
/** 原创微博的frame */
@property(nonatomic,strong)MyweiboOriginalFrame *originalframe;
/** 转发微博的frame */
@property(nonatomic,strong)MyweiboRetweetedFrame *retweetedframe;
/** 原创和转发微博的frame */
@property(nonatomic,assign)CGRect detailframe;
/** 传入微博的数据 */
@property(nonatomic,strong)MyWeiboModel *detailweibo;
@end
************************************************************************************************************
***********************************************************************************************************
***********************************************************************************************************
//
// MyweiboDetailFrame.m
// 新浪微博
//
// Created by Jose on 15-4-20.
// Copyright (c) 2015年 jose. All rights reserved.
//
#import "MyweiboDetailFrame.h"
#import "MyweiboOriginalFrame.h"
#import "MyweiboRetweetedFrame.h"
#import "MyWeiboModel.h"
#import "Global.h"
@implementation MyweiboDetailFrame
-(void)setDetailweibo:(MyWeiboModel *)detailweibo{
//全局变量
_detailweibo=detailweibo;
//1.计算原创微博的frame
MyweiboOriginalFrame *myweibooriginalframe=[[MyweiboOriginalFrame alloc]init];
//传入原创微博的数据
myweibooriginalframe.originalweibo=detailweibo;
self.originalframe=myweibooriginalframe;
//2.计算转发微博的frame
CGFloat h=0;
if(detailweibo.retweeted_status){
MyweiboRetweetedFrame *myweiboretweetedframe=[[MyweiboRetweetedFrame alloc]init];
//传入转发微博的数据
myweiboretweetedframe.retweetedweibo=detailweibo.retweeted_status;
//计算转发微博的y值
CGRect temp=myweiboretweetedframe.retweetedframe;
temp.origin.y=CGRectGetMaxY(self.originalframe.originalframe);
myweiboretweetedframe.retweetedframe=temp;
self.retweetedframe=myweiboretweetedframe;
//转发微博的frame
h=CGRectGetMaxY(myweiboretweetedframe.retweetedframe);
}
else{
//原创微博的frame
h=CGRectGetMaxY(myweibooriginalframe.originalframe);
}
//3,计算自己的frame
CGFloat x=0;
//添加cell的间隙,设置为10
CGFloat y=CellMargin;
CGFloat w=ScreenBounds.size.width;
self.detailframe=CGRectMake(x, y, w, h);
}
@end