iPad를 가로로 돌릴 때마다 배경과 프레임에 문제가 있습니다.목표 C : 방향 변경시 배경 및 프레임 문제
세로 :
풍경 : 나는 노란색 화살표 후 그 옆에 페인트 할 수없고 내 배경 세로 자체를 반복에 아직도있다.
여기있는 viewDidLoad에 내 코드
입니다 :있는 touchesMoved에
background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"mickey.png"]];
self.view.backgroundColor = background;
touchDraw = [[UIImageView alloc] initWithImage:nil];
touchDraw.frame = self.view.frame;
[self.view addSubview:touchDraw];
[self.view sendSubviewToBack:touchDraw];
touchMoved = 0;
:
touchSwiped = YES;
UITouch *touch = [touches anyObject];
currentTouch = [touch locationInView:self.view];
currentTouch.y -= 20;
UIGraphicsBeginImageContext(self.view.frame.size);
[touchDraw.image drawInRect:CGRectMake(0, 0, touchDraw.bounds.size.width, touchDraw.bounds.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 25.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), redAmt, greenAmt, blueAmt, alpha);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), endingPoint.x, endingPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentTouch.x, currentTouch.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
touchDraw.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
endingPoint = currentTouch;
touchMoved++;
if (touchMoved == 10) {
touchMoved = 0;
}
그것은 내 학교 프로젝트입니다.
UPDATE :이있는 touchesMoved에 일어나는 autoResizingMask을 적용
. 어쩌면 때문에이 라인의
는 :
[touchDraw.image drawInRect:CGRectMake(0, 0, touchDraw.bounds.size.width, touchDraw.bounds.size.height)];
나는 여전히 같은 그 전에 해결하려고 노력하지만.
질문에 대한 업데이트가 잘 이해가되지 않습니다. 무엇이 그림이고, 무엇을 기대 했습니까? 내가 생각할 수있는 몇 가지 제안은 1) 부모보기에 auutoresizingMask를 추가하고 자신의 touchesMoved 루틴에서보기에 대해 일관성을 유지하는지 확인해야합니다. 부모보기와 터치보기간에 전환합니다. 그들은 같은 크기 여야하지만, 그렇지 않다면 일관성 문제가있을 수 있습니다. – Ron