Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8616699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:41:07+00:00 2026-06-12T05:41:07+00:00

I have been looking for a good tutorial on adding an image overlay for

  • 0

I have been looking for a good tutorial on adding an image overlay for Mapkit in C# Monotouch.

I have found many overlay examples for coloured circles or polygons. But I want to load a PNG over the top of my maps. I am coming from MonoAndroid and have done it there, but need to transfer my program across to iOS.

Even a objective C example would help, but Mono would be better.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:41:08+00:00Added an answer on June 12, 2026 at 5:41 am

    I ended up downloading some native objective C code and pretty much just converting it into C#. The function names are very similar, the Xamarin API references Documentation is very helpful.

    There where some tricky bumps I ran into around the app delegate, and how it is handled differently in C# to Objective C.

    Here are the two hardest functions to convert and my solution:

    1) The Draw functions in the map overlay class

        public override void DrawMapRect (MKMapRect mapRect, float zoomScale, CGContext ctx)
        {
            InvokeOnMainThread(
                () => 
                {
                UIImage image = UIImage.FromFile(@"indigo_eiffel_blog.png");
    
                    DrawImgRotated(image, 0, ctx);
                }
            );
        }
    
        public void DrawImgRotated(UIImage image, float rotDegree, CGContext c)
        {
            c.SaveState();
    
            CGImage imageRef = image.CGImage; 
    
            //loading and setting the image
            MKMapRect theMapRect = ((MapOverlay)this.Overlay).BoundingMapRect;//MKMapRect theMapRect    = [self.overlay boundingMapRect];
            RectangleF theRect = RectForMapRect(theMapRect);
    
            //we need to flip and reposition the image
            c.ScaleCTM( 1.0f, -1.0f);
            c.TranslateCTM(-theRect.Width/8,-theRect.Height);
    
            // Proper rotation about a point
            var m = CGAffineTransform.MakeTranslation(-theRect.Width/2,-theRect.Height/2);
            m.Multiply( CGAffineTransform.MakeRotation(DegreesToRadians(rotDegree)));
            m.Multiply( CGAffineTransform.MakeTranslation(theRect.Width/2,theRect.Height/2));
            c.ConcatCTM( m );
    
            c.DrawImage(theRect, imageRef);
    
            c.RestoreState();
        }
    

    and 2) the bounding mapRect function in my mapOverlay class overriding MKOverlay.
    Yes the position is hardcoded, I am working on unit conversion atm but those are the correct coordinates to draw the image same as in the sample obejctive c code I used.

        public MKMapRect BoundingMapRect
        {
            [Export("boundingMapRect")]
            get 
            {
                var bounds = new MKMapRect(1.35928e+08, 9.23456e+07,17890.57, 26860.05);
                return bounds; 
            }
    
        }
    

    The source code for the Objective C project I converted is here: https://github.com/indigotech/Blog-MKMapOverlayView

    Xamarin API reference documentation: http://iosapi.xamarin.com/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking all over the internet and i found some good guides
Does anyone have a good State Manager tutorial in Java? I have been looking
I am looking and have been looking for a good example or tutorial on
I have been reading up on WCF and was looking for a good tutorial
I have been looking for ages and I can't find any good examples of
I have been looking for a tutorial to help me integrate PHPUnit with CakePHP.
I've been looking at the code in this tutorial , and I found that
I have been looking for a tutorial that shows or explains how to display
I have scoured the internet looking for a good tutorial or posting about having
I have been looking everywhere but can't seem to find a good solution for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.