How to draw a map using mkmapview with driving directions between map annotations - mkmapview

I'm developing an App with some maps functionalities (among other things), I'd like to draw a map from my current location to a given destination, but I do not want to use the shareadapplication, The shared application does not have a BACK button for example and some other navigation items I already have.
I want to do it in my own viewcontroller with mkmapview on it.
I already have the code to place the pin annotations, what I need is to trace the driving directions from A to B.
The other option is to use the [[UIApplication sharedApplication] openURL:url] call to appear inside the viewcontroller window so I can keep my navigation items.
Any ideas?
thnxs

You can't do the "other option". iOS apps do not run inside windows that you can put within your app, they are full screen apps and you can make you app switch to them, but you can't make other apps switch back to yours.
So, the big question is, where are you going to get driving directions from? Check out GoogleMapsSDK, OpenStreetMap and CloudMade, because iOS maps won't give you the directions.

Related

Making and Object uniteractable

So I have a part of my game where the character is selecting an area of the map. And it opening up a panel. I have made it so that happens but an=m now stuck on the other part of it. I want only certain area of the map to be intractable, so that I can bar the player from selecting areas of the map that they aren't ready for. I have no idea how to make game objects in the game uninteractable. I have looked on Stack overflow, Youtube an d the Unity API to no success. Can someone help me with that.
How to make things un-interactable will vary depending on your situation. I'll be presuming that you're map is broken up into a grid of sorts.
The basic setup would involve a bool, probably called 'CanAccessZone'.
Then you'll need a class, to store any access info and popup logic, by popup logic I mean make the element either non-interactable or show a popup, with the shown popup being dependant on 'CanAccessZone'. This class can then be set up by your Map class when the level is loaded, or you could let the popup class grab the necessary values from the Map class.
If you're using Unity's UI buttons for the map pieces, then you could set interactable to false, until you want to let the player access the zone. If you want to display a popup informing the player that they can't access the zone, then your button will be interactable, but the click will delegate to your popup logic method.
It's a similiar principle if you're using gameobjects as buttons. You'd be using any of the OnMouse events to handle click events. https://docs.unity3d.com/ScriptReference/MonoBehaviour.html
Hopefully this'll lead you in the right direction.

Questions about Citymaps

1、I want to create a circle and set an image that customized to fill the circle,use this as a marker on the map, not only could change the image but also the color of circle anytime,what can I do to implements this function? Please look at the picture below!
2、Like your CityMaps app show,when I enlarge the map, some business icon that hide are show on the map,which are hide again while shrink the map, How to achieve this effect?
3、After I initialization the Object Marker and called the method marker.setFadeTime(3000),the software give my tips the method is no exist and I see the class Marker.java but really not find the method,Why is it so?
4、I want to add some stars beside the marker like this:
What can I do to add the stars?the label only can set the text beside the marker.
5、I want to load your maps at the fragment,not the activity that extends FragmentActivity,I found the SupportCitymapsMapFragment is no use,What I can do to complete this requirement?
6、In your apps,it is locate that place after input New York in the search box,What can i do to complete this function whatever i input?
7、During I develop the apps about the Citymaps,I found a serious problem so that your apps had happend too. When I run the apps, the program force flash back all of a sudden and I run your apps Citymaps at this time,the problems are same of the front,I found some error in logical view that is follows:15327-15374/com.map.maplbs A/libc﹕ Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 15374 (Thread-1819).
To solve the problem,I must restart my device. Why is it so?
I am a developer on the Citymaps SDK, I will do my best to answer your questions.
1) I recommend using the Android Canvas API to construct the images, and then use a Marker to display it on the map. See the documentation for details: http://developer.citymaps.com/markers
2) This is built into the Citymaps BusinessLayer. This functionality is not exposed through an API. If you wish to use the Citymaps BusinessLayer, you should create a CitymapsMapView or CitymapsMapFragment/SupportCitymapsMapFragment and it will automatically be added to your map.
3) At this time, there appears to be a known issue with the fadeTime API. Thank you for bringing this to our attention. We will fix it in an upcoming release. For now, you can animate the alpha property of the Marker.
4) Once again, the functionality of the BusinessLayer is not directly exposed. If you wish to create similar markers, I recommend you construct the image using Android's Canvas and then adding it as a Marker to the map.
5) If you wish to load the map inside of a fragment, you can accomplish this using child fragments (check Android documentation for more details). You can also accomplish this by instantiating CitymapsMapView or MapView directly and adding it to your view hierarchy either in XML or in code. However if you do this, remember to call the lifecycle methods on your map instance, or else the map will not behave properly.
6) If you wish to have a search in your app, it is up to you to implement this feature. We do not currently provide a search API out of the box.
7) Thank you for the bug report. We will investigate this issue and fix it in a future release.
If you have any more questions, feel free to ask, and thank you for using the Citymaps SDK.

Adding UIWebView to second (not first) Storyboard view controller

Getting started with xCode 4.6.3 and I'm running into a hiccup.
I've built a simple app using the UIWebView to display a local HTML file and it's contents. I used that to debug any issues with the HTML and/or image displays and I'm all set.
Now I need to recreate that within a larger project I've built with storyboards for all my navigations between multiple view controllers. My issue comes when I'm trying to control-click drag from the WebView into the ViewController.h code below the #interface like many tutorials show, and that worked fine within my smaller single view controller app. It won't do it. I know I'm missing something obvious here. Am I going to have the set up these screens (I have multiple ones to do this same way) as separate xib files and add them into my main project?
Thanks for any help and clarification.
-Chris
You can create a class called for example myWebViewController and in Interface builder add a UIWebView to it. The control+drag to the header file will work.
Every time you want a UIViewController that has a browser in it, define its class as myWebViewController in Interface Builder.
Try not to repeat code. If you see UIViewControllers or any other UIView...that do the same thing, you can group them into a class that you use over and over.

show popovers on uilabel touch in iphone

I have a number of UILabels on a single view of a iphone application ios 4.3. How to handle touch events for all these labels at one time? I wanted to show pop overs on touch of that label. I know popovers are not available on iphone and will be making my custom ones.
what i did was using UITapGestureRecognizer and adding an action #selector(labelTap:) and then doing [label addGestureRecognizer:TapGestureRecognizerObject. But when i use the same UITapGestureRecognizer for all my UIlabels only the last added label shows the tap action.
i have set userInteractionEnable to YES.
Can any one point me to the right direction?
You need to create separate UITapRecognizer for tracking different UILabel, when a UIGestureRecognizer is added to multiple views, it will only track event from last it added to. To better understand why you need different instances of UITapRecognizer, think of it as a UIView that only handles touches event but doesn't do any drawing.

Put UIActivityIndicator over UIMapView

I would like to put a UIActivityIndicator in the center of my UIMapView. I have setup plenty of spinners before, but not sure what I'm missing about the MapView that is making this difficult.
The real issue seems to be that when I try to place the UIActivityIndicator onto the UIMapView in Interface Builder, it doesn't stick or it breaks the Map View.

Resources