Search Results

Search found 271 results on 11 pages for 'mapview'.

Page 7/11 | < Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >

  • Storing an subtitle on an annotation with NSUserDefualts

    - by Krismutt
    Hey everybody! Basically: what i try to do is to save the street address of an annotation so that when I quit the application and launch it again the street address still will be there...see the following code: SavePosition.m -(NSString *)subtitle{ if (!subtitle) { return @"Ingen gata i närheten"; } else { return subtitle; } } -(NSString *)title{ return @"Sparad Position"; } -(id)initWithCoordinate:(CLLocationCoordinate2D) coor{ self.coordinate=coor; NSLog(@"%f,%f",coor.latitude,coor.longitude); return self; } - (void)setCoordinate:(CLLocationCoordinate2D)koor { MKReverseGeocoder *geocoder = [[[MKReverseGeocoder alloc] initWithCoordinate:koor] autorelease]; geocoder.delegate = self; coordinate = koor; [geocoder start]; } - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error { NSLog(@"fail %@", error); } - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark { self.subtitle = [placemark.addressDictionary valueForKey:@"Street"]; } -(void)applicationWillTerminate:(UIApplication *)application { NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults]; [userDef setValue:subtitle forKey:@"SavedAddress"]; [userDef setBool:YES forKey:@"Street"]; [userDef synchronize]; } @end mainViewController.m -(void)viewDidLoad { [super viewDidLoad]; NSUserDefaults *userDef = [NSUserDefaults standardUserDefaults]; if ([userDef boolForKey:@"sparadKoordinat-existerar"]) { CLLocationCoordinate2D savedCoordinate; savedCoordinate.latitude = [userDef doubleForKey:@"sparadKoordinat-latitud"]; savedCoordinate.longitude = [userDef doubleForKey:@"sparadKoordinat-longitud"]; SparaPosition *position=[[SparaPosition alloc] initWithCoordinate:savedCoordinate]; [mapView addAnnotation:position]; savedPosition = savedCoordinate; raderaSparad.enabled=YES; skickaMaps.enabled=YES; mStoreLocationButton.enabled=NO; friZoom = NO; NSString *savedAddress = [[NSUserDefaults standardUserDefaults] objectForKey:@"SavedAddress"]; if (savedAddress) { savedAddress.subtitle = [userDef valueForKey:@"Street"]; // what code should I add here? } MKCoordinateRegion region; region.center.latitude = savedCoordinate.latitude; region.center.longitude= savedCoordinate.longitude; MKCoordinateSpan span; span.latitudeDelta = 0.01; span.longitudeDelta = 0.01; region.span = span; region = [mapView regionThatFits:region]; [mapView setRegion:region animated:YES]; [mapView setRegion:region animated:TRUE]; }

    Read the article

  • iPhone Map issue

    - by Shibin Moideen
    Hi all, I am working on a map application in iPhone. While loading the MapViewController the map is not loaded automatically in the mapView, When we drag the mapView the area outside the intial view is loaded. Also when we double tap on the map it get start loading. Can anybody help me fixing this.? Thanks in Advance, Shibin

    Read the article

  • MKMapView maptype not changing!

    - by TheLearner
    I cannot understand why my MKMapView does not want to change to satellite view. This method is called and case 1 is called I have stepped over it but it simply does not change to satellite type it always changes to standard. It only works when it goes back to Map type. Anyone have any ideas? - (IBAction)mapSatelliteSegmentControlTapped:(UISegmentedControl *)sender { switch (sender.selectedSegmentIndex) { case 1: //Satellite self.mapView.mapType = MKMapTypeSatellite; default: //Map self.mapView.mapType = MKMapTypeStandard; } }

    Read the article

  • Android: Map Overlay Labels

    - by karnage
    I am building a MapView and I want my custom overlay items to display the name of the location they are marking when the user taps them, like the Android Maps app. I setup the onTap listener and the floating TextView to hold the location name. I still need to set it up so that it redraws the label when the user moves the map, etc. Anyway, I am wondering if I am reinventing the wheel here. Is there a built-in method I am unaware of? I would think that most implementations of MapView have labels. For reference, my implementation so far: in map xml: <LinearLayout android:id="@+id/mapBubbleWrap" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true"> <TextView android:id="@+id/mapBubble" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" android:background="#ffffff" android:textColor="#ff0000"/> </LinearLayout> in my extended ItemizedOverlay: public boolean onTap(int index) { this.setFocus( mOverlays.get(index) ); return true; } in my Activity onFocus: public void onFocusChanged( ItemizedOverlay overlay, OverlayItem item ) { if( item != null) { mapBubble.setText(item.getTitle()); Point newPoint = mapView.getProjection().toPixels(item.getPoint(), null); mapBubbleWrap.setPadding(newPoint.x, newPoint.y-10, 0, 0); mapBubble.setVisibility(View.VISIBLE); } }

    Read the article

  • Multiple overlay items in android

    - by Bostjan
    I seem to be having a problem with using ItemizedOverlay and OveralyItems in it. I can get the first overlayItem to appear on the map but not any items after that. Code sample is on: http://www.anddev.org/multiple_overlay_items-t12171.html Quick overview here: public class Markers extends ItemizedOverlay { private Context ctx; private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>(); public Markers(Drawable defaultMarker, Context cont) { super(boundCenterBottom(defaultMarker)); this.ctx = cont; // TODO Auto-generated constructor stub } @Override protected OverlayItem createItem(int i) { // TODO Auto-generated method stub return mOverlays.get(i); } @Override public boolean onTap(GeoPoint p, MapView mapView) { // TODO Auto-generated method stub return super.onTap(p, mapView); } @Override protected boolean onTap(int index) { // TODO Auto-generated method stub Toast.makeText(this.ctx, mOverlays.get(index).getTitle().toString()+", Latitude: "+mOverlays.get(index).getPoint().getLatitudeE6(), Toast.LENGTH_SHORT).show(); return super.onTap(index); } @Override public int size() { // TODO Auto-generated method stub return mOverlays.size(); } public void addOverlay(OverlayItem item) { mOverlays.add(item); setLastFocusedIndex(-1); populate(); } public void clear() { mOverlays.clear(); setLastFocusedIndex(-1); populate(); }} Markers usersMarker = new Markers(user,overview.this); GeoPoint p = new GeoPoint((int) (lat * 1E6),(int) (lon * 1E6)); OverlayItem item = new OverlayItem(p,userData[0],userData[3]); item.setMarker(this.user); usersMarker.addOverlay(item); The lines after the class are just samples of how it's used the first marker shows up on the map but if I add any more they don't show up? Is there a problem with the populate() method? I tried calling it manually after adding all markers but it still didn't help. Please, if you have any idea what could be wrong, say so.

    Read the article

  • OSMDroid simple example required

    - by Bex
    Hi! I am trying to create an app that uses offline maps and custom tiles. For this I have decided to use OSMDroid and have included the jar within my project. I will create my custom tiles using MOBAC. I have been directed to these examples: http://code.google.com/p/osmdroid/source/browse/#svn%2Ftrunk%2FOpenStreetMapViewer%2Fsrc%2Forg%2Fosmdroid%2Fsamples but I am struggling to follow them as I am new to both java and android. I have created a class file called test (which I have created following an example!): public class test extends Activity { /** Called when the activity is first created. */ protected static final String PROVIDER_NAME = LocationManager.GPS_PROVIDER; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MapView map = (MapView) findViewById(R.id.map); map.setTileSource(TileSourceFactory.MAPQUESTOSM); map.setBuiltInZoomControls(true); map.setMultiTouchControls(true); map.getController().setZoom(16); map.getController().setCenter(new GeoPoint(30266000, -97739000)); } } with a layout file: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <org.osmdroid.views.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" tilesource="MapquestOSM" android:layout_weight="1" /> </LinearLayout> When I run this I see no map, just an empty grid. I think this is due to my tilesource but I'm not sure what I need to change it to. Can anyone help? Bex

    Read the article

  • iphone zoom to user location on mapkit

    - by satyam
    I'm using map kit and showing user's location using "showsUserLocation" I"m using following code to zoom to user's location, but not zooming. Its zooming to some location in Africa, though the user location on map is showing correct. MKCoordinateRegion newRegion; MKUserLocation* usrLocation = mapView.userLocation; newRegion.center.latitude = usrLocation.location.coordinate.latitude; newRegion.center.longitude = usrLocation.location.coordinate.longitude; newRegion.span.latitudeDelta = 20.0; newRegion.span.longitudeDelta = 28.0; [self.mapView setRegion:newRegion animated:YES]; Why is user's location correctly showing and not zooming properly. Can some one correct me please?

    Read the article

  • How to intercept touches events on a MKMapView or UIWebView objects?

    - by Martin
    Hello, I'm not sure what i'm doing wrong but I try to catch touches on a MKMapView object. I subclassed it by creating the following class : #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface MapViewWithTouches : MKMapView { } - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event; @end And the implementation : #import "MapViewWithTouches.h" @implementation MapViewWithTouches - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event { NSLog(@"hello"); //[super touchesBegan:touches withEvent:event]; } @end But it looks like when I use this class, I see nothing on the Console : MapViewWithTouches *mapView = [[MapViewWithTouches alloc] initWithFrame:self.view.frame]; [self.view insertSubview:mapView atIndex:0]; Any idea what I'm doing wrong? Heelp! :) Thanks a lot! Martin

    Read the article

  • Android Map Performance poor because of many Overlays?

    - by Dave
    Hi, I have a map in my android application that shows many markers (~20-50). But the app performs very poor when i try to scroll/zoom (in Google Android Maps i did a sample search for pizza and there were also some 20-50 results found and i didn't notice any particular performance problems when zooming/scrolling through the map). Here is my (pseudo)code: onCreate() { .... drawable = this.getResources().getDrawable(R.drawable.marker1); itemizedOverlay = new MyItemizedOverlay(drawable,mapView); ... callWebServiceToRetrieveData(); createMarkers(); } createMarkers(){ for(elem:bigList){ GeoPoint geoPoint = new GeoPoint((int)(elem.getLat()*1000000), (int) (elem.getLon()*1000000)); OverlayItem overlayItem = new OverlayItem(geoPoint, elem.getName(), elem.getData()); itemizedOverlay.addOverlay(overlayItem); mapOverlays.add(itemizedOverlay); } mapView.invalidate(); } the MyItemizedOverlay.addOverlay looks like this: public void addOverlay(OverlayItem overlay) { m_overlays.add(overlay); populate(); }

    Read the article

  • Are tile overlays possible with the iPhone's MapKit

    - by rickharrison
    I already have a tile source set up for use with the Google Maps JavaScript API. I am trying to translate this for use with the iPhone MapKit. I have correctly implemented the javascript zooming levels into mapkit. Whenever - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated is called, I snap the region to the nearest zoom level based on the same center point. Is it possible to implement a solution possibly with CATiledLayer to implement a tiling solution. Does the iPhone use the standard 256x256 tiles like google maps does natively? Any direction or help on this would be greatly appreciated. I would rather not waste a couple weeks trying to implement this if it's not possible.

    Read the article

  • Creating a dynamic (video) Overlay on Google Maps on Android 2.1

    - by Soumya
    I'm trying to create a map overlay for displaying a video stream (MJPEG) on top of a Mapview. Currently I've a standalone activity that creates a data thread for fetching MJPEG video frames. I'm using a handler to send a frame (as a Bitmap) from the data thread to the main activity which then updates the UI. I'm not sure how I can implement "refresh" for updating my "overlayed" video stream. EDIT: What I mean by "refresh" is - how can I update the video portion (not the mapview) of my UI whenever I get a new video frame. I plan to paint the video frame (bitmap) in the "draw method" of my implementation of the Overlay subclass. But the "draw" method is not invoked by me directly. Thanks.

    Read the article

  • Annotation Title/Subtitle under Pins

    - by ludo
    Hi, I use the Map to display some pin location from my database, everything is working fine. After that I use a pickerView to let the user display some specific pins. So I remove all the Pins first with [mapView removeAnnotations:mapView.anotations]; and display new Pins. There is like 100 of news pins, my problem is when I click on a Pin, the Title and subtitle are display under the others pins. Someone got the same problem? Thanks, P.S: Don't know if its relevant but I add a custom image for the pins.

    Read the article

  • Slide in the second tab bar view by clicking on item in the first

    - by Henrik Erlandsson
    I have an app with three tabs that switch views instantaneously when the user taps them. The first view is a table view selecting which 'location type' to filter by, to only show those pins (add those annotations) to the second view, a MapView. When a table cell is clicked, it switches instantaneously to the mapview, using this code: self.tabBarController.selectedIndex=1; However, I would like to do this with a slide-in-from-right animation, like the one you get when drilling down a hierarchy of table views. I tried this: [self.navigationController pushViewController:[self.tabBarController.viewControllers objectAtIndex:1] animated:YES]; which compiles without error or warning, but does not switch views. How do I 'apply' a navigation controller 'onto' a tab bar controller? Or is there some way to select another viewcontroller and specify an animation?

    Read the article

  • Toubleshooting mapkit performance

    - by brettr
    I'm plotting over 500 points on a map using mapkit. Zooming is a little jittery compared to the native google map app. I've discovered what is causing the slowness. I'm adding custom annotations so that I can later add different pin colors and buttons for detail views: - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(AddressNote *) annotation { MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentlocation"]; annView.pinColor = MKPinAnnotationColorGreen; annView.animatesDrop=TRUE; annView.canShowCallout = YES; annView.calloutOffset = CGPointMake(-5, 5); return annView; } If I comment out the above code, everything works fine. Very smooth with zooming in/out. Should I be adding annotations differently to boost performance?

    Read the article

  • MKMapView not calling delegate methods

    - by criscokid
    In a UIViewController I add a MKMapView to the view controlled by the controller. - (void)viewDidLoad { [super viewDidLoad]; CGRect rect = CGRectMake(0, 0, 460, 320); map = [[MKMapView alloc] initWithFrame:rect]; map.delegate = self; [self.view addSubview:map]; } Later in the controller I have - (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView { NSLog(@"done."); } Done never gets printed. None of the other delegate methods get called either like mapView:viewForAnnotation: I use a MKMapView in an another app, but this seems to happen on any new application I make. Has anyone else seen this behavior? EDIT: The problem seems to be when UIViewController is made the delegate of the MKMapView, a direct subclass of NSObject seems to work okay. I can work around like this, still seems very odd since I've done it before.

    Read the article

  • "Don't Allow" in LocationManager keeps logging errors

    - by stephanie.moreau
    I have an app that checked for location. It asks the user to use location and if the user says no on the menu there is an issue when i load the mapview. Once i select the mapView it asks for the user location again. If the user says no again my console keeps displaying errors/warning as well as my NSLog from the "didFailWithError" of my location Manager class. Is there a way of stopping the LocationManage:didFailWithErrors if the user has already said no? I don't think Apple would accept my app if the Log file gets filled up my the LocationManager Here is an example of what gets repeated in the console ERROR,Time,290362745.002,Function,"void CLClientHandleDaemonDataRegistration(__CLClient*, const CLDaemonCommToClientRegistration*, const __CFDictionary*)",server did not accept client registration 1 WARNING,Time,290362745.005,Function,"void CLClientHandleDaemonInvalidation(__CFMessagePort*, void*)",client 1035.0 has been disconnected from daemon 2010-03-15 12:19:05.002 SAQ[1035:207] LocationManager Error Denied by user

    Read the article

  • iPhone Map: Identifying Users Location

    - by senfo
    I have a number of annotations on my map, in addition to the users current location. This works fine, except the default color for the users current location is the same as all of the other annotations. I'd like to make the pin green for the users current location so that it's uniquely identifiable from the other pins. How do I do this? Bellow is the method I've been using (I can't find a way to determine which annotation is the users current location): - (MKAnnotationView *)mapView:(MKMapView *)mapViewLocal viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"Pin"; MKPinAnnotationView *pinView = (MKPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; if (pinView == nil) { pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier] autorelease]; pinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; pinView.animatesDrop = YES; pinView.canShowCallout = YES; } else { pinView.annotation = annotation; } return pinView; }

    Read the article

  • showing current location ,along with another location in iphone

    - by ratnasomu
    hellow all, in xcode whenever we load a mapview ,it automaticallay shows the current user location right. In my case i am showing another location on map ,such that the map loads the current location and zoomed to the location i have given .. but, the current location point was not showing (the blue one which comes automaticay..). i have given mapView.showCurrentLocation=TRUE; but its not showing . so could any one tells the way it works and it should say the current location mark and then zoomed to the point i have given. Thanks

    Read the article

  • Android : Hello, Views > Google Map View Tuorial

    - by Tom
    Hi, I'm trying to complete the Android MapView tutorial @ www.developer.android.com/resources/tutorials/views/hello-mapview.html I think I've done the entire thing correctly but I'm getting an error message in Eclipse. I'm sure why. The problematic line of code is private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>(); I'm relatively new to Java but I've gone through the forums of different things and I really have no idea on this one. I've [attached][2] a screen shot of the development environment - hopefully it wont be anything too obvious or hard to fix either! http://lh5.ggpht.com/_sqCs2rXr5hQ/S-CJf4x9ZUI/AAAAAAAAAHI/IR-kTcOnfU8/s144/hellogooglemaps.jpg Cheers Tom :)

    Read the article

  • My map callouts don't display the image when clicked

    - by Neelam Khan
    I am developing an iPhone application for a university project and I'm new to iPhone development. I have looked through Apple's MapCallouts code but it doesn't seem feasible to implement it. So far my code displays a map, drops annotations, displays the title and it displays the right call out button. But this is where I encounter problems. When I press on the callout button, it displays a blank view controller but it should display a different image for every callout that's tapped and this isn't happening so far. I have added my code below: - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { //NSUInteger tag = ((UIButton *)control).tag; if (self.detailController==nil) { DetailViewController* detailViewController = [[DetailViewController alloc] init]; [self.navigationController pushViewController:detailViewController animated:YES]; } // self.detailController.tag =1; //to identify image required // self.detailController.tag = tag; [self.navigationController pushViewController:detailController animated:YES]; }

    Read the article

  • iphone simulator crashes when it tries to access user location

    - by kevin Mendoza
    for some reason my code causes my program to crash. does anyone know why or how to fix it? NSLog(@"here"); CLLocation *location = [locationManager location]; [mapView removeAnnotations:mapView.annotations]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; CLLocationCoordinate2D workingCoordinate = [location coordinate]; NSLog(@" this is %@", workingCoordinate.latitude); it makes it to the first NSLog, but somewhere between the first and second it crashes. My guess is that it has to do with the CLLocation *location line.

    Read the article

  • How to get the Zoom Levels and Lat and Long values of the Map when Zoom in/out.

    - by ChandraSekhar
    I am implement an application based on the MapKit using iphone sdk.I just now a method to get the event when we drag, zoom in/out on the map. The method is as like this (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated Now I need to get the following bullets. 1.TopLeft's and Bottom Right's Latitude and longitude values. 2.Center of the Map. 3.zoom level. Please give me suggessions to solve the above 3 use cases. Thanks in Advance, Sekhar Bethalam.

    Read the article

  • preventing selection on MKPointAnnotation

    - by Derek
    Is there a way to prevent an annotation in a MKMapView instance from being enabled. In other words, when the user taps the red pin on the map, is there a way to prevent it from highlighting the pin. Right now the pin turns dark when touched... Edit: I'm using the following code to return the MKPinAnnotationView // To future MKMapView users - Don't forget to set _mapView's delegate _mapView.delegate = self; _annotation = [[MKPointAnnotation alloc] init]; _annotation.coordinate = myLocation; [_mapView addAnnotation:_annotation]; -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{ MKPinAnnotationView *pin = [[MKPinAnnotationView alloc] initWithAnnotation:_annotation reuseIdentifier:@"id"]; pin.enabled = NO; return pin; }

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11  | Next Page >