Objective-C - 模型的设计
来源:互联网 发布:淘宝总公司投诉电话 编辑:程序博客网 时间:2024/05/01 15:05
模型的设计
int main(){ //新建2个用户 User *u = [[User alloc] init]; u.name = @"2B"; User *u2 = [[User alloc] init]; u2.name = @"傻B"; // 新建2条微博 Status *s = [[Status alloc] init]; s.text = @"今天天气真好!"; s.user = u; Status *s2 = [[Status alloc] init]; s2.text = @"今天天气真的很好!"; s2.retweetStatus = s; s2.user = u2; [u2 release]; [u release]; [s2 release]; [s release]; return 0;}
typedef enum { SexMan, // 男 SexWoman // 女} Sex;typedef struct { int year; int month; int day;} Date;// 姓名、微博号码、密码、头像、性别、手机、生日@interface User : NSObject@property (nonatomic, retain) NSString *name;@property (nonatomic, retain) NSString *account;@property (nonatomic, retain) NSString *password;// http://weibo.com/a.png URL@property (nonatomic, retain) NSString *icon;@property (nonatomic, assign) Sex sex;@property (nonatomic, retain) NSString *phone;@property (nonatomic, assign) Date birthday;@end
@implementation User- (void)dealloc{ [_name release]; [_account release]; [_icon release]; [_password release]; [_phone release]; [super dealloc];}@end
#import "User.h"// 微博内容、微博配图、发送时间、微博发送人、转发的微博、被评论数、被转发数@interface Status : NSObject@property (nonatomic, retain) NSString *text;@property (nonatomic, retain) NSString *icon;// 从1970-01-01 00:00:00 开始,一共度过了多少毫秒@property (nonatomic, assign) long time;//@property (nonatomic) time_t time;@property (nonatomic, retain) User *user;@property (nonatomic, retain) Status *retweetStatus;@property (nonatomic, assign) int commentsCount;@property (nonatomic, assign) int retweetsCount;@end
@implementation Status- (void)dealloc{ [_text release]; [_user release]; [_retweetStatus release]; [_icon release]; [super dealloc];}@end
0 1
- Objective-C - 模型的设计
- Objective-C的对象模型
- objective c下的对象模型
- objective c下的block模型
- Objective-C对象模型
- Objective-C对象模型
- objective C 对象模型
- Objective-C错误模型
- Objective-C 对象模型
- Objective-C对象模型
- Objective-C - 类的设计实例
- 黑马程序员----objective-C 类的设计
- Objective-c:设计模式
- Objective-C的对象模型与运行时
- Objective-C的对象模型和runtime机制
- Objective-C的几种常用设计模式的总结
- iOS的Objective-C的工厂设计模式详解
- objective c设计模式--KVO
- 15.精灵进阶之给节点添加动作
- R语言中的并行计算——二、搭建R的集群
- SQL Server 损坏修复
- LeetCode twoSum
- Java垃圾回收是如何工作的?
- Objective-C - 模型的设计
- Distinctive Image Features from Scale-Invariant Keypoints-SIFT算法译文
- Android环境搭建 目录介绍
- Object类中的方法
- IOS7开发~JavaScriptCore (一)
- 自定义标签工具栏
- New files creation and Makefile
- Scala编程指南(2) 更少的字更多的事
- C++友元