I am using the route-me files found at https://github.com/route-me/route-me to build a offline map application for iPhones.
I have the map working offline and also successfully implemented "current location" button that will show the users location on the map with a marker.
Now, I want to be able to let the users be able to drop "pins" on the map so that users can get the coordinates of the "pins" that user just dropped on the map. (separate from the current location)
I have tried to look for tutorials and other helpful documents on Google but all the information that I've found are using the MapKit lib and framework
If any of you are expert on route-me and using RMMapView to make offline maps, it would be awesome if you guys can help me out.
Thanks
For droping pins on RMMapview , this is required snippet of code used in - (void)viewDidLoad after creating RMMapview
RMMarkerManager *markerManager = [[[RMMarkerManager alloc] initWithContents: mapView]autorelease];
RMMarker *marker = [[RMMarker alloc]initWithUIImage:[UIImage imageNamed:#"marker-blue.png"] anchorPoint:CGPointMake(0.5, 1.0)];
[marker setTextForegroundColor:[UIColor blueColor]];
[markerManager addMarker:marker AtLatLong:(CLLocationCoordinate2D){40.988,23.098}];
[marker release];
Related
I'm using route-me (Alpstein fork) to show a map with user's location. It was working until I updated both Xcode and route-me recently. Now if I set :
mapView.showsUserLocation = YES;
mapView.userTrackingMode = RMUserTrackingModeFollowWithHeading;
Nothing happens. I downloaded the Mapbox-me project (https://github.com/mapbox/mapbox-me) to test if it is working with Mapbox, and it's not. I'm using the simulator for testing. The user location in iOS's Maps app is working, so the simulator seems to be able to send a position.
Is anyone facing the problem ?
Well, I was not looking in the good direction, the problem was absolutely not related to MapBox / route-me but to iOS 8 ...
To receive any location update we now need to add one of the following entries in the .plist :
NSLocationAlwaysUsageDescription (if your app needs location even in background)
NSLocationWhenInUseUsageDescription (if your app only need location when in foreground)
And we need to gently ask the user's permission by doing one of these calls (before asking MapView to display the user's position) :
if([_locationManager respondsToSelector:#selector(requestAlwaysAuthorization)]) [_locationManager requestAlwaysAuthorization];
if([_locationManager respondsToSelector:#selector(requestWhenInUseAuthorization)]) [_locationManager requestWhenInUseAuthorization];
If you don't, you will get no error, no warning - and no location update... I definitely love Android development !
I am making iPhone application in which i am using UIMapKit. I have a static pointer (Arrow) in the middle of screen of iPhone and behind that Pointer i am using iOS maps in which user interaction is enable , means user can move the map can zoom in or zoom out the map.
My task is to get the longitude and latitude of that location which comes under my Screen Pointer(Arrow)
Can anyone help me how can i do achieve this. I have very good command on UIMap i just need a idea
You can get middle point of screen using :
CGPoint screenCenterPoint = self.view.center;
and then convert it to coordinates using :
CLLocationCoordinate2D mapCenterPoint = [self.view convertPoint:screenCenterPoint toCoordinateFromView:self.view];
If you use Google maps then you can use this ,too :
CLLocationCoordinate2D mapCenterPoint = [self.mapView.projection coordinateForPoint: screenCenterPoint];
To learn more look at GMSProjection and GMSMapView.
The necessary functionality is built in to MapView.
CLLocationCoordinate2D pinCoordinate = [self.pickupLocationView convertPoint:CGPointMake(self.pickupLocationView.frame.size.width / 2, self.pickupLocationView.frame.size.height) toCoordinateFromView:self.view];
This is UIKit as the poster requested. I believe Akash's solution would work if the question was about Google's map.
I'm developing app for IPhones where users clicks button, gets the list of all videos from his IPhone and uploads chosen video to server.
I know how to upload video to server, but I don't know how to implement video searching.
How can I get pathes to all videos (in users IPhone) in Array?
(Currently my IPhone is unavailable for use, so I'd like to know also how to test video search in IPhone Simulator?)
Kind Regards
You need to use the UIImagePickerController component, configuring it to show only videos when browsing the library.
You can do that by setting the mediaTypes property of the picker in this way:
myImagePickerController.mediaTypes =
[[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
Then if you want to test it in the simulator, you need to save some videos on it and you can use the UISaveVideoAtPathToSavedPhotosAlbum function to achieve that. Check out this great answer for more detailed instructions.
This link shows how to access only videos from the photoroll since all videos of the device should be stored there, you should be able to access them from there: Picking video from PhotoLibrary with UIImagePickerController in OS 3.1
I am showing a map view using MapKit framework in my iPhone application. I am also showing the particular friends list Pin point in map view based on the location they are. I would like to enhance now to showing the road map direction from my location to a particular selected friend location. I know the lat and long for both source and destination, but i have draw route line in road direction, it should be road direction. Could someone help me on this?
Thank you!
MapKit does not expose a means of performing driving directions. So, it's not as simple as asking the map to display a course from location A to location B. You have two options:
1) Integrate with Google's API to get the driving directions, and overlay your own lines onto the MapKit map.
or
2) Simply direct your users out of app and delegate this functionality to the built in Map app.
I have no experience with the former, but the later is very easy. Simply:
CLLocationCoordinate2D location = [[map userLocation] location].coordinate;
double currentLat = location.latitude;
double currentLong = location.longitude;
NSString *googleUrl = [[NSString alloc] initWithFormat:#"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", currentLat, currentLong, item.latitude, item.longitude];
NSLog(#"%#", googleUrl);
[[UIApplication sharedApplication] openURL:[[NSURL alloc] initWithString:googleUrl]];
Actually there is no api supported by iPhone sdk to draw route on map. There a repo on github which is using google maps api to draw route on map by using map overlay. It has some limitation but you can take help from this repo - https://github.com/kishikawakatsumi/MapKit-Route-Directions
This application and this application says it displays live wallpapers on lock screen. We have similar requirement.
From reviews came to know that it is playing music in background with silent volume, but it is not relevant to setting wallpapers.
Totally bummer topic for us. Can anyone please suggest some point where to begin.. ?
Referred this and Referred this questions on our forum, but says that it won't be approved by Apple. So how does current application exist on store ?
Note:
Please consider this as genuine programming questions as there is no starting point we can find.
If you play music, you can use MPNowPlayingInfoCenter (Available in iOS 5.0 and later.) to set things like cover art, title and artist on the lock screen. Your code could look like this:
NSMutableDictionary *currentTrackData = [[NSMutableDictionary alloc] init];
[currentTrackData setObject:"Some text" forKey:MPMediaItemPropertyTitle];
MPMediaItemArtwork *mediaItemArtwork =[[MPMediaItemArtwork alloc] initWithImage:[UIImage imageNamed:#"your image path"]];
[currentTrackData setObject:mediaItemArtwork forKey:MPMediaItemPropertyArtwork];
[mediaItemArtwork release];
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = currentTrackData;
Dont forget to import the media player framework:
#import <MediaPlayer/MediaPlayer.h>
The live lockscreen app must be doing it this way (MPNowPlayingInfoCenter) as you cant play music whilst using the app