OK, seems to work now. Thank you. Though I would still prefer if I could just draw a circle with text inside as I could imagine having images for every possible number that could appear inside the circle could be problematic to generate.
MonoDroid/Android and Windows Phone 7 makes this possible and the overlay layer drawn on top of the map scales when you zoom in and out even though you have specified a radius. See these images for an example: http://imageshack.us/photo/my-images/18/device20110906153628.png/ http://imageshack.us/photo/my-images/801/device20110906160751.png/ This is the same effect I want. Preferably without using images. As both text and the color of the circle has to be updated sometimes. On Tue, Sep 6, 2011 at 1:11 PM, Mikkel Lønow <mloe...@gmail.com> wrote: > It's working in MonoDevelop 2.6 RC2. Get it from the updater :) Make sure to > set Build Action to Content. > Otherwise, you would have to copy them yourself. > > On Tue, Sep 6, 2011 at 13:08, Tomasz Cielecki <tom...@ostebaronen.dk> wrote: >> >> So It seems the images are not included in the .app file. My guess >> this is not what I want :D Now how do I make them jump in there >> willingly? >> >> On Tue, Sep 6, 2011 at 9:11 AM, Mikkel Lønow <mloe...@gmail.com> wrote: >> > It should be in bin/Debug/iPhoneSimulator. It's copied to the >> > simulator after compilation. >> > >> > On 06/09/2011, at 09.08, Tomasz Cielecki <tom...@ostebaronen.dk> wrote: >> > >> >> Trouble is that I am currently using the Emulator to test my app. How >> >> do I find the .app package? >> >> >> >> I am using the latest stable version of MonoDevelop. >> >> >> >> On Mon, Sep 5, 2011 at 3:45 PM, Mikkel Lønow <mloe...@gmail.com> wrote: >> >>> Right click / Ctrl click / two finger tab on the .app package and >> >>> select >> >>> Show Package Contents. >> >>> What version of MonoDevelop are you using? >> >>> >> >>> On Mon, Sep 5, 2011 at 15:42, Tomasz Cielecki <tom...@ostebaronen.dk> >> >>> wrote: >> >>>> >> >>>> How do I make sure that they are actually copied into the .app >> >>>> package? >> >>>> >> >>>> On Mon, Sep 5, 2011 at 3:39 PM, Mikkel Lønow <mloe...@gmail.com> >> >>>> wrote: >> >>>>> At first glance it looks correct. >> >>>>> Is Build Action for pin.png set to Content? Can you make sure they >> >>>>> are >> >>>>> actually copied to the .app package? (there's a bug in some versions >> >>>>> of >> >>>>> MonoDevelop where images would not be copied). >> >>>>> Mikkel >> >>>>> P.S. Replied to all. >> >>>>> On Mon, Sep 5, 2011 at 15:32, Tomasz Cielecki >> >>>>> <tom...@ostebaronen.dk> >> >>>>> wrote: >> >>>>>> >> >>>>>> I think your suggestion is more or less the same way I am >> >>>>>> implementing >> >>>>>> it. >> >>>>>> >> >>>>>> Code can be seen here https://gist.github.com/1194994 or: >> >>>>>> >> >>>>>> Here is my Main.cs file: >> >>>>>> using System; >> >>>>>> using System.Collections.Generic; >> >>>>>> using System.Linq; >> >>>>>> using MonoTouch.Foundation; >> >>>>>> using MonoTouch.UIKit; >> >>>>>> using LoadSiteList; >> >>>>>> using MonoTouch.MapKit; >> >>>>>> using MonoTouch.CoreLocation; >> >>>>>> >> >>>>>> namespace MapsStuff >> >>>>>> { >> >>>>>> >> >>>>>> >> >>>>>> public class Application >> >>>>>> { >> >>>>>> static void Main (string[] args) >> >>>>>> { >> >>>>>> UIApplication.Main (args); >> >>>>>> } >> >>>>>> } >> >>>>>> >> >>>>>> >> >>>>>> // The name AppDelegate is referenced in the MainWindow.xib >> >>>>>> file. >> >>>>>> public partial class AppDelegate : UIApplicationDelegate >> >>>>>> { >> >>>>>> UITabBarController tabBarController; >> >>>>>> os4MapsViewController viewController; >> >>>>>> MapsStuff.TableViewController viewController2; >> >>>>>> >> >>>>>> >> >>>>>> // This method is invoked when the application has >> >>>>>> loaded >> >>>>>> its UI and >> >>>>>> its ready to run >> >>>>>> public override bool FinishedLaunching >> >>>>>> (UIApplication >> >>>>>> app, >> >>>>>> NSDictionary options) >> >>>>>> { >> >>>>>> window = new UIWindow >> >>>>>> (UIScreen.MainScreen.Bounds); >> >>>>>> tabBarController = new UITabBarController(); >> >>>>>> >> >>>>>> viewController = new >> >>>>>> os4MapsViewController(); >> >>>>>> viewController2 = new TableViewController(); >> >>>>>> >> >>>>>> viewController.TabBarItem = new UITabBarItem >> >>>>>> ("Map", >> >>>>>> UIImage.FromFile("Images/103-map.png"), 0); >> >>>>>> viewController2.TabBarItem = new >> >>>>>> UITabBarItem >> >>>>>> ("List", >> >>>>>> UIImage.FromFile("Images/103-map.png"), 0); >> >>>>>> tabBarController.ViewControllers = new >> >>>>>> UIViewController[] >> >>>>>> {viewController, viewController2}; >> >>>>>> >> >>>>>> window.AddSubview(tabBarController.View); >> >>>>>> // If you have defined a view, add it here: >> >>>>>> // window.AddSubview >> >>>>>> (navigationController.View); >> >>>>>> >> >>>>>> window.MakeKeyAndVisible (); >> >>>>>> >> >>>>>> return true; >> >>>>>> } >> >>>>>> >> >>>>>> // This method is required in iPhoneOS 3.0 >> >>>>>> public override void OnActivated (UIApplication >> >>>>>> application) >> >>>>>> { >> >>>>>> } >> >>>>>> } >> >>>>>> } >> >>>>>> >> >>>>>> Next here is the os4MapsViewController.cs: >> >>>>>> >> >>>>>> using System; >> >>>>>> using System.Drawing; >> >>>>>> using System.Collections.Generic; >> >>>>>> using System.Diagnostics; >> >>>>>> using MonoTouch.Foundation; >> >>>>>> using MonoTouch.UIKit; >> >>>>>> using MonoTouch.MapKit; >> >>>>>> using MonoTouch.CoreLocation; >> >>>>>> >> >>>>>> namespace MapsStuff >> >>>>>> { >> >>>>>> public class os4MapsViewController: UIViewController >> >>>>>> { >> >>>>>> private MKMapView _mapView { get; set; } >> >>>>>> List<MapsStuff.MapAnnotation> pins; >> >>>>>> >> >>>>>> public MKMapView MapView >> >>>>>> { >> >>>>>> get { return _mapView; } >> >>>>>> } >> >>>>>> >> >>>>>> public os4MapsViewController () : base() >> >>>>>> {} >> >>>>>> >> >>>>>> public override void ViewDidLoad () >> >>>>>> { >> >>>>>> base.ViewDidLoad (); >> >>>>>> >> >>>>>> // >> >>>>>> // Create our map view and add it as as >> >>>>>> subview. >> >>>>>> // >> >>>>>> pins = CreateRandomPins(); >> >>>>>> _mapView = new MKMapView(); >> >>>>>> _mapView.Frame = new RectangleF (0, 0, >> >>>>>> this.View.Frame.Width, >> >>>>>> this.View.Frame.Height); >> >>>>>> _mapView.ShowsUserLocation = true; >> >>>>>> _mapView.MapType = MKMapType.Hybrid; >> >>>>>> _mapView.Delegate = new MapViewDelegate(); >> >>>>>> foreach (MapAnnotation m in pins) >> >>>>>> { >> >>>>>> _mapView.AddAnnotation(m); >> >>>>>> } >> >>>>>> View.AddSubview(_mapView); >> >>>>>> } >> >>>>>> >> >>>>>> List<MapsStuff.MapAnnotation> CreateRandomPins() >> >>>>>> { >> >>>>>> Random r = new Random(); >> >>>>>> List<MapsStuff.MapAnnotation> locations = >> >>>>>> new >> >>>>>> List<MapsStuff.MapAnnotation>(); >> >>>>>> for (int i = 0; i < 4; i++) >> >>>>>> { >> >>>>>> locations.Add( >> >>>>>> new >> >>>>>> MapsStuff.MapAnnotation( >> >>>>>> new >> >>>>>> CLLocationCoordinate2D(r.NextDouble() * 180, >> >>>>>> r.NextDouble() * 180), >> >>>>>> "test" + i, >> >>>>>> "sub" + i >> >>>>>> )); >> >>>>>> } >> >>>>>> >> >>>>>> return locations; >> >>>>>> } >> >>>>>> } >> >>>>>> public class MapViewDelegate : MKMapViewDelegate >> >>>>>> { >> >>>>>> public MapViewDelegate (): base() >> >>>>>> { >> >>>>>> } >> >>>>>> public override MKAnnotationView >> >>>>>> GetViewForAnnotation >> >>>>>> (MKMapView >> >>>>>> mapView, NSObject annotation) >> >>>>>> { >> >>>>>> var anv = >> >>>>>> mapView.DequeueReusableAnnotation("thislocation"); >> >>>>>> if (anv == null) >> >>>>>> { >> >>>>>> Console.WriteLine("creating new >> >>>>>> MKAnnotationView"); >> >>>>>> anv = new >> >>>>>> MKPinAnnotationView(annotation, >> >>>>>> "thislocation"); >> >>>>>> } >> >>>>>> else >> >>>>>> { >> >>>>>> anv.Annotation = annotation; >> >>>>>> } >> >>>>>> anv.Image = new UIImage("pin.png"); >> >>>>>> anv.CanShowCallout = true; >> >>>>>> return anv; >> >>>>>> } >> >>>>>> } >> >>>>>> } >> >>>>>> >> >>>>>> So both the referenced images in Main.cs and the ones in >> >>>>>> os4MapsViewController.cs are not shown >> >>>>>> >> >>>>>> http://imageshack.us/photo/my-images/850/screenshot20110905at323.png/ >> >>>>>> <-- this image shows what I get on the emulator. >> >>>>>> >> >>>>>> pin.png lies in the root folder of my project. The other image lies >> >>>>>> in >> >>>>>> the folder Images in the project dir. None of them seems to show >> >>>>>> up. >> >>>>>> >> >>>>>> Any ideas? I know the code provided uses MKPinAnnotationView, but >> >>>>>> changing it to MKAnnotationView simply shows nothing. >> >>>>>> >> >>>>>> On Mon, Sep 5, 2011 at 2:48 PM, Mikkel Lønow <mloe...@gmail.com> >> >>>>>> wrote: >> >>>>>>> Hi Tomasz, >> >>>>>>> I believe MKAnnotationView would be your best option. Use a custom >> >>>>>>> MKMapViewDelegate and override GetViewForAnnotation where you call >> >>>>>>> mapView.DequeueReusableAnnotation to reuse the annotation view (or >> >>>>>>> create a >> >>>>>>> new if null). Here you can set your image to the annotation view. >> >>>>>>> Feel free to share your implementation if you need more help. >> >>>>>>> Mikkel >> >>>>>>> >> >>>>>>> On Mon, Sep 5, 2011 at 14:01, Tomasz Cielecki >> >>>>>>> <tom...@ostebaronen.dk> >> >>>>>>> wrote: >> >>>>>>>> >> >>>>>>>> Hello MonoTouch list, >> >>>>>>>> >> >>>>>>>> I am in the midst of creating a iPhone app where I need a map >> >>>>>>>> with >> >>>>>>>> some circles, where the circle colors changes depending on the >> >>>>>>>> data >> >>>>>>>> received asynchronously in the background. >> >>>>>>>> >> >>>>>>>> So my first approach to this was to get a Map shown on the >> >>>>>>>> devices >> >>>>>>>> with a circle, which works fine. Only problem is that MKCircle >> >>>>>>>> takes >> >>>>>>>> a >> >>>>>>>> radius for that circle, which means the circle is only visible at >> >>>>>>>> some >> >>>>>>>> zoom level. So lets say the circle radius is 100 meters, then I >> >>>>>>>> have >> >>>>>>>> to zoom to almost the biggest zoom level to get to a point where >> >>>>>>>> I >> >>>>>>>> actually can see the circle, this is not the desirable behavior. >> >>>>>>>> I >> >>>>>>>> want to have the circle resize along with the zoom level, just >> >>>>>>>> like >> >>>>>>>> pins do. >> >>>>>>>> >> >>>>>>>> So I have also tried to use a custom image on MKPinAnnotationView >> >>>>>>>> and >> >>>>>>>> on MKAnnotationView, neither of them seems to show my custom >> >>>>>>>> image. >> >>>>>>>> The normal pin image shows when using MKPinAnnotationView. I have >> >>>>>>>> put >> >>>>>>>> the pin image in the root of my project and referencing it with >> >>>>>>>> the >> >>>>>>>> path "pin.png" (the name of the image is actually pin.png). >> >>>>>>>> >> >>>>>>>> So maybe someone here can help me find out what is wrong, or >> >>>>>>>> provide >> >>>>>>>> me with some examples on how to do this? I would prefer if I >> >>>>>>>> could >> >>>>>>>> use >> >>>>>>>> MKCircle and just choose the color. But using images could be a >> >>>>>>>> solution. >> >>>>>>>> >> >>>>>>>> -- >> >>>>>>>> Med Venlig Hilsen / With Best Regards >> >>>>>>>> Tomasz Cielecki >> >>>>>>>> http://ostebaronen.dk >> >>>>>>>> _______________________________________________ >> >>>>>>>> MonoTouch mailing list >> >>>>>>>> MonoTouch@lists.ximian.com >> >>>>>>>> http://lists.ximian.com/mailman/listinfo/monotouch >> >>>>>>> >> >>>>>>> >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>>> -- >> >>>>>> Med Venlig Hilsen / With Best Regards >> >>>>>> Tomasz Cielecki >> >>>>>> http://ostebaronen.dk >> >>>>> >> >>>>> >> >>>> >> >>>> >> >>>> >> >>>> -- >> >>>> Med Venlig Hilsen / With Best Regards >> >>>> Tomasz Cielecki >> >>>> http://ostebaronen.dk >> >>> >> >>> >> >> >> >> >> >> >> >> -- >> >> Med Venlig Hilsen / With Best Regards >> >> Tomasz Cielecki >> >> http://ostebaronen.dk >> > >> >> >> >> -- >> Med Venlig Hilsen / With Best Regards >> Tomasz Cielecki >> http://ostebaronen.dk > > -- Med Venlig Hilsen / With Best Regards Tomasz Cielecki http://ostebaronen.dk _______________________________________________ MonoTouch mailing list MonoTouch@lists.ximian.com http://lists.ximian.com/mailman/listinfo/monotouch