chrismiles/CMPopTipView — pull request #22 by jianfeng (2012-08-20 09:54:32+00:00)
Title: Add property defaultDirection and PointDirectionUnknown

So when calculate pointerY, it can judged by defaultDirection.

pointDirection = _defaultDirection;
CGPoint targetOriginInContainer = [targetView convertPoint:CGPointMake(0.0, 0.0) toView:containerView];
CGFloat sizeBelow = containerView.bounds.size.height - targetOriginInContainer.y;
if (pointDirection == PointDirectionUnknown) {
if (sizeBelow > targetOriginInContainer.y) {
pointerY = targetOriginInContainer.y + targetView.bounds.size.height;
pointDirection = PointDirectionUp;
}
else {
pointerY = targetOriginInContainer.y;
pointDirection = PointDirectionDown;
}
}
else {
if (pointDirection == PointDirectionDown) {
pointerY = targetOriginInContainer.y;
}
else {
pointerY = targetOriginInContainer.y + targetView.bounds.size.height;
}
}