ThreeTTS中的TTSpeechBubbleShape仅绘制“语音”三角形的顶部和底部
问题描述:
因此,我正在使用iPhone应用程序的Three20库,并且想要使用TTSpeechBubbleShape样式来查看视图。但三角形似乎不想在左侧或右侧绘制。我从源头上看到它有很多几何体,并且想知道是否有人解决了这个问题,或者知道如何解决这个问题。ThreeTTS中的TTSpeechBubbleShape仅绘制“语音”三角形的顶部和底部
答
您可能正在寻找TTRoundedLeftArrowShape
和TTRoundedRightArrowShape
,它看起来像一个标准的Back iPhone按钮。
答
我查看了源代码,并填入了缺少的逻辑,为语音气泡的左侧和右侧绘制边缘。
您可以找到代码here。
更改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));
}
提问者应该纪念这个答案是正确的。美丽和简单的投入。我使用Three20 1.0.5(迄今为止最新),并且这个代码是缺少的形式,虽然我希望你提交了一个拉请求。干杯!并感谢修复! – Brett 2011-06-24 12:16:43