6

CGContextRef kullanarak bir çizgi çizme çiziyorum. Çizgileri net bir şekilde göstermek için bu grafiği uzaklaştırın.Grafik, CGContextRef ile oluşturuldu nasıl oluşturulur

Bu kodu kullanıyorum.

CGContextRef context=UIGraphicsGetCurrentContext(); 
CGContextBeginPath(context); 

CGMutablePathRef path=CGPathCreateMutable(); 
CGPathMoveToPoint(path, NULL, lastPointX, lastPointY); 
CGPathAddLineToPoint(path, NULL, newPointX, newPointY); 

CGContextAddPath(context, path); 
CGContextSetLineWidth(context, lineWidth); 
CGContextSetStrokeColorWithColor(context, lineColor); 
CGContextStrokePath(context); 
CGPathRelease(path); 

if (isFilling) { 
    CGMutablePathRef path=CGPathCreateMutable(); 
    CGPathMoveToPoint(path, NULL, newPointX, newPointY); 
    CGPathAddLineToPoint(path, NULL, newPointX, self.bounds.size.height); 
    CGPathAddLineToPoint(path, NULL, lastPointX, self.bounds.size.height); 
    CGPathAddLineToPoint(path, NULL, lastPointX, lastPointY); 
    CGPathCloseSubpath(path); 

    CGContextAddPath(context, path); 
    CGContextSetFillColorWithColor(context, fillingColor); 
    CGContextFillPath(context); 
    CGPathRelease(path); 
} 

Not: - Görünümü büyütmek istemiyorum. Açıkça gösterilecek çizgileri yeniden çizmek istiyorum.

cevap

0

Sen UIScrollViewbu grafiği çizmek zorunda veya o zaman mümkün ve bu grafiğin uzaklaştırmak için olabilir UIScrollView üzerinde görünümü ekleyebilirsiniz. Başvuru için

- (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView { 
} 
- (void)scrollViewDidZoom:(UIScrollView *)scrollView { 
} 

bu güzel öğretici takip edebilirsiniz: Eğer UIScrollView yöntemleri aşağıdaki uygulamalıdır Bunu yapmak için

: aşağıdaki yöntemleri uygulamak söyleyecektir

http://www.raywenderlich.com/10518/how-to-use-uiscrollview-to-scroll-and-zoom-content

- (void)centerContentsOfScrollView:(UIScrollView *)scrollView 
{ 
} 
- (void)scrollViewDoubleTapped:(UITapGestureRecognizer*)recognizer 
{ 
} 
- (void)scrollViewTwoFingerTapped:(UITapGestureRecognizer*)recognizer 
{ 
} 
+0

Görünümü yakınlaştırmak istemiyorum. Açıkça gösterilecek çizgileri yeniden çizmek istiyorum. –

İlgili konular