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 9276273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:48:28+00:00 2026-06-18T16:48:28+00:00

I have a 3D map with many different shaped buildings. I would like users

  • 0

I have a 3D map with many different shaped buildings. I would like users to click a building on the map, which would act as a segue to a new view.

I planned to go about this by creating invisible buttons the same shapes as the buildings, and then laying them on top of the imageview (which holds the map).

After doing some reading I found that it isn’t as simple as I thought to create custom buttons (I think that I will have to do a lot of sublcassing and customization, which doesn’t seem reasonable when I have 50+ different shaped buttons to make), so I was wondering if there was another aproach I could use to solve this problem.


Edit: I should add that right now that all functionality is working, but I am having to use default rectangular buttons, with alpha set to 0.1.

  • 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-18T16:48:29+00:00Added an answer on June 18, 2026 at 4:48 pm

    EDITED TO IMPROVE DATAMODEL

    To do this you will have a UIView with your map image in the background. You can do this with either a UIImageView or by rendering the image yourself in drawRect.

    You will then define several CGPath references. One for each building by doing something like this… How to create CGPathRef from Array of points The points will be the corners of each building.

    Now store these paths in an array somehow. You will need one path for every “clickable”
    building.

    I would store the paths inside a Building object or something…

    @interface Building : NSObject
    
    @property (nonatomic) CGPath path;
    
    @end
    

    Now in the UIView subclass you override - (void)touchesBegan.... You can then get the touch point and iterate through your paths to find which one is touched…

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
        UITouch *touch = [touches anyObject];
    
        CGPoint touchPoint = [touch locationInView:self];
    
        for (Building *building in self.buildings) {
            if (CGPathContainsPoint(building.path, CGAffineTransformIdentity, touchPoint, YES)) {
                //the touch was inside this building!
                //now do something with this knowledge.
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a map with jQuery which is split up in many regions,
Let's say I have an object with two different one-to-many relations. Much like: Customer
I have many different KML layers on a Google Map (v3). Random colors of
I have a Hash Map (many-to-one relationship between texts and boolean values): name flag
So, I have created many map applications before, but the one that I am
I have map with multiple different colors markers with some info window. Everything works
I have a Map which stores script No. and patient Id in map the
I have many destinations (say 150+) and each destination has 2 different variants: A
I'm wondering if it's possible to map different data types. For instance, I have
I have the following requirement to map many domains to a single site instance

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.