• <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

            重劍無(wú)鋒 大巧不工

              C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(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  專(zhuān)門(mén)用來(lái)存數(shù)據(jù)的,稱(chēng)為模型
            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 // 用戶(hù)模型
            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 閱讀(151) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): objective-c
            亚洲AV乱码久久精品蜜桃| jizzjizz国产精品久久| 久久久久久精品无码人妻| 7777久久久国产精品消防器材| 99久久精品免费看国产一区二区三区| 97久久精品国产精品青草| 久久人人爽人人精品视频| 少妇精品久久久一区二区三区| 亚洲天堂久久精品| 日韩人妻无码一区二区三区久久 | 亚洲综合熟女久久久30p| 成人久久精品一区二区三区| 中文字幕无码久久久| 久久五月精品中文字幕| 成人妇女免费播放久久久| 亚洲&#228;v永久无码精品天堂久久| 伊人久久大香线蕉av不卡 | 伊人久久大香线蕉精品不卡| 久久99精品国产一区二区三区| 久久久久高潮综合影院| 麻豆久久| 久久精品亚洲男人的天堂| 久久福利青草精品资源站免费| 久久久久久久女国产乱让韩| 久久激情亚洲精品无码?V| 9191精品国产免费久久 | 久久人人爽人人爽人人av东京热| 久久精品九九亚洲精品| 精品人妻伦九区久久AAA片69| 日韩一区二区三区视频久久| 久久精品国产一区二区三区| 99久久婷婷国产一区二区| 好属妞这里只有精品久久| 久久精品国产久精国产思思 | 免费精品久久久久久中文字幕 | 久久精品亚洲乱码伦伦中文| 久久综合久久综合久久综合| 狠狠色婷婷综合天天久久丁香| 99久久综合狠狠综合久久止| 国产三级久久久精品麻豆三级| 国产精品视频久久久|