• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            f(sixleaves) = sixleaves

            重劍無鋒 大巧不工

              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              95 隨筆 :: 0 文章 :: 7 評(píng)論 :: 0 Trackbacks
            main.m
             1 //
             2 //  main.m
             3 //  模型練習(xí)
             4 //
             5 //  Created by sixleaves on 15/5/9.
             6 //  Copyright (c) 2015年 itcast. All rights reserved.
             7 //
             8 
             9 #import <Foundation/Foundation.h>
            10 #import "User.h"
            11 #import "Status.h"
            12 
            13 
            14 int main(int argc, const char * argv[]) {
            15     
            16     Status *s = [[Status alloc] init];
            17     s.text = @"今天天氣真好!";
            18     
            19     Status *s2 = [[Status alloc] init];
            20     s2.text = @"嘻嘻";
            21     s2.retweet = s; // s2轉(zhuǎn)發(fā)s這條微博
            22     
            23     User *u = [[User alloc] init];
            24     u.name = @"gh";
            25     User *u2 = [[User alloc] init];
            26     u2.name = @"swp";
            27     
            28     s.user = u; // 設(shè)置微博的主人
            29     s2.user = u2;
            30     
            31     [u2 release];
            32     [u release];
            33     [s2 release];
            34     [s release];
            35     return 0;
            36 }
            37 
            38 
            39 /*
            40  什么是模型:
            41  專門用來存數(shù)據(jù)的,稱為模型
            42  */
            User.h
             1 //
             2 //  User.h
             3 //  模型練習(xí)
             4 //
             5 //  Created by sixleaves on 15/5/9.
             6 //  Copyright (c) 2015年 itcast. All rights reserved.
             7 //
             8 
             9 #import <Foundation/Foundation.h>
            10 
            11 // 姓名、微博號(hào)碼、密碼、頭像、性別、手機(jī)、生日
            12 // 用戶模型
            13 typedef enum {
            14     
            15     SexMan, // 男
            16     SexWoman // 女
            17     
            18 }Sex;
            19 
            20 typedef struct {
            21 
            22     int year;
            23     int month;
            24     int day;
            25     
            26 }Date;
            27 
            28 @interface User : NSObject
            29 
            30 @property (nonatomic, retain) NSString * name;
            31 
            32 @property (nonatomic, retain) NSString * account;
            33 
            34 @property (nonatomic, retain) NSString * password;
            35 
            36 @property (nonatomic, retain) NSString * icon;
            37 
            38 @property (nonatomic, assign) Sex sex;
            39 
            40 @property (nonatomic, retain) NSString * phone;
            41 
            42 @property (nonatomic, assign) Date birthday;
            43 
            44 @end
            45 
            User.m
             1 //
             2 //  User.m
             3 //  模型練習(xí)
             4 //
             5 //  Created by sixleaves on 15/5/9.
             6 //  Copyright (c) 2015年 itcast. All rights reserved.
             7 //
             8 
             9 #import "User.h"
            10 
            11 @implementation User
            12 
            13 - (void)dealloc
            14 {
            15     [_name release];
            16     [_account release];
            17     [_icon release];
            18     [_password release];
            19     [_phone release];
            20     
            21     [super dealloc];
            22 }
            23 
            24 @end
            25 
            Status.h
             1 //
             2 //  Status.h
             3 //  模型練習(xí)
             4 //
             5 //  Created by sixleaves on 15/5/9.
             6 //  Copyright (c) 2015年 itcast. All rights reserved.
             7 //
             8 
             9 #import <Foundation/Foundation.h>
            10 
            11 // 微博內(nèi)容、微博配圖、發(fā)送時(shí)間、微博發(fā)送人、轉(zhuǎn)發(fā)的微博、被評(píng)論數(shù)、被轉(zhuǎn)發(fā)數(shù)
            12 
            13 @class User;
            14 
            15 @interface Status : NSObject
            16 
            17 @property (nonatomic, retain) NSString *text;
            18 
            19 @property (nonatomic, retain) NSString *icon;
            20 
            21 @property (nonatomic, assign) time_t time;
            22 
            23 // 如果設(shè)計(jì)成NSString*不好的原因,
            24 @property (nonatomic, retain) User *user;
            25 
            26 @property (nonatomic, retain) Status * retweet;
            27 
            28 @property (nonatomic, assign) int commentsCount;
            29 
            30 @property (nonatomic, assign) int retweetsCount;
            31 
            32 @end
            33 

            Status.m 1 //
             2 //  Status.m
             3 //  模型練習(xí)
             4 //
             5 //  Created by sixleaves on 15/5/9.
             6 //  Copyright (c) 2015年 itcast. All rights reserved.
             7 //
             8 
             9 #import "Status.h"
            10 #import "User.h"
            11 @implementation Status
            12 - (void)dealloc
            13 {
            14     [_text release];
            15     [_user release];
            16     [_retweet release];
            17     [_icon release];
            18     
            19     [super dealloc];
            20 }
            21 
            22 
            23 @end
            24 
            posted on 2015-05-09 01:23 swp 閱讀(154) 評(píng)論(0)  編輯 收藏 引用 所屬分類: objective-c
            亚洲成av人片不卡无码久久| 麻豆精品久久精品色综合| 久久99精品久久久久久水蜜桃| 久久99精品国产| 久久国产精品二国产精品| 久久精品国产一区二区三区| 久久久受www免费人成| 久久久久av无码免费网| 国产成人精品久久一区二区三区 | 久久99精品久久久久久hb无码| 精品久久一区二区| 久久亚洲国产精品成人AV秋霞| 久久99热精品| 久久人人爽人人爽人人片AV高清| WWW婷婷AV久久久影片| 色偷偷88欧美精品久久久| 久久精品欧美日韩精品| 久久影院亚洲一区| 久久精品视频网| 久久久久无码精品国产不卡| 久久久中文字幕日本| 久久久中文字幕| 久久久av波多野一区二区| 精品久久久久久无码不卡| 久久福利片| 97精品国产97久久久久久免费 | 久久婷婷国产麻豆91天堂| 性欧美大战久久久久久久| 国内精品久久久久影院一蜜桃| 一级做a爰片久久毛片看看| 51久久夜色精品国产| 国产精品美女久久久久网| 欧美精品久久久久久久自慰| 18禁黄久久久AAA片| 久久久久久久91精品免费观看| 久久国产成人午夜aⅴ影院| 久久99国产精品久久99| 久久免费视频观看| 一本色道久久88加勒比—综合| 久久91精品国产91久久户| 欧美伊香蕉久久综合类网站|