I have a specification to build a very simple diagramming capability into a MonoTouch app. Everything I've had to do up to now has been table based so this is new territory.
Numerous examples of diagramming can be found in the app store, for example the MindMeister and SimpleMind mindmapping apps.
I need users to be able to click on a view to "put down" a new shape, label it, and optionally connect it to an existing shape.
What would be a good approach to achieve this kind of interactive functionality? My first would be to put down a UIImageView
created from a custom image, and then ensuring that it can respond to touch events to move it around. However, when you want to add a text overlay, matters become more complicated as you'd have to manage two views (both the image and the text).
What approach could I follow?
PS: Smite at will if this is inappropriate for SO!
Update: Basic diagram elements can be achieved by using a simple label override:
UILabel lbl = new UILabel(new RectangleF(...));
lbl.Text = "Whatever";
lbl.Layer.BorderWidth = 3f;
lbl.Layer.BorderColor ( new CGColor (1f, 0f, 0f) );
this.Add (lbl);
Some interactivity can be achieved by extending the gui element class and overriding the TouchesBegan
, TouchesMoved
and TouchesEnd
events.