저는 객관적인 C의 초보자입니다. 저는 페인트 스타일로 프로그램을 만들려고했는데, 저는 팬 제스처와 함께 선을 그려 넣습니다. 제스처를 만들 수는 있지만 문제는 이전에 삭제 한 지점을 다시로드 할 때마다 마우스를 통과 한 부분을 그릴 수 없다는 것입니다. 도움! 정말 고마워!라인 목표를 그립니다.
-(void)pan: (UIPanGestureRecognizer*)panGesture
{
if(panGesture.state == UIGestureRecognizerStateChanged) {
_panLocation = [panGesture locationInView:self];
}
[self setNeedsDisplay];
}
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
[self drawLine:context];
}
-(void)drawLine:(CGContextRef)context {
if (self.tag == 0) {
[[UIColor blackColor] setFill];
UIGraphicsPushContext(context);
CGContextBeginPath(context);
CGContextAddArc(context, _panLocation.x, _panLocation.y, 4, 0, 2*M_PI, YES);
CGContextSetAlpha(context, 1);
CGContextFillPath(context);
}
}
http://stackoverflow.com/questions/12527482/drawing-a-straight-line-ios –
확인해 봐. 1. http://www.ios-developer.net/iphone-ipad-programmer/development/window-uiviewcontroller-etc/graphics/drawing-graphics-on-a-view 2. http://code.tutsplus.com/tutorials/smooth-freehand-drawing-on-ios - mobile-13164 – Monikanta
monikanta 정말 고마워요, 그게 당신이 찾을 수있는 최고의 링크입니다! WorldOfWarcraft 나는 당신의 이름을 좋아하고 고마워, 나는 더 나은 링크를 찾았지만 많이 감사합니다! –