新浪微博开发之三十二(原创微博和转发微博frame)

//
//  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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值