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能获取到 ...
随机推荐
- Ubuntu下一个python的BeautifulSoup和rsa安装方法---信息检索project2部分:微博爬行要求python包裹
后果<信息检索>第二project,微博具有抓取数据,再处理.师兄给了代码.让慢慢爬.可是在ubuntu下.少了非常多python软件包.须要安装. 1.首先执行时.说少了python.B ...
- WPF 通过位处理合并图片
原文:WPF 通过位处理合并图片 本文告诉大家,在使用 WPF 合并两张图片的处理,可以使用像素之间的与或和异或的方式,对三个颜色的通道进行处理. 先给大家看一下软件的界面 这就是通过将左边的两张图片 ...
- Python3.7环境配置
1.官网下载 https://www.python.org/ 我这是3.7.0 for windows executable installer Download Windows x86 web-ba ...
- yii2.0复选框默认选中
<?php $model->node = array('0','2') ;?> <? echo $form->field($model,'node')->che ...
- 【Python注意事项】如何理解python中间generator functions和yield表情
本篇记录自己的笔记Python的generator functions和yield理解表达式. 1. Generator Functions Python支持的generator functions语 ...
- 怎么会float交换器int
最近突然想知道编译器整数浮球开关是如何实现的,现在很多信息,但遗憾的是甚至没有这方面的记录,所以我决定实现自己的简单的整数浮点转 随着float开启int为例 double转int类似 在做强转之前 ...
- uinty3d导入错误问题解决
导入第一被复制到文件unity3d在相应的文件夹的安装文件夹.回归后,unity3d软体.正确的选择"输入". 版权声明:本文博主原创文章.博客,未经同意不得转载.
- QList介绍(QList比QVector更快,这是由它们在内存中的存储方式决定的。QStringList是在QList的基础上针对字符串提供额外的函数。at()操作比操作符[]更快,因为它不需要深度复制)非常实用
FROM:http://apps.hi.baidu.com/share/detail/33517814 今天做项目时,需要用到QList来存储一组点.为此,我对QList类的说明进行了如下翻译. QL ...
- 《STL源代码分析》---stl_stack.h读书笔记
Stack堆栈是频繁使用FILO数据结构,FILO指first in last out,最后出来. 因为只有一个堆叠端口,这也是在口腔进入口. 可以在堆栈中只能操作,你不能访问其它元件的堆叠.器. S ...
- [Songqw.Net 基础]WPF实现简单的插件化开发
原文:[Songqw.Net 基础]WPF实现简单的插件化开发 版权声明:本文为博主原创文章,未经博主允许可以随意转载 https://blog.csdn.net/songqingwei1988/ar ...