Reputation: 628
I am new to ios/iphone development.
I would like to display a view consisting of the 3 possible line join styles as below. Ideally I would have 3 objects that resemble the 3 drawings below and clicking on each would select the appropriate join.
Is it possible to implement each of these objects with a UIButton or is it better to draw and figure out which one the user touched?
Upvotes: 0
Views: 470
Reputation: 535606
You can certainly use three custom buttons and make each of the three mitre drawings the image of one button.
For best results, in my opinion, you should learn to draw in code and actually draw the mitre drawings in code — drawing each of them in to a UIImage and then making each UIImage the image of a button.
Upvotes: 1
Reputation: 131471
You could use a couple of approaches (and probably more).
You could create custom views and attach a shape layer to each, configured with the desired join, and install the same path into each. You'd then need to attach a tap gesture organizer.
The easiest way, though, would be to simply use custom buttons with static images of your different joins. Then you'd just attach an action to each button like normal.
I would recommend buttons with custom images. It's simple, it's easy, and you end up with normal-behaving buttons.
Upvotes: 1