Permalink
Browse files

improved wifi map

  • Loading branch information...
nst committed Nov 1, 2010
1 parent d1c8bde commit cbd44d651c7541d9fa7d72a96fcd71680437970e
Showing with 13 additions and 13 deletions.
  1. +0 −2 Classes/SPSourceWifiTVC.m
  2. +0 −2 Classes/SPWifiMapVC.h
  3. +13 −9 Classes/SPWifiMapVC.m
@@ -21,8 +21,6 @@ @implementation SPSourceWifiTVC
- (void)loadData {
- //[OUILookupTool lookupBSSID:@"0:30:bd:97:7:72" delegate:self];
-
if(contentsDictionaries) return;
UIBarButtonItem *mapButton = [[UIBarButtonItem alloc] initWithTitle:@"Map" style:UIBarButtonItemStylePlain target:self action:@selector(mapButtonClicked:)];
View
@@ -17,8 +17,6 @@
@property (nonatomic, retain) NSArray *annotations;
-//- (void)addAnnotation:(id <MKAnnotation>)annotation;
-
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation;
@end
View
@@ -30,21 +30,21 @@ - (void)loadView {
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
-
- [mapView removeAnnotations:annotations];
-}
-
-- (void)viewDidAppear:(BOOL)animated {
- [super viewDidAppear:animated];
-
+
+ [mapView removeAnnotations:mapView.annotations];
[mapView addAnnotations:annotations];
id <MKAnnotation>annotation = [annotations lastObject];
MKCoordinateSpan span = MKCoordinateSpanMake(0.03, 0.03);
MKCoordinateRegion region = [mapView regionThatFits:MKCoordinateRegionMake(annotation.coordinate, span)];
- [mapView setRegion:region animated:NO];
-
+ [mapView setRegion:region animated:NO];
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+
+
if([annotations count] == 1) [mapView selectAnnotation:[annotations lastObject] animated:YES];
}
@@ -70,6 +70,10 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
}
*/
+- (void)mapView:(MKMapView *)aMapView didAddAnnotationViews:(NSArray *)views {
+ [aMapView selectAnnotation:[aMapView.annotations lastObject] animated:YES];
+}
+
- (void)dealloc {
[annotations release];
[super dealloc];

0 comments on commit cbd44d6

Please sign in to comment.