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

  • SEARCH
  • Home
  • 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 326335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:17:59+00:00 2026-05-12T09:17:59+00:00

Without getting into OpenGL (Quartz 2D is OK): Let’s say I have an image

  • 0

Without getting into OpenGL (Quartz 2D is OK):

  1. Let’s say I have an image which I want to move across a map in some fluid way. For instance, an image of a plane “flying” across the map. I’ve been able to do this using an MKAnnotation, an NSTimer and fiddling with the rate of lat/lon change and timer rate. However, I assume this isn’t ideal, although the results look pretty decent. Can you think of a better way?

  2. Now let’s say that I want this image to be animated (think: animated gif). I can’t do the usual UIImageView with a series of animationFrames because all I have access to in MKAnnotationView is a UIImage. How would you guys tackle this?

I realize that #2 could be handled with a UIImageView on top of the map containing the animationImages. However, then I would have to manually handle translating the movement of the plane or rocket or whatever as the region of the mapview changed, depending on user movements in the real-world, or user zooming (scrolling is not allowed in my app).

What do you think?

  • 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-05-12T09:18:00+00:00Added an answer on May 12, 2026 at 9:18 am

    I think I’ve figured out a solution to #2. I subclassed MKAnnotationView and wrote some code to add a UIImageView (with animation images) as a subview.

    //AnimatedAnnotation.h
    
    #import <Foundation/Foundation.h>
    #import <MapKit/MapKit.h>
    
    @interface AnimatedAnnotation : MKAnnotationView
    {
        UIImageView* _imageView;
        NSString *imageName;
        NSString *imageExtension;
        int imageCount;
        float animationDuration;
    }
    
    @property (nonatomic, retain) UIImageView* imageView;
    @property (nonatomic, retain) NSString* imageName;
    @property (nonatomic, retain) NSString* imageExtension;
    @property (nonatomic) int imageCount;
    @property (nonatomic) float animationDuration;
    
    
    - (id)initWithAnnotation:(id <MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier imageName:(NSString *)name imageExtension:(NSString *)extension imageCount:(int)count animationDuration:(float)duration
    ;
    
    @end
    

    //AnimatedAnnotation.m

    #import "AnimatedAnnotation.h"
    
    @implementation AnimatedAnnotation
    @synthesize imageView = _imageView;
    @synthesize imageName, imageCount, imageExtension,animationDuration;
    
    - (id)initWithAnnotation:(id <MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier imageName:(NSString *)name imageExtension:(NSString *)extension imageCount:(int)count animationDuration:(float)duration
    {
        self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
        self.imageCount = count;
        self.imageName = name;
        self.imageExtension = extension;
        self.animationDuration = duration;
        UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%@0.%@",name,extension]];
        self.frame = CGRectMake(0, 0, image.size.width, image.size.height);
        self.backgroundColor = [UIColor clearColor];
    
    
        _imageView = [[UIImageView alloc] initWithFrame:self.frame];
        NSMutableArray *images = [[NSMutableArray alloc] init];
        for(int i = 0; i < count; i++ ){
            [images addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%@%d.%@", name, i, extension]]];
        }
    
    
        _imageView.animationDuration = duration;
        _imageView.animationImages = images;
        _imageView.animationRepeatCount = 0;
        [_imageView startAnimating];
    
        [self addSubview:_imageView];
    
        return self;
    }
    
    -(void) dealloc
    {
        [_imageView release];
        [super dealloc];
    }
    
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 239k
  • Answers 239k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The point about C++/CLI is correct. To complete the picture,… May 13, 2026 at 7:05 am
  • Editorial Team
    Editorial Team added an answer To answer your questions: It will evaluate to true if… May 13, 2026 at 7:05 am
  • Editorial Team
    Editorial Team added an answer You could use a combination of DECIMAL and FLOAT. Decimal… May 13, 2026 at 7:05 am

Related Questions

Without getting into OpenGL (Quartz 2D is OK): Let's say I have an image
Is it possible in anyway to bundle an ASP.Net as an installable application which
I have a few users setup in the web.config of an asp.net site to
Are the Oracle ODP.NET libraries redistributable? As in, can I simply include the Oracle.DataAccess.dll
As I wire up my first fairly complicated Cocoa-Touch view I feel like I'm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.