DJStatusCell.h

#import <UIKit/UIKit.h>

@class DJStatusCellFrame;
@interface DJStatusCell : UITableViewCell /** DJStatusCell 的默认构造方法 */
+ (instancetype)cellWithTableView:(UITableView *)tableView; @property (nonatomic,strong) DJStatusCellFrame *statusFrame; @end

DJStatusCell.m

#import "DJStatusCell.h"
#import "DJStatusCellFrame.h"
#import "DJStatus.h"
#import "DJUser.h"
#import "UIImageView+WebCache.h" @interface DJStatusCell() //============================== 原创微博部分 ======================================== /** 原创微博整体 */
@property (nonatomic,weak) UIView *originalView;
/** 头像 */
@property (nonatomic,weak) UIImageView *iconView;
/** 会员标志 */
@property (nonatomic,weak) UIImageView *vipView;
/** 微博图片 */
@property (nonatomic,weak) UIImageView *photoView;
/** 昵称 */
@property (nonatomic,weak) UILabel *nameLabel;
/** 发布时间 */
@property (nonatomic,weak) UILabel *timeLabel;
/** 微博来源 */
@property (nonatomic,weak) UILabel *sourceLabel;
/** 微博内容 */
@property (nonatomic,weak) UILabel *contentLabel; //============================== 原创微博部分 ======================================== @end @implementation DJStatusCell + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @"status"; DJStatusCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
if (!cell) {
cell = [[DJStatusCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
}
return cell;
} /** cell的默认初始化方法,此方法只会被调用一次 */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) { // 原创微博整体
UIView *originalView = [[UIView alloc] init];
[self.contentView addSubview:originalView];
self.originalView = originalView; // 头像
UIImageView *iconView = [[UIImageView alloc] init];
[self.originalView addSubview:iconView];
self.iconView = iconView; // 会员标志
UIImageView *vipView = [[UIImageView alloc] init];
[self.originalView addSubview:vipView];
self.vipView = vipView; // 微博图片
UIImageView *photoView = [[UIImageView alloc] init];
[self.originalView addSubview:photoView];
self.photoView = photoView; // 昵称
UILabel *nameLabel = [[UILabel alloc] init];
[self.originalView addSubview:nameLabel];
self.nameLabel = nameLabel; // 发布时间
UILabel *timeLabel = [[UILabel alloc] init];
[self.originalView addSubview:timeLabel];
self.timeLabel = timeLabel; // 微博来源
UILabel *sourceLabel = [[UILabel alloc] init];
[self.originalView addSubview:sourceLabel];
self.sourceLabel = sourceLabel; // 微博内容
UILabel *contentLabel = [[UILabel alloc] init];
[self.originalView addSubview:contentLabel];
self.contentLabel = contentLabel; }
return self; } - (void)setStatusFrame:(DJStatusCellFrame *)statusFrame { _statusFrame = statusFrame; DJStatus *status = statusFrame.status;
DJUser *user = status.user; /* 设置当前View的Frame */ // 原创微博整体
self.originalView.frame = statusFrame.originalViewF; // 头像
self.iconView.frame = statusFrame.iconViewF;
[self.iconView sd_setImageWithURL:[NSURL URLWithString:user.profile_image_url] placeholderImage:[UIImage imageNamed:@"avatar_default_small"]]; // 会员标志
self.vipView.frame = statusFrame.vipViewF;
[self.vipView setImage:[UIImage imageNamed:@"common_icon_membership_level1"]]; // 微博图片
self.photoView.frame = statusFrame.photoViewF; // 昵称
self.nameLabel.frame = statusFrame.nameLabelF;
self.nameLabel.text = user.name; // 发布时间
self.timeLabel.frame = statusFrame.timeLabelF; // 微博来源
self.sourceLabel.frame = statusFrame.sourceLabelF; // 微博内容
self.contentLabel.frame = statusFrame.contentLabelF;
self.contentLabel.text = status.text; } @end

DJStatusCellFrame.h

#import <Foundation/Foundation.h>

@class DJStatus;
@interface DJStatusCellFrame : NSObject /** 微博数据实体 */
@property (nonatomic,strong) DJStatus *status; /** 原创微博整体的Frame */
@property (nonatomic,assign) CGRect originalViewF;
/** 头像的Frame */
@property (nonatomic,assign) CGRect iconViewF;
/** 会员标志的Frame */
@property (nonatomic,assign) CGRect vipViewF;
/** 微博图片的Frame */
@property (nonatomic,assign) CGRect photoViewF;
/** 昵称的Frame */
@property (nonatomic,assign) CGRect nameLabelF;
/** 发布时间的Frame */
@property (nonatomic,assign) CGRect timeLabelF;
/** 微博来源的Frame */
@property (nonatomic,assign) CGRect sourceLabelF;
/** 微博内容的Frame */
@property (nonatomic,assign) CGRect contentLabelF; /** 当前微博的高度 */
@property (nonatomic,assign) CGFloat cellHeight; @end

DJStatusCellFrame.m

#import "DJStatusCellFrame.h"

@implementation DJStatusCellFrame

