2016-03-04 一个完整的model 样式

1:

#import "ContactListViewCell.h"

@implementation ContactListViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {

_portraitImg = [[UIImageView alloc] initWithFrame:CGRectMake(20.0f, 10.0f, 45.0f, 45.0f)];

_portraitImg.contentMode = UIViewContentModeScaleToFill;

_portraitImg.image = [UIImage imageNamed:@"personal_portrait"];

[self.contentView addSubview:_portraitImg];

_nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(70.0f, 10.0f, self.frame.size.width-150.0f, 25.0f)];

_nameLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;

[self.contentView addSubview:_nameLabel];

_numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(_nameLabel.frame.origin.x, _nameLabel.frame.origin.y+_nameLabel.frame.size.height, _nameLabel.frame.size.width, 15.0f)];

_numberLabel.font = [UIFont systemFontOfSize:13.0f];

_numberLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;

_numberLabel.textColor = [UIColor grayColor];

[self.contentView addSubview:_numberLabel];

}

return self;

}

@end

2:

static NSString *contactlistcellid = @"ContactListViewCellidentifier";

ContactListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:contactlistcellid];

if (cell == nil) {

cell = [[ContactListViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:contactlistcellid];

}

AddressBook *book = addressbook;

cell.portraitImg.image = book.head;

cell.nameLabel.text = book.name;

NSString* phone = [book.phones allValues].firstObject;

cell.numberLabel.text = phone?phone:@"无号码";

return cell;

3:

#import <Foundation/Foundation.h>

@interface AddressBook : NSObject

#pragma mark- 通讯录信息

@property (nonatomic, copy) NSString *name;

@property (nonatomic, strong) UIImage *head;

@property (nonatomic, strong) NSMutableDictionary *phones;

@property (nonatomic, strong) NSMutableDictionary *others;

/**

*  名字头字母

*/

@property (nonatomic, readonly) NSString *firstLetter;

@end

时间: 2024-08-05 05:04:33

2016-03-04 一个完整的model 样式的相关文章

2016.03.04///Java学习记录①

import java.util.Scanner; public class xinxi { public static void main(String[] aa) { Scanner in = new Scanner(System.in);  //创建Scanner类对象 System.out.printf("Enter your name: "); String name = in.nextLine();          //输入姓名 System.out.printf(&qu

moon 英文单词 2016.03.04

underlying/??nd??laii?/adj 潜在的,基础的,表面下的,下层的 vt构成......的基础. independent/??ndi?pend?nt/adj:自主的,不相关的,独立的,不相干的人所做的 available/??veil?bl/adj:可用的,有空的,可回见的,(票等)有效的 specialized trails and lesson 专业课和课 specialized /?spe??la?zd/adj:专门的; 专业的; 专用的 v:专攻; (speciali

2016.03.04,英语,《Vocabulary Builder》Unit 04

vor: 来自拉丁动词vorare,指to eat,-ivorous指吃某种食物的eater.carn肉,肉欲+vore吃→吃肉的:carnival狂欢节,谢肉节voracious a 狼吞虎咽的(vor+acious多…..的--吃多的) voracity n 贪食(vor+acilty) devour v 吞吃(de下去+vour[=vor]→吃下去→吞吃) omnivorous a 杂食性的(omni全部+vor+oue→什么都吃→杂食性的) herbivorous a 食草的(herbi

shell 如何生成一个序列 01 02 03 04 05

seq 命令介绍 用途: seq - print a sequence of numbers 语法: seq [OPTION]... LAST seq [OPTION]... FIRST LAST seq [OPTION]... FIRST INCREMENT LAST 常用选项 -s, --separator=STRING use STRING to separate numbers (default: \n) -w, --equal-width equalize width by paddi

Android实现推送方式解决方案【转载地址:http://www.cnblogs.com/hanyonglu/archive/2012/03/04/2378971.html】

本文介绍在Android中实现推送方式的基础知识及相关解决方案.推送功能在手机开发中应用的场景是越来起来了,不说别的,就我们手机上的新闻客户端就时不j时的推送过来新的消息,很方便的阅读最新的新闻信息.这种推送功能是好的一面,但是也会经常看到很多推送过来的垃圾信息,这就让我们感到厌烦了,关于这个我们就不能多说什么了,毕竟很多商家要做广告.本文就是来探讨下Android中实现推送功能的一些解决方案,也希望能够起到抛砖引玉的作用.^_^ 1.推送方式基础知识:  在移动互联网时代以前的手机,如果有事情

分布式技术一周技术动态 2016.03.20

分布式系统实践 1. 基于Mesos和Docker的分布式计算平台 https://mp.weixin.qq.com/s?__biz=MzAxMDgzOTA2Mw==&mid=402769128&idx=1&sn=cea3ad1357bd9312acf1768c0a493bfd&scene=1&srcid=0318BTuxT0fsFYwPjpeyuDOa&key=710a5d99946419d90fbc1e7600cce055b6e997d6afafc74c

如何快速搭建一个完整的移动直播系统?

移动直播行业的火热会在很长一段时间内持续,通过和各行业的整合,从而成为具有无限可能性的行业.主要因为以下三个原因: 第一,移动直播的UGC生产模式比PC端的直播更明显,人人都有设备,随时随地开播,完全顺应了互联网时代的开放性原则,能刺激更多人去创造和传播优质内容. 第二,网络带宽和速度在逐渐提高,网络成本在逐渐下降,为移动直播提供一个极佳的发展环境.文字.声音.视频.游戏等都会在移动直播中呈现,创造出更加丰富的用户体验.直播可以以SDK的形式接入到自己的应用中,比如,教育领域中的课后辅导完全可以

高级I/O复用技术:Epoll的使用及一个完整的C实例

高性能的网络服务器需要同时并发处理大量的客户端,而采用以前的那种对每个连接使用一个分开的线程或进程方法效率不高,因为处理大量客户端的时候,资源的使用及进程上下文的切换将会影响服务器的性能.一个可替代的方法是在一个单一的线程中使用非阻塞的I/O(non-blocking I/O).         这篇文章主要介绍linux下的epoll(7)方法,其有着良好的就绪事件通知机制.我们将会使用C来展现一个完整的TCP服务器实现代码.Epoll是被linux2.6开始引进的,但是不被其他的类UNIX系

Codeigniter:如何写一个好的Model

本文是关于在Code Igniter PHP MVC框架中如何编写Model方法. CRUD 方法 CRUD 是Create, Retrieve, Update, and Delete的缩写. 这些是最基本的数据源交互方法. 如:Create[增] – 添加一个用户账号Retrieve[查] – 获取一个产品列表 Update[改] – 修改用户密码或产品名称Delete[删] – 删除一个用户或产品 编写model时,一般首先会创建CRUD方法.如果你正在编写用户身份验证(登陆,注销,忘记密码