首页 > 其他 > 详细

单例模式2014-12

时间:2015-03-18 18:40:10      阅读:379      评论:0      收藏:0      [点我收藏+]

之前写过的一个好友信息的单利

//

//  FriendBuddyList.h



#import <Foundation/Foundation.h>

#import "FriendBuddyModel.h"

@interface FriendBuddyList : NSObject

+ (id)sharedFriendBuddyList;

@property (nonatomic , strong) NSArray *friend


Array;

-(void)getFriendArrayWithArray:(NSArray*)array;


@end


//

//  FriendBuddyList.m


#import "FriendBuddyList.h"

#import "FriendBuddyModel.h"

static FriendBuddyList *sharedFriendBuddyList = nil;

@implementation FriendBuddyList

+ (FriendBuddyList *) sharedFriendBuddyList

{

    if (sharedFriendBuddyList == nil) {

        sharedFriendBuddyList = [[super allocWithZone:NULL] init];

    }

    return sharedFriendBuddyList;

}


+ (id) allocWithZone:(struct _NSZone *)zone

{

    return [self sharedFriendBuddyList];

}


- (id) copyWithZone:(NSZone *) zone

{

    return self;

}



-(void)getFriendArrayWithArray:(NSArray*)array

{

    self.friendArray = array;

}


@end


本文出自 “每天一点点” 博客,谢绝转载!

单例模式2014-12

原文:http://huaxiazwd.blog.51cto.com/9738221/1621684

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!