I have 2 points in a UIView, but I am unable to get the correct line equation between these two points 开发者_如何学运维because UIView coordinate system is not cartesian. When I apply the cartesian slope of a line, I keep getting the wrong slope for the UIView coordinate system. Maybe I'm applying the identity matrix incorrectly or using the wrong identity matrix. Do I need to translate the point-slope form equation too? I'm not sure. Any help would be greatly appreciated.
Are you getting the wrong slope because the CG coordinate system is flipped/mirrored upside-down between the iPhone and Mac OS? If so then just change dy to -dy in your slope equation.
精彩评论