-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContato.m
54 lines (46 loc) · 1.66 KB
/
Contato.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
//
// Contato.m
// CaelumIP67
//
// Created by Caio Incau on 30/07/12.
// Copyright (c) 2012 Caio Incau. All rights reserved.
//
#import "Contato.h"
@implementation Contato
@synthesize email,endereco,nome,site,telefone,twitter,foto,longitude,latitude;
-(CLLocationCoordinate2D)coordinate{
return CLLocationCoordinate2DMake([latitude doubleValue], [longitude doubleValue]);
}
-(NSString *)title{
return nome;
}
-(NSString *)subtitle{
return email;
}
-(id)initWithCoder:(NSCoder *)aDecoder{
self = [super init];
if(self){
[self setNome:[aDecoder decodeObjectForKey:@"nome"]];
[self setTelefone:[aDecoder decodeObjectForKey:@"telefone"]];
[self setEmail:[aDecoder decodeObjectForKey:@"email"]];
[self setEndereco:[aDecoder decodeObjectForKey:@"endereco"]];
[self setSite:[aDecoder decodeObjectForKey:@"site"]];
[self setTwitter:[aDecoder decodeObjectForKey:@"twitter"]];
[self setFoto:[aDecoder decodeObjectForKey:@"foto"]];
[self setLatitude:[aDecoder decodeObjectForKey:@"latitude"]];
[self setLongitude:[aDecoder decodeObjectForKey:@"longitude"]];
}
return self;
}
-(void)encodeWithCoder:(NSCoder *)aCoder{
[aCoder encodeObject:nome forKey:@"nome"];
[aCoder encodeObject:telefone forKey:@"telefone"];
[aCoder encodeObject:email forKey:@"email"];
[aCoder encodeObject:endereco forKey:@"endereco"];
[aCoder encodeObject:site forKey:@"site"];
[aCoder encodeObject:twitter forKey:@"twitter"];
[aCoder encodeObject:foto forKey:@"foto"];
[aCoder encodeObject:latitude forKey:@"latitude"];
[aCoder encodeObject:longitude forKey:@"longitude"];
}
@end