旋转 uiimage 而不是 uiimageview。显示 uiimageview 的边框与以前相同,仅更改图像
我想使用触摸旋转 uiimageview 内的 uiimage。但是,在旋转图像时,imagview 边框不应受到干扰,仅应旋转图像。任何人都知道我该怎么做。我看过很多使用手势的例子,但我不能使用手势识别器,因为我已经编写了使用触摸从角落调整 uiimageview 大小的代码。任何帮助表示赞赏。
I want to rotate the uiimage inside uiimageview using touches. But while rotating the image imagview borders should be not disturbed only image should be rotated. Anybody have idea how can i do that.I have seen many examples using gesture but i cannot use gesture recognizers since i have already written code for resizing uiimageview from corners using touches. Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会将 UIImageView 放入您处理触摸的 UIView 中,然后将转换应用于 UIImageView。只要 UIView 不裁剪边界,它就会显示整个 UIImageView,并且您可以让交互发生在 UIView 上。边框也将在 UIView 上设置。
旋转 UIImageView 将非常简单:
I would put the UIImageView into a UIView on which you handle the touches, and just apply the transform to the UIImageView. As long as the UIView doesn't clip the bounds it will show the entire UIImageView and you can let the interactions happen on the UIView. The borders would also be set on the UIView.
Rotating the UIImageView will then be as simple as:
您可以通过设置属性单独旋转
UIImage
对象您可以在此处找到方向
http://developer.apple.com/库/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html。
至于在不使用手势识别器的情况下使图像在触摸时发生变化,我认为这是不可能的。但是,您可以使用 UIGestureRecognizerDelegate 协议中提供的方法来解决同一视图上的多个手势识别器
。我非常确定,您可以指定在您的情况下应该执行哪些手势,而无需更改视图及其层次结构。
You can rotate the
UIImage
object alone by setting the propertyYou can find the orientations here
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html.
As for making the image to change on touching without the use of gesture recognizers, I don't think it is possible. But, you can solve your multiple gesture recognizers on the same view by using methods like
available in UIGestureRecognizerDelegate protocol. I am pretty sure, you can specify which gestures should do what in your case, without changing the views and their heirarchy.