1 IDSGenderLeviNamedView 的实现效果
2 类的封装方法:
IDSGenderLeviNamedView.h
@interface IDSGenderLeviNamedView : UIView
@property (nonatomic, strong) UILabel *ageLabel;
@property (nonatomic, strong) UIImageView *genderImageView;
- (instancetype)initWithGender:(NSInteger)gender age:(NSInteger)age;
- (void)gender:(NSInteger)gender age:(NSInteger)age;
@end
IDSGenderLeviNamedView.m
#import "IDSGenderLeviNamedView.h"
@implementation IDSGenderLeviNamedView
#pragma mark - 初始化需求函数
- (instancetype)initWithGender:(NSInteger)gender age:(NSInteger)age
{
if (self = [superinit]) {
self.genderImageView = [[UIImageViewalloc] initWithFrame:CGRectMake(3, 2, 10, 10)];
if (gender == 0) {
self.genderImageView.image = IDSImageNamed(@"img_yiqiwan_man");
self.backgroundColor = NF_Color_C32;
}
else {
self.genderImageView.image = IDSImageNamed(@"img_yiqiwan_woman");
self.backgroundColor = NF_Color_C30;
}
self.genderImageView.contentMode = UIViewContentModeScaleAspectFill;
[selfaddSubview:self.genderImageView];
self.ageLabel = [[UILabelalloc] init];
self.ageLabel.font = [UIFontsystemFontOfSize:Near_Final_Font_T1];
self.ageLabel.textColor = NF_Color_C1;
if (age) {
self.ageLabel.text = [NSStringstringWithFormat:@"%ld",age];
self.ageLabel.frame = CGRectMake(CGRectGetMaxX(self.genderImageView.frame)+1, 0, 0, 0);
self.ageLabel.font = [UIFontsystemFontOfSize:Near_Final_Font_T1];
self.ageLabel.textColor = NF_Color_C1;
[self.ageLabelsizeToFit];
self.ageLabel.centerY = self.genderImageView.centerY;//测试一下可行不?
[selfaddSubview:self.ageLabel];
self.frame = CGRectMake(0, 0, CGRectGetMaxX(self.ageLabel.frame)+3, 14);
}
else {
self.frame = CGRectMake(0, 0, CGRectGetMaxX(self.genderImageView.frame)+3, 14);
}
self.layer.cornerRadius = 3.0f;
self.layer.masksToBounds = YES;
self.clipsToBounds = YES;
}
returnself;
}
- (void)gender:(NSInteger)gender age:(NSInteger)age
{
self.genderImageView.frame = CGRectMake(3, 2, 10, 10);
if (gender == 0) {
self.genderImageView.image = IDSImageNamed(@"img_yiqiwan_man");
self.backgroundColor = NF_Color_C32;
}
else {
self.genderImageView.image = IDSImageNamed(@"img_yiqiwan_woman");
self.backgroundColor = NF_Color_C30;
}
self.genderImageView.contentMode = UIViewContentModeScaleAspectFill;
self.ageLabel.font = [UIFontsystemFontOfSize:Near_Final_Font_T1];
self.ageLabel.textColor = NF_Color_C1;
if (age) {
self.ageLabel.hidden = NO;
self.ageLabel.text = [NSStringstringWithFormat:@"%ld",age];
self.ageLabel.frame = CGRectMake(CGRectGetMaxX(self.genderImageView.frame)+1, 0, 0, 0);
self.ageLabel.font = [UIFontsystemFontOfSize:Near_Final_Font_T1];
self.ageLabel.textColor = NF_Color_C1;
[self.ageLabelsizeToFit];
self.ageLabel.centerY = self.genderImageView.centerY;//测试一下可行不?
self.frame = CGRectMake(0, 0, CGRectGetMaxX(self.ageLabel.frame)+3, 14);
}
else {
self.ageLabel.hidden = YES;
self.frame = CGRectMake(0, 0, CGRectGetMaxX(self.genderImageView.frame)+3, 14);
}
self.layer.cornerRadius = 3.0f;
self.layer.masksToBounds = YES;
self.clipsToBounds = YES;
}
@end
- OVER
- [Audio processing] 数据集生成 & 性别年龄分类训练 Python
1.重命名,Python中文路径各种错误,所以需要先将所有文件的路径名全都改成中文.用的是MAC系统,所以WIN下的命令行批处理没法解决,所以用C来完成 // Created by Carl on 1 ...
- 星星的模块封装类 IDSStarsScoreView
1 IDSStarsScoreView 的实现效果 2 类的封装方法: <声明文件> // // IDSStarsScoreView.h // Near // // ...
- 基于安卓高仿how-old.net实现人脸识别估算年龄与性别
前几段微软推出的大数据人脸识别年龄应用how-old.net在微博火了一把,它可以通过照片快速获得照片上人物的年龄,系统会对瞳孔.眼角.鼻子等27个“面部地标点"展开分析,进而得出你的“颜龄 ...
- 虚基类——(1)定义人员类Person: 公有成员:姓名(Name); 保护成员:性别(Gender),年龄(Age); 构造函数和析构函数
题目描述: (1)定义人员类Person: 公有成员:姓名(Name): 保护成员:性别(Gender),年龄(Age): 构造函数和析构函数 (2) 从人员类Person派生学生记录类Student ...
- 内置函数 hashlib configparser logging 模块 C/S B/S架构
1.内置函数 # 内置的方法有很多 # 不一定全都在object中 # class Classes: # def __init__(self,name): # self.name = name # s ...
- 常用模块 - openpyxl模块
一.简介 xlrd/xlwt 主要是针对Office 2003或更早版本的XLS文件格式 缺点:不支持XLSX文件格式 OpenPyXL 能读能写能修改 缺点:不支持XLS Microsoft Exc ...
- python----openpyxl模块
openpyxl 模块 1.openpyxl的写 from openpyxl import Workbook wb = Workbook() # 方式一: 默认创建sheet在最后 wb1 = wb. ...
- python面向编程: 常用模块补充与面向对象
一.常用模块 1.模块 的用用法 模块的相互导入 绝对导入 从sys.path (项目根目录)开始的完整路径 相对导入 是指相对于当前正在执行的文件开始的路径 只能用于包内模块相互间导入 不能超过顶层 ...
- 操作excel--xlwt/xlrd/xlutils模块
一.写Excel (导入xlwt模块)需求:只要你传入一个表名,就能把所有的数据导入出来写入excel,字段名是excel的表头分析: 1.要动态获取到表的字段 cur.description能获取到 ...
随机推荐
- Vuex的一个易错点
好长时间不用Vuex,发现有些东西记模糊了. 在对Vuex进行模块化开发的时候, const store = new Vuex.Store({ modules: { a: moduleA, b: mo ...
- 【20.19%】【codeforces 629D】Babaei and Birthday Cake
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- XMPP开发adiumclient登陆
我写在前面client它已经实现了登陆,我用下面的adium要登录落实的朋友加入,而自己写的client在聊天帐号. 第一次登录时adium工欲善其事,必先例如,下面的配置 保存后.你会发现自己的账号 ...
- Android开发者的演示工具——asm.jar
作为Android开发者,我们有时候需要给客户或者其他人演示我们的Android作品.我们可以使用类似豌豆荚.360手机助手这样的软件,今天我来介绍一个Android开发者的演示工具--asm.jar ...
- 设置m_pszAppName值的做法
作者:朱金灿 来源:http://blog.csdn.net/clever101 CWinApp::m_pszAppName用于指定应用程序的名字.昨天这样修改它的值: m_pszAppName = ...
- yii2.0获取最后一条ID
$r_id=Yii::$app->db->getLastInsertID();
- android模拟器上不了网的解决办法
Android模拟器默认的地址是10.0.2.3,默认的DNS也是10.0.2.3,对于在家里上网学习Android的人来讲,一般电脑的IP都是192.168.1.100之类的,不在同一个网段.所以就 ...
- DDD实战10 在项目中使用JWT的token
在使用过程中报过一个错误:The algorithm: 'HS256' requires the SecurityKey.KeySize to be greater than '128' bits 是 ...
- Windows Serverserver结束MySQL自己主动数据库备份
1.给root所有授权的帐户sql才干 grant all privileges on *.* to root@"%" identified by "."; f ...
- Folly: Facebook Open-source Library Readme.md 和 Overview.md(感觉包含的东西并不多,还是Boost更有用)
folly/ For a high level overview see the README Components Below is a list of (some) Folly component ...