I'm currently programming an app that deals with line graphs. I have three "dots" that allow the user to move the whole line or rotate it, one for the former and two for the latter. The problem that I'm having, though, is that sometimes the dots end up overlapping each other. If I try to touch one of the dots that rotate the graph when that happens, it just moves the whole graph itself, as if I'm touching the moving dot. What I want to know is if there is a simple way to calculate whether a uiimageview is overlapping another? Any help is appreciated.
Assuming they have the same superview:
NSIntersectsRect(imageView1.frame, imageView2.frame)
If they have different superviews, you may need to use -convertRect:toView: and friends.
Related
basically I am trying to edit not only the appearance of the button(thats the easy part) but the frame that detects the touch to be a rhombus rather then a square
html example:http://irwinproject.com
I've tried CGAfflineTransform however it doesn't allow me to make non rectangular objects. is there a way to skew
Im just wondering if this is possible because, if not could someone point me in a direction the only viable answer I've found is resorting to something along the lines of a spriteKit;
I found this however this implementation leaves dead spots on buttons where they overlap
custom UIButton with skewed area in iPhone
is there a way to message people on here there was a gentleman who said he figured out how to transform but never posted his solution.
In order to modify the touch area of an oddly shaped button you could use a solution similar to OBShapedButton. I have used this particular project in the past myself for adjacent hexagon buttons and it worked perfectly. That said, you may have to modify it a bit to work with drawn shapes instead of images.
I'm using CorePlot in my project. I have a scatterPlot graph with large amount of data points. Some of my points (but not all) need to be able to respond to user hits. How can I achieve this?
I have set plotSymbolMarginForHitDetection to 15.0f, but it applies to all the points, not to the some of them that I need to be selectable. Is it possible to set variable plotSymbolMarginForHitDetection values for different points?
No. Either ignore hits on points that you don't want or split the plot into two separate plots—one that responds to user interaction and one that doesn't.
I'm trying to customize a UISegmentedControl to use a custom image for each segment. I've done a lot of searching, but haven't had any luck with the solutions I've tried so far. This is the most recent post I can find, which is still fairly out of date now, and seems pretty hacky yet. Are there any better or more recent guides on how to do this?
Thanks
Unfortunately, UISegmentedControl doesn’t make it easy to set separate background images for each segment separately. If your control is always a known width, you might be able to make a full-size background image with the three segments drawn in, like this: (yellow][green][red) (where parentheses represent rounded corners), and then use -[UISegmentedControl setBackgroundImage:forState:barMetrics:] to set your image.
However, that solution isn’t very flexible if you want to resize the control later. You might be better off faking it with three adjacent UIButtons, or even subclassing UIControl to make a custom segmented control which can have a separate image for each segment.
I want to create an omnidirectional scrollview that works pretty much like the one in the "Wall of Sound" app. As in, the user should be able to pull into any direction and never get to an end. I want to keep the move to be smooth (and not see the pages change as you would in a standard scrollview). Does anyone know how that can be done? Or would I need OpenGL for that?
Create a 3x3 grid of views, each the size of the viewport. As the scrollview moves into another section, rearrange the views to constantly put the viewport in the center. In most cases 3x3 is sufficient, but if redrawing the views is expensive, you may want to use a larger grid (5x5 for instance). This requires that you have some mechanism for splitting up your full view into tiles.
You can implement the same thing using CALayer if you like. If you go that way, you should consider instead using CATiledLayer. See Matt Long's quick introduction on CIMGF.
I'm currently developing an iPad application that integrates MapKit. But I have a small issue. I display lines between two points on my map but when these points are one at the very west of the map and an other one at the very east of it, for instance, I would like to draw the shortest line between then. In other words, I would like to center my map between these two points (but not in the usual way because If I do so I have to draw a line from the left one that goes left to the left border of the map, then continues from the right border to the right marker... so on the opposite point of the map) and then draw the shortest route that is know in the middle of my view.
I've thought of two ideas that could help me...
- Change the map background and have a map centered on a different place of the planet,
- Instead of a map as background, have 2 maps side to side and switch to the right one according to what I need to display,
But I couldn't find anything about it... Do you know if these solutions would be possible and how ? If not, would you have an other idea about how to do what I'm trying to do ?
Thanks in advance !
Just in case it might help others people...
I didn't found any way to modify the background map in my map view and I have been forced to display some routes in two parts. Indeed, it seems impossible to do differently so far with the mapKit iOS library. We can only wait for improvements ;) !