Added thread for changing location
Showing
1 changed file
with
76 additions
and
66 deletions
1 | -// | ||
2 | -// TileIssueViewController.m | ||
3 | -// TileIssue | ||
4 | -// | ||
5 | -// Created by olivier on 4/8/09. | ||
6 | -// Copyright 2009 __MyCompanyName__. All rights reserved. | ||
7 | -// | ||
8 | - | ||
9 | -#import "TileIssueViewController.h" | ||
10 | - | ||
11 | - | ||
12 | -@implementation TileIssueViewController | ||
13 | - | ||
14 | -@synthesize mapView; | ||
15 | - | ||
16 | - | ||
17 | -// Implement loadView to create a view hierarchy programmatically, without using a nib. | ||
18 | -- (void)loadView | ||
19 | -{ | ||
20 | - CLLocationCoordinate2D latlong; | ||
21 | - | ||
22 | - latlong.latitude = 75.715633; | ||
23 | - latlong.longitude =-128.935547; | ||
24 | - | ||
25 | - RMMapView *map = [[RMMapView alloc]initWithFrame:CGRectMake(0.0, 0.0, [[UIScreen mainScreen]applicationFrame].size.width, [[UIScreen mainScreen]applicationFrame].size.height-79) WithLocation:latlong]; | ||
26 | - [self setMapView:map]; | ||
27 | - [map release]; | ||
28 | - [[[self mapView] contents]setZoom:16]; | ||
29 | - | ||
30 | - self.view = mapView; | ||
31 | -} | ||
32 | - | ||
33 | - | ||
34 | - | ||
35 | -// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | ||
36 | -- (void)viewDidLoad { | ||
37 | - CLLocationCoordinate2D latlong; | ||
38 | - | ||
39 | - latlong.latitude = -29.210278; | ||
40 | - latlong.longitude =-59.680000; | ||
41 | - | ||
42 | - [mapView moveToLatLong:latlong]; | ||
43 | -} | ||
44 | - | ||
45 | - | ||
46 | -/* | ||
47 | -// Override to allow orientations other than the default portrait orientation. | ||
48 | -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | ||
49 | - // Return YES for supported orientations | ||
50 | - return (interfaceOrientation == UIInterfaceOrientationPortrait); | ||
51 | -} | ||
52 | -*/ | ||
53 | - | ||
54 | -- (void)didReceiveMemoryWarning { | ||
55 | - [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview | ||
56 | - // Release anything that's not essential, such as cached data | ||
57 | -} | ||
58 | - | ||
59 | - | ||
60 | -- (void)dealloc { | ||
61 | - [mapView release]; | ||
62 | - [super dealloc]; | ||
63 | -} | ||
64 | - | ||
65 | - | ||
66 | -@end | 1 | +// |
2 | +// TileIssueViewController.m | ||
3 | +// TileIssue | ||
4 | +// | ||
5 | +// Created by olivier on 4/8/09. | ||
6 | +// Copyright 2009 __MyCompanyName__. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "TileIssueViewController.h" | ||
10 | + | ||
11 | + | ||
12 | +@implementation TileIssueViewController | ||
13 | + | ||
14 | +@synthesize mapView; | ||
15 | + | ||
16 | + | ||
17 | +// Implement loadView to create a view hierarchy programmatically, without using a nib. | ||
18 | +- (void)loadView | ||
19 | +{ | ||
20 | + CLLocationCoordinate2D latlong; | ||
21 | + | ||
22 | + latlong.latitude = 75.715633; | ||
23 | + latlong.longitude =-128.935547; | ||
24 | + | ||
25 | + RMMapView *map = [[RMMapView alloc]initWithFrame:CGRectMake(0.0, 0.0, [[UIScreen mainScreen]applicationFrame].size.width, [[UIScreen mainScreen]applicationFrame].size.height-79) WithLocation:latlong]; | ||
26 | + [self setMapView:map]; | ||
27 | + [map release]; | ||
28 | + [[[self mapView] contents]setZoom:16]; | ||
29 | + | ||
30 | + self.view = mapView; | ||
31 | +} | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | +// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | ||
36 | +- (void)viewDidLoad | ||
37 | +{ | ||
38 | + [NSThread detachNewThreadSelector: @selector(geocodeThread:) toTarget:self withObject:nil]; | ||
39 | +} | ||
40 | + | ||
41 | +- (void)geocodeThread:(id)someLocation | ||
42 | +{ | ||
43 | + | ||
44 | + NSAutoreleasePool *pool = [ [ NSAutoreleasePool alloc ] init ]; | ||
45 | + | ||
46 | + CLLocationCoordinate2D latlong; | ||
47 | + | ||
48 | + latlong.latitude = -29.210278; | ||
49 | + latlong.longitude =-59.680000; | ||
50 | + [mapView moveToLatLong:latlong]; | ||
51 | + | ||
52 | + [pool release]; | ||
53 | + | ||
54 | +} | ||
55 | + | ||
56 | +/* | ||
57 | +// Override to allow orientations other than the default portrait orientation. | ||
58 | +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | ||
59 | + // Return YES for supported orientations | ||
60 | + return (interfaceOrientation == UIInterfaceOrientationPortrait); | ||
61 | +} | ||
62 | +*/ | ||
63 | + | ||
64 | +- (void)didReceiveMemoryWarning { | ||
65 | + [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview | ||
66 | + // Release anything that's not essential, such as cached data | ||
67 | +} | ||
68 | + | ||
69 | + | ||
70 | +- (void)dealloc { | ||
71 | + [mapView release]; | ||
72 | + [super dealloc]; | ||
73 | +} | ||
74 | + | ||
75 | + | ||
76 | +@end |
-
Please register or login to post a comment