보기를 회전하고 크기를 조정하는 기능이있는 앱을 만들고 있습니다. 이 기능을 구현했지만 문제가 있습니다.UIView의 크기를 조정하는 방법 CGAffineTransformIdentity
내 문제
내가 양 방향으로 뷰를 회전 할 수 있습니다 크기를 조정 한 후, 네 모서리를 드래그하면보기 크기를 조정할 수 줘야 해.
일단 회전이 끝나면 모서리를 드래그하여 다시보기 크기를 조정하면보기의 크기가 예측할 수없는 값으로 이동하고 화면 전체가 이동합니다. 내가 많이 봤
는결국 난 내가 구현하고자 정확히 어떤 기능을 구현하고 하나의 응용 프로그램을 본 다음과 같은 솔루션
The frame property is undefined when transform != CGAffineTransformIdentity, as per the docs on UIView
을 얻었다. 뷰
의 크기를 조정하기위한어떻게 UIView의 회전 후
내 코드를 UIView의 크기를 조정할 수 있습니다
접촉은
- (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);
}
접촉이
- (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);
}
}
을 이전 개시
나는 똑같은 문제가 있으며 이것에 대한 해결책이 있는지 궁금해하고 있습니다. 그렇다면 게시하십시오. 귀하의 회신에 감사드립니다. – Vad