3

因此,我将 Three20 库用于 iPhone 应用程序,并希望将 TTSpeechBubbleShape 样式用于视图。但是三角形似乎不想在左侧或右侧绘制。我在源代码中看到它有很多几何形状,并且想知道是否有人解决了这个问题或知道如何修复它。

4

2 回答 2

1

您可能正在寻找TTRoundedLeftArrowShapeand TTRoundedRightArrowShape,它看起来像一个标准的 iPhone 后退按钮。

于 2010-07-20T18:39:38.030 回答
1

我查看了源代码并填写了缺失的逻辑来绘制对话气泡左侧和右侧的边缘。

你可以在这里找到代码。

addRightEdge的更改:

if (_pointLocation > 135 && _pointLocation < 225) {
  CGFloat pw = _pointAngle >= 90 && _pointAngle < 270 ? _pointSize.width : -_pointSize.width;
  CGFloat pointY = ((_pointLocation-135)/90)*fh;
  CGPathAddLineToPoint(path, nil, fw, pointY-floor(_pointSize.height/2));
  CGPathAddLineToPoint(path, nil, fw+pw, pointY);
  CGPathAddLineToPoint(path, nil, fw, pointY+floor(_pointSize.height/2));
}

addLeftEdge的更改:

if ((_pointLocation > 315 && _pointLocation <= 360)
    || (_pointLocation >= 0 && _pointLocation < 45)) {
  CGFloat pw = ((_pointAngle >= 270 && _pointAngle <= 360)
                || (_pointAngle >= 0 && _pointAngle <= 90))
    ? _pointSize.width
    : -_pointSize.width;
  CGFloat pointY = (_pointLocation > 315 && _pointLocation <= 360)
    ? fh-(((_pointLocation-315)/90)*fh)
    : (fh/2)-((_pointLocation/90)*fh);
  CGPathAddLineToPoint(path, nil, 0, pointY+floor(_pointSize.height/2));
  CGPathAddLineToPoint(path, nil, -pw, pointY);
  CGPathAddLineToPoint(path, nil, 0, pointY-floor(_pointSize.height/2));
}
于 2011-05-14T01:10:10.007 回答