在两个对象之间绘制线条

时间:2013-03-01 06:19:37

标签: iphone ios objective-c

我正在开发应用程序以匹配使用Line我已经完成问题和回答的单词,但我想知道如何使用Line匹配特定问题以正确答案。我正在使用数据库显示问题答案

enter image description here

先谢谢

1 个答案:

答案 0 :(得分:1)

您可以从此link

获取源代码

并更改线宽属性更改,颜色等行,请转到该源代码中的EC189DrawingViewController并在以下部分进行编辑

- (void)drawShapes {
//NSLog(@"In drawShapes!");

UIGraphicsBeginImageContext(_drawingPad.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();

for(myShape *i in _collection) {
    [self drawShapesSubroutine:i contextRef:context];
    if(i.selected == true) {
        CGContextSetLineWidth(context, 1.0f);
        CGContextSetStrokeColorWithColor(context, [[UIColor darkGrayColor] CGColor]);
        float num[] = {6.0, 6.0};
        CGContextSetLineDash(context, 0.0, num, 2);

        CGRect rectangle;
        [self drawShapeSelector:i selectorRect: &rectangle];
        CGContextAddRect(context, rectangle);        
        CGContextStrokePath(context);


        //tapped = true;
    }
}

if(!skipDrawingCurrentShape && (selectedIndex == -1)) {
    [self drawShapesSubroutine:_currentShape contextRef:context];
}
_drawingPad.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}