Cómo cambiar el tamaño de UIView cuando CGAffineTransformIdentity

Estoy haciendo una aplicación que tiene una función para rotar y redimensionar una vista. He implementado esta característica pero me enfrento a un problema.

Mi problema

La vista se cambiará de tamaño al arrastrar sus cuatro esquinas, después de cambiar el tamaño puedo rotar la vista en ambas direcciones.

Una vez que se realiza la rotación, si vuelvo a intentar cambiar el tamaño de la vista arrastrando su esquina, el tamaño de la vista pasó a un valor impredecible y se mueve por la pantalla.

Busqué en Google finalmente obtuve la siguiente solución

The frame property is undefined when transform != CGAffineTransformIdentity, as per the docs on UIView

Vi una aplicación que ha implementado la característica exactamente lo que deseo implementar.

¿Cómo puedo cambiar el tamaño de UIView después de la rotación de UIView

Mi código para cambiar el tamaño de la vista

Empezaron los toques

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

   UITouch *touch = [[event allTouches] anyObject];

   NSLog(@"[touch view]:::%@",[touch view]);

   touchStart = [[touches anyObject] locationInView:testVw];
   isResizingLR = (testVw.bounds.size.width - touchStart.x < kResizeThumbSize &&     testVw.bounds.size.height - touchStart.y < kResizeThumbSize);
   isResizingUL = (touchStart.x <kResizeThumbSize && touchStart.y <kResizeThumbSize);
   isResizingUR = (testVw.bounds.size.width-touchStart.x < kResizeThumbSize &&      touchStart.y<kResizeThumbSize);
   isResizingLL = (touchStart.x <kResizeThumbSize && testVw.bounds.size.height -touchStart.y <kResizeThumbSize);    
}

Toques movidos

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
CGPoint touchPoint = [[touches anyObject] locationInView:testVw];
CGPoint previous=[[touches anyObject]previousLocationInView:testVw];

float  deltaWidth = touchPoint.x-previous.x;
float  deltaHeight = touchPoint.y-previous.y;

NSLog(@"CVTM:%@",NSStringFromCGRect(testVw.frame));


if (isResizingLR) {
 testVw.frame = CGRectMake(testVw.frame.origin.x, testVw.frame.origin.y,touchPoint.x +   deltaWidth, touchPoint.y + deltaWidth);
 }  
if (isResizingUL) {
 testVw.frame = CGRectMake(testVw.frame.origin.x + deltaWidth, testVw.frame.origin.y +  deltaHeight, testVw.frame.size.width - deltaWidth, testVw.frame.size.height - deltaHeight);
 } 
if (isResizingUR) {
  testVw.frame = CGRectMake(testVw.frame.origin.x ,testVw.frame.origin.y + deltaHeight,  testVw.frame.size.width + deltaWidth, testVw.frame.size.height - deltaHeight);      
 } 
if (isResizingLL) {
 testVw.frame = CGRectMake(testVw.frame.origin.x + deltaWidth ,testVw.frame.origin.y ,  testVw.frame.size.width - deltaWidth, testVw.frame.size.height + deltaHeight);   
}

if (!isResizingUL && !isResizingLR && !isResizingUR && !isResizingLL) {
testVw.center = CGPointMake(testVw.center.x + touchPoint.x - touchStart.x,testVw.center.y + touchPoint.y - touchStart.y);
 }

 }

Respuestas a la pregunta(1)

Su respuesta a la pregunta