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能获取到 ...
随机推荐
- Cordova之如何用命令行创建一个项目(完整示例)
原文:Cordova之如何用命令行创建一个项目(完整示例) 1. 创建cordova项目 (注意:当第一次创建或编译项目的时候,可能系统会自动下载一些东西,需要一些时间.) 在某个目录下创建cordo ...
- effective c++ 条款7
1.随着多态基类应该声明一个质virtual析构函数. 假定class由于不管是什么virtual析构函数, 它应该有一个virtual析构函数. 2.classed的设计目的假设不是作为base c ...
- android仿新浪引导界面
最近在研究如何做出仿微信,仿新浪等应用,第一次安装使用的使用展示应用程序的新特性和用法. 实现功能:左右手势滑屏 底部小圆点随当前显示页跳动 浮动按钮显示.当触屏事件发生显示,否则就渐渐消失 先转个文 ...
- 《北京IT报道》你可以成为下一个《万万没有想到》?
10一个月29当天上午,一位名为<北京IT报道>在视频短剧IT朋友谁快速刷新的互联网商业圈.这种制作粗糙.演员表情僵硬.安置赤裸网络剧,但对布局和内容因IT互联网从业者的生活,深受广大用户 ...
- 浅谈WPF中对控件的位图特效(WPF Bitmap Effects)
原文:浅谈WPF中对控件的位图特效(WPF Bitmap Effects) -------------------------------------------------------------- ...
- Python 爬虫 —— BeautifulSoup
from bs4 import BeautifulSoup % 首字母大写,显然这是一个类 1. BeautifulSoup 类 HTML 解析类(parser) r = requests.get(. ...
- Analysis of variance(ANOVA)
方差分析,也称为"变异数分析",用于两个及两个以上样本均值(group means)差别的显著性检验.在 ANOVA 的环境下,一个观测得到的方差视为是由不同方差的源组合而成.
- 图像金字塔(pyramid)与 SIFT 图像特征提取(feature extractor)
David Lowe(SIFT 的提出者) 0. 图像金字塔变换(matlab) matlab 对图像金字塔变换接口的支持(impyramid),十分简单好用. 其支持在reduce和expand两种 ...
- python 教程 第八章、 第一个python程序
第八章. 第一个python程序 #!/usr/bin/env python import os import sys import time source = [r'G:\s1', r'G:\s2' ...
- 王立平--RemoteView
RemoteView它将在两个地方被使用:一个是在AppWidget,另外一个是在Notification. RemoteView是用来描写叙述一个垮进程显示的view 1.AppWidget---R ...