Repository navigation
Expand file tree
/
Copy pathHappyOptions.m
More file actions
73 lines (54 loc) · 1.79 KB
/
Copy pathHappyOptions.m
File metadata and controls
73 lines (54 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// HappyOptions.m
// iBeHappy
//
// Created by Joanna Szymczyk on 3/8/14.
//
//
#import "HappyOptions.h"
@implementation HappyOptions
- (void)encodeWithCoder: (NSCoder *)encoder
{
[encoder encodeObject: _loveOptions forKey: @"loveOptions"];
[encoder encodeObject: _educationOptions forKey: @"educationOptions"];
[encoder encodeObject: _incomeOptions forKey: @"incomeOptions"];
[encoder encodeObject: _childOptions forKey: @"childOptions"];
[encoder encodeObject: _petOptions forKey: @"petOptions"];
}
- (id)init
{
self = [super init];
if (self)
{
_loveOptions = [[NSMutableArray alloc] init];
_educationOptions = [[NSMutableArray alloc] init];
_incomeOptions = [[NSMutableArray alloc] init];
_childOptions = [[NSMutableArray alloc] init];
_petOptions = [[NSMutableArray alloc] init];
}
return self;
}
- (id)initWithCoder: (NSCoder *)decoder
{
self = [super init];
if (self)
{
self.loveOptions = [decoder decodeObjectForKey:@"loveOptions"];
self.educationOptions = [decoder decodeObjectForKey:@"educationOptions"];
self.incomeOptions = [decoder decodeObjectForKey:@"incomeOptions"];
self.childOptions = [decoder decodeObjectForKey:@"childOptions"];
self.petOptions = [decoder decodeObjectForKey: @"petOptions"];
}
return self;
}
- (id)copyWithZone:(NSZone *)zone
{
HappyOptions *options = [[HappyOptions alloc] init];
options.loveOptions = [self.loveOptions copy];
options.educationOptions = [self.educationOptions copy];
options.incomeOptions = [self.incomeOptions copy];
options.childOptions = [self.childOptions copy];
options.petOptions = [self.petOptions copy];
return options;
}
@end