iPhone iOS how to create interactive drag, rotate,

2020-07-27 04:29发布

问题:

I got an app that allows users to add content to a canvas. I would like to be able to offer the user an ability to move, rotate, resize, reflect this content. Currently I'm doing this with gestures, but would like to know if there is some sort of open-source widget that draws a box around the view and adds 4 buttons to do these functions:

  • rotate 90 degrees
  • rotate freely
  • resize
  • delete

Can anyone think of an open source framework that I can add to my project to create controls like the ones displayed?

I can probably build this by hand, but debugging gesture recognizers and view rotation is not the most fun thing, so I'm looking for something more polished.

Thank you!

回答1:

Here's a link to an open source control on cocoa controls that looks like something you could use: TDResizerView.

"TDResizerView is used to resize and rotate an imageview with single finger"

Sounds like a good place to start from, even if you need to modify it. I've never used this particular control though, so take my word for what it's worth.

edit: Also keep in mind that on iOS, users generally expect gestures. Forcing them to use the handles instead of pinching or rotating may be bad for your user experience, depending on why you want the handles instead.