Hi guys. I've been searching a lot for this but i only find tutorials on how to scale an image using multitouch (2 fingers to scale, drag, rotate, etc.)
Lets say i have a barchart. How can i adujust bar value (size) with just one finger, by draging the bar or by just pointing to the new value in the chart?
This is my idea on how this could be done:
Each bar is an image that in it's full size represents the 100% value in the chart. Then by draging my finger it would scale the image from 100% to 0%.
It can only scale in one direction Y or X (deponding on chart orientation), and the scale must have a basepoint (anchor point) so that one side of the bar is always at the chart base value of 0%.
Since no one helped, I'll be doing things a different way.
I'll be drawing the chart from UITextField keyboard inputs. This is lame. I Would love to take advantage of the touch interface here. Anyway, i hope this helps someone.
Made this action and linked it to a button in the view. Once pressed it reads the value entered in the UITexField and scales the bar of the chart to that value.
Input01 is my UITextField where i input the desired value for Bar01 Bar01 is an UIImageView and is the 1st bar from my chart
Your post gave me an idea that can almost do the trick:
Put a slider on top of a bar.
Match the slider size to 100% of the bar value.
Link the slider value to the scale factor applied to the bar.
Set the slider invisible and hurray.
Well, not quite!!!
1st problem: Can't set the slider completely invisible. If alpha value is lower then 0.02 the slider stops working, as if it isn't even there.
2nd problem: AnchorPoint no longer works correctly and the scale goes nuts. I'm using the following code to set the new anchor point.
This isn't exactly what you were going for but it might work. Instead of changing bar values by dragging the bars directly, implement some sort of selection. Let's say you have five bars, tap one to select it and a toolbar with a slider on it appears (slides) into view which you can move to set the bar level.
Sorry that I can't give you a more concrete help but only ideas. I'm rather new to iOS development and didn't do much with graphics programming.