I have a custom map image of an area.. There are about 9 regions and the number of distinct lines needed is only 11 (based on all possible routes).
What is the best way to draw a route on the map?
The brute force/hacky way is to create static images of every route possible- insane as it amounts to over a million images. Another way is to have layered images with the lines as images on top of the map (is this possible? Would zooming mess it up?)... Any other suggestions to tackle this? I could programmatically draw lines on top of the map but would it be responsive to zooming and such?
Note: The map image is a vectored image (svg) and does not contain GPS coordinates
Thank you!
You'll probably want to check out coreGraphics, it's perfectly suited for this task. Zooming and all.
Related
I'm looking to implement a widget that shows a floorplan with a custom image. It needs to have markers that show specific points on the plan, and the markers should pan and zoom with the floorplan so they remain in the same position relative to the plan. Imagine a normal map with markers, but I want to show a floorplan image instead of map data.
I've seen this video which uses a GridView:
https://www.youtube.com/watch?v=RZMqaHSs6CM however I don't think it's the best solution for my scenario, as my floorplan images may have different numbers of markers that won't fit in to the grid resolution/dimensions.
Any ideas which widgets/libraries would help me achieve this?
Please let me know if you want more clarity on my goal
Thanks!
I'm trying to create assets for a native iOS app. I know that I need to make my header images and buttons resizeable, so I'll need to create slices of the capped ends and a middle slice that stretches to full size.
My question is: how do I do this in Photoshop? Should I use the slice tool to make three separate slices and then export them as three .pngs? Or should I slice the ends and the middle, put it all together and export it as a single .png?
What is the best way to do this?
Thanks!
Native iOS apps have an image API that supports resizing single images based on insets and a tiled inner area. See the documentation, specifically -resizableImageWithCapInsets:. With that method, areas around the edges defined by the insets are not altered, while the remaining center region is tiled to fill any size.
You should aim to produce single images that can be used with that API in mind, while keeping tiled inner region as small as possible
Ok, here's my problem. I have a HUGE jpg file, 18000 x 18000 pixels 41MB in size.
If you really need to know, it's a map of a section of the country with services.
My project is really simple. I just need to be able to zoom and display this granddaddy size image. All the way from aspect fit to 100% on the iPhone. I'm not too sure if this can be done or how long it will take. Would appreciate any insights.
I have tried using imageView but I read that it really shouldnt exceed 1024 x 1024. That is way below what I have. If you have an idea how to go about doing this, please share!
You should split the image into tiles, at a range of magnifications. Calculate and build these off-line, and ship them as individual files in the app bundle. Given the zoom in your display, pick the closest zoom size. You then select which tiles are needed to cover the screen, and make a grid of them. As the user zooms, select the appropriate tile size.
The benefit of this is that you don't ever have to load HUGE files into memory, only as much as needed.
This is how Google maps does it.
Can't give you any code, sorry!
You should follow an approach similar to what Google Maps and other map sites do. You need to slice the whole map in sections, so the users don't need to load the whole map if it's not always necessary (plus makes loading time way faster)
There's a couple of solutions that might work for you like OpenLayers or even creating a Custom Google Map with your images as seen here and here
Here is an example from Apple for processing large images called PhotoScroller. The images have already been tiled. If you need an example of tiling an image in Cocoa check out cimgf.com
I'm developing an app that must show one of three shapes(UIImageViews) depending on which button the user taps. I'm achieving this by creating different UIImageViews with three UIImages. I was wondering, is it more efficient if I draw the shapes directly from code??
BTW, the images have transparency and are 342 px x 388 px. Thanks!
It depends on the shapes. I suggest using PNG image files unless you are having particular speed issues. This lets the designers/artists customize the look easily rather than making the programmers do it in code, which is more tedious to modify.
We have some nice gradients and shadows in our application and drawing them using Quartz was pretty slow -- fine for a single screen, but too slow when animated or scrolled.
Being a complete noob in iPhone development, I was wondering what would be the best way to define regions in an Image (for interaction ). So far I've got 2 ideas :
use CGpath to basically draw the areas that I`m interested in but I quickly can see it becoming tedious on complex graphics .
use a Color coded layer with regions containing different RGB values and return those as my regions .
Are those sensible approaches ?
Depends on what you mean by interaction and whether you want the regions to be visible to the user.
A simple approach would be to just add UIButton's above your image. They can be transparent and any size (rectangular) that you like. Or they can contain images or colors to be visible to the user.
If you need arbitrary shapes then this solution won't be useful to you.