TileIssueViewController.m
1.65 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
//
// TileIssueViewController.m
// TileIssue
//
// Created by olivier on 4/8/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#include <unistd.h>
#import "TileIssueViewController.h"
@implementation TileIssueViewController
@synthesize mapView;
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
CLLocationCoordinate2D latlong;
latlong.latitude = 43.61675;
latlong.longitude = 6.97167;
RMMapView *map = [[[RMMapView alloc] initWithFrame:CGRectMake(0.0, 0.0, [[UIScreen mainScreen] applicationFrame].size.width, [[UIScreen mainScreen] applicationFrame].size.height-79)] autorelease];
[self setMapView:map];
[self.mapView setZoom:18];
self.view = mapView;
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[NSThread detachNewThreadSelector: @selector(moveThread:) toTarget:self withObject:nil];
}
- (void)moveThread:(id)someLocation
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CLLocationCoordinate2D latlong;
latlong.latitude = 43.61675;
latlong.longitude = 6.97167;
double s=1;
for (int i=0; i<2; i++)
{
sleep(3);
latlong.longitude += s*0.002;
NSValue *vlocation= [NSValue value:&latlong withObjCType:@encode(CLLocationCoordinate2D)];
[self performSelectorOnMainThread:@selector(moveToLatLon:) withObject:vlocation waitUntilDone:NO];
s = -s;
}
[pool drain];
}
- (void)moveToLatLon:(NSValue *)vlocation
{
CLLocationCoordinate2D location;
[vlocation getValue:&location];
[mapView setCenterCoordinate:location];
}
- (void)dealloc
{
[mapView release];
[super dealloc];
}
@end