[iOS微博项目 - 4.4] - 会员标识

//
// HVWUser.h
// HVWWeibo
//
// Created by hellovoidworld on 15/2/5.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import <Foundation/Foundation.h> @interface HVWUser : NSObject /** 友好显示名称 */
@property(nonatomic, copy) NSString *name; /** 用户头像地址(中图),50×50像素 */
@property(nonatomic, copy) NSString *profile_image_url; /** 用户昵称 */
@property(nonatomic, copy) NSString *screen_name; /** 会员等级 */
@property(nonatomic, assign) int mbrank; /** 会员类型 */
@property(nonatomic, assign) int mbtype; /** 是否是会员 */
@property(nonatomic, assign, getter=isVip) BOOL vip; @end
//
// HVWUser.m
// HVWWeibo
//
// Created by hellovoidworld on 15/2/5.
// Copyright (c) 2015年 hellovoidworld. All rights reserved.
// #import "HVWUser.h" @implementation HVWUser /** 判断是否是会员 */
- (BOOL)isVip {
return self.mbtype > ;
} @end ()加上vip标识的view
// HVWStatusOriginalView.m
/** vip会员标识 */
@property(nonatomic, weak) UIImageView *vipView; /** 代码初始化方法 */
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; if (self) { // 初始化子控件开始
... // vip会员
UIImageView *vipView = [[UIImageView alloc] init];
vipView.contentMode = UIViewContentModeCenter;
self.vipView = vipView;
[self addSubview:vipView]; ...
} return self;
} /** 设置frame */
- (void)setOriginalFrame:(HVWStatusOriginalFrame *)originalFrame {
... // vip会员标识
if (user.isVip) {
self.nameLabel.textColor = [UIColor orangeColor];
self.vipView.hidden = NO;
self.vipView.frame = originalFrame.vipFrame;
self.vipView.image = [UIImage imageWithNamed:[NSString stringWithFormat:@"common_icon_membership_level%d", user.mbrank]]; } else { // 注意cell的重用问题,需要回复设置
self.nameLabel.textColor = [UIColor blackColor];
self.vipView.hidden = YES;
} ...
}
// HVWStatusOriginalFrame.m
/** 加载微博数据 */
- (void)setStatus:(HVWStatus *)status {
_status = status; ... // vip会员标识
if (user.isVip) {
CGFloat vipX = CGRectGetMaxX(self.nameFrame) + HVWStatusCellInset;
CGFloat vipY = nameY;
CGFloat vipWidth = nameSize.height;
CGFloat vipHeight = vipWidth;
self.vipFrame = CGRectMake(vipX, vipY, vipWidth, vipHeight);
}
...
}
[iOS微博项目 - 4.4] - 会员标识的更多相关文章
- [iOS微博项目 - 2.0] - OAuth授权3步
A.概念 OAUTH协议为用户资源的授权提供了一个安全的.开放而又简易的标准.与以往的授权方式不同之处是OAUTH的授权不会使第三方触及到用户的帐号信息(如用户名与密码),即第三方无需使用用 ...
- [iOS微博项目 - 4.6] - 微博配图
github: https://github.com/hellovoidworld/HVWWeibo A.微博配图 1.需求 显示原创微博.转发微博的缩略图 4张图使用2x2布局,其他使用3x3布局, ...
- [iOS微博项目 - 4.0] - 自定义微博cell
github: https://github.com/hellovoidworld/HVWWeibo A.自定义微博cell基本结构 1.需求 创建自定义cell的雏形 cell包含:内容.工具条 内 ...
- [iOS微博项目 - 3.4] - 获取用户信息
github: https://github.com/hellovoidworld/HVWWeibo A.获取用户信息 1.需求 获取用户信息并储存 把用户昵称显示在“首页”界面导航栏的标题上 ...
- [iOS微博项目 - 3.2] - 发送微博
github: https://github.com/hellovoidworld/HVWWeibo A.使用微博API发送微博 1.需求 学习发送微博API 发送文字微博 发送带有图片的微博 ...
- [iOS微博项目 - 3.1] - 发微博界面
github: https://github.com/hellovoidworld/HVWWeibo A.发微博界面:自定义UITextView 1.需求 用UITextView做一个编写微博的输 ...
- [iOS微博项目 - 3.0] - 手动刷新微博
github: https://github.com/hellovoidworld/HVWWeibo A.下拉刷新微博 1.需求 在“首页”界面,下拉到一定距离的时候刷新微博数据 刷新数据的时候使 ...
- [iOS微博项目 - 2.6] - 获取微博数据
github: https://github.com/hellovoidworld/HVWWeibo A.新浪获取微博API 1.读取微博API 2.“statuses/home_time ...
- [iOS微博项目 - 2.3] - 用户取消对app的授权
github: https://github.com/hellovoidworld/HVWWeibo A.用户取消对app的授权 用户可以在微博网站上取消对某个应用(app)的授权 1.打开& ...
随机推荐
- Struts2的OGNL遍历数组、List、简单的Map
一.简介 <s:iterator />可以遍历 数据栈里面的任何数组,集合等等 在使用这个标签的时候有三个属性值得我们关注 1. value属性:可选的属性,value属性是指一 ...
- Getting Started with Amazon EC2 (1 year free AWS VPS web hosting)
from: http://blog.coolaj86.com/articles/getting-started-with-amazon-ec2-1-year-free-aws-vps-web-host ...
- python内置函数之__import__()
__import__(name, globals=None, locals=None, fromlist=(), level=) 用来导入模块. >>> __import__('os ...
- nyoj 760 See LCS again
See LCS again 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 There are A, B two sequences, the number of ele ...
- angularJs 页面定时刷新
angularJs 页面定时刷新 页面定时刷新并在页面离开时停止自动刷新 var autoRefresh; //自动刷新 autoRefresh = $interval($scope.loadData ...
- Qt学习过程中遇到的问题
由于工作需要,开始使用Qt,由于在网上找的教程文档时针对qt3的,所以在学习的过程遇到了许多由于版本不一致造成的问题,因此记录下来. 参考的文档是:Qt入门教程 详细讲解版 本机Qt版本为:Qt5.3 ...
- 2018-11-17 js的this引起的血案
js的this. 昨天测试,删除商品会报错,马上去测了一把,的确会报错.为毛线呢? SubOrderItem: function (orderitem) { if (orderitem.ordernu ...
- Spring.Net框架三:使用Spring.Net框架实现多数据库
在前面的两篇文章中简单介绍了Spring.Net和如何搭建Spring.Net的环境,在本篇文章中将使用Spring.Net实现多数据库的切换. 一.建立一个空白的解决方案,名称为“SpringDot ...
- _BV()
#define _BV(bit) (1 << (bit)) _BV()是把1左移N位的函数._BV(7)相当于(1<<7) 常用于位的置位或清零 示例解析: PC7=7; PO ...
- jenkins环境搭建&配置(二)
Jenkins介绍: Jenkins用于监控持续重复的工作,功能包括: 1.持续的软件版本发布/测试项目. 2.监控外部调用执行的工作. 安装环境: 操作系统:linux(centOS) 软件:jdk ...