- (void)setStatus:(DJStatus *)status {

    _status = status;

}

@end

新浪微博客户端(22)-创建微博Cell的更多相关文章

  1. 新浪微博客户端开发之OAuth认证篇

    新浪微博客户端开发之OAuth认证篇 2013年7月29日新浪微博客户端开发 OAuth2.0授权机制我在这里就不浪费口舌了,有很多大牛都发表过相关的文章解释OAuth2.0认证的流程,我就随便找了一 ...

  2. android开发新浪微博客户端 完整攻略 [新手必读]

    开始接触学习android已经有3个礼拜了,一直都是对着android的sdk文档写Tutorials从Hello World到Notepad Tutorial算是初步入门了吧,刚好最近对微博感兴趣就 ...

  3. Aisen仿新浪微博客户端项目源码

    新浪目前已经限制了第三方微博的很多API接口,加上平常时间不够,所以后续可能不会面向产品的去维护Aisen,不过也有了一些新的方向,例如引入最新Android-support-library,在一个完 ...

  4. [iOS微博项目 - 4.0] - 自定义微博cell

    github: https://github.com/hellovoidworld/HVWWeibo A.自定义微博cell基本结构 1.需求 创建自定义cell的雏形 cell包含:内容.工具条 内 ...

  5. Android应用--新浪微博客户端新特性滚动视图和启动界面实现

    新浪微博客户端新特性滚动视图和启动界面实现 2013年8月20日新浪微博客户端开发之启动界面实现 前言: 使用过新浪微博客户端的童鞋都清楚,客户端每一次升级之后第一次启动界面就会有新特性的介绍,用户通 ...

  6. android 新浪微博客户端的表情功能的实现

    这是一篇好文章,我转来收藏,技术的最高境界是分享. 最近在搞android 新浪微博客户端,有一些心得分享弄android客户端表情功能可以用以下思路1.首页把新浪的表情下载到本地一文件夹种,表情图片 ...

  7. 使用electron开发一个h5的客户端应用创建http服务模拟后台接口mock

    使用electron开发一个h5的客户端应用创建http服务模拟后端接口mock 在上一篇<electron快速开始>里讲述了如何快速的开始一个electron的应用程序,既然electr ...

  8. NIO客户端主要创建过程

    NIO客户端主要创建过程:   步骤一:打开SocketChannel,绑定客户端本地地址(可选,默认系统会随机分配一个可用的本地地址),示例代码如下:    SocketChannel client ...

  9. 四次元新浪微博客户端Android源码

    四次元新浪微博客户端Android源码 源码下载:http://code.662p.com/list/11_1.html [/td][td] [/td][td] [/td][td] 详细说明:http ...

随机推荐

  1. IOS 应用生命周期

    *当第一次运行程序时候:(active)didFinishLaunchingWithOptions(加载完毕)->applicationDidBecomeActive(获取焦点)*当点击home ...

  2. 【MPI0】学习资料搜集

    一个不错的英文的MPI教程:http://mpitutorial.com 中科大的MPI学习资料:http://micro.ustc.edu.cn/Linux/MPI/ 清华大学的并行计算资料:htt ...

  3. Orchard内置特性(以模块来说的)

    本文链接:http://www.cnblogs.com/souther/p/4539169.html 主目录 Orchard中有很多可以直接和多次使用的特性,这些东西在官方的Gallery中可以找到. ...

  4. ASCII、Unicode、GBK和UTF-8字符编码的区别联系(转载)

    ASCII.Unicode.GBK和UTF-8字符编码的区别联系 转载自:http://dengo.org/archives/901 很久很久以前,有一群人,他们决定用8个可以开合的晶体管来组合成不同 ...

  5. java之Cookie详解

    Cookie是由服务器端生成,发送给User-Agent(一般是浏览器),浏览器会将Cookie的key/value保存到某个目录下的文本文件内,下次请求同一网站时就发送该Cookie给服务器(前提是 ...

  6. 温故知新---重读C#InDepth(一)

    一本好书,或是一本比较有深度的书,就是每次研读的时候都会有新的发现. 好吧,我承认每次读的时候都有泛泛而过的嫌疑~~ 这几年一直专注于C#客户端的开发,逐步从迷迷糊糊,到一知半解,再到自以为是,最后沉 ...

  7. bean标签

     bean的uri的路径 bean标签是属于struts中的标签,使用要在 Struts 1.3 Libraries中 struts-taglib-1.3.8.jar 中META-INFtld ...

  8. poj2763 树链剖分(线段树)

    注意这里都是把边放到线段树中,所以lca的时候,要注意如果top[x]==top[y] && x==y 的时候已经完成了. 仔细想想边和点的不同之处!!! #include<ma ...

  9. Jquery-获取子元素children,find

    1.查找子元素方式1:> 例如:var aNods = $("ul > a");查找ul下的所有a标签 2.查找子元素方式2:children() 3.查找子元素方式3 ...

  10. 【POJ 2243】Knight Moves

    题 Description A friend of you is doing research on the Traveling Knight Problem (TKP) where you are ...