我正在开发一个应用程序,其功能是通过拖动其右下角按钮来调整和旋转imageview.
我看到一个应用程序的功能,如果我们拖动右下角按钮对角线imageview大小已调整大小,否则如果我们拖动按钮左侧或右侧方向imageview已按方向旋转.我希望在我的应用中实现此功能
我正在努力实现单指旋转以及调整imageview的大小.
我可以通过拖动它的右下角按钮成功实现调整imageview的大小.但我没有足够的知识来向图像视图添加旋转
请以正确的方式指导我.
我已添加以下代码,通过拖动其右上角来调整图像视图的大小.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [[event allTouches] anyObject];
touchStart = [[touches anyObject] locationInView:imageView];
isResizingLR = (containerVw.bounds.size.width - touchStart.x < kResizeThumbSize && containerVw.bounds.size.height - touchStart.y < kResizeThumbSize);
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
CGPoint touchPoint = [[touches anyObject] locationInView:imageView];
CGPoint previous=[[touches anyObject]previousLocationInView:imageView];
UITouch *touch = [[event allTouches] anyObject];
float deltaWidth = touchPoint.x-previous.x;
float deltaHeight = touchPoint.y-previous.y;
if (isResizingLR) {
containerVw.frame = CGRectMake(containerVw.frame.origin.x, containerVw.frame.origin.y,touchPoint.x + deltaWidth, touchPoint.y + deltaWidth);
imageView.frame = CGRectMake(imageView.frame.origin.x, imageView.frame.origin.y,touchPoint.x …Run Code Online (Sandbox Code Playgroud)