forked from thermogl/TITokenField
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TIContact.m
72 lines (57 loc) · 1.1 KB
/
TIContact.m
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
//
// TITokenContact.m
// TokenFieldExample
//
// Created by Lin Junjie on 13/11/12.
//
//
#import "TIContact.h"
@implementation TIContact
+ (id)contactWithName:(NSString *)name
email:(NSString *)email
label:(NSString *)label
{
TIContact *contact =
[[TIContact alloc] initWithName:name email:email label:label];
return contact;
}
- (id)init
{
return [self initWithName:@"" email:@"" label:@""];
}
- (id)initWithName:(NSString *)name
email:(NSString *)email
label:(NSString *)label
{
self = [super init];
if (self)
{
_fullName = [name copy];
_email = [email copy];
_emailLabel = [label copy];
}
return self;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"TITokenContact: %@ (email: %@, %@ / phone: %@, %@)",
self.fullName, self.email, self.emailLabel, self.phone, self.phoneLabel];
}
#pragma mark -
- (NSString *)phoneLabel
{
if (!_phoneLabel)
{
_phoneLabel = [TICONTACT_DEFAULT_LABEL copy];
}
return _phoneLabel;
}
- (NSString *)emailLabel
{
if (!_emailLabel)
{
_emailLabel = [TICONTACT_DEFAULT_LABEL copy];
}
return _emailLabel;
}
@end