カスタム UIView (つまり、左上から右下) に線を引く必要があります。ただし、私の知る限り、座標系は異なります。
これらの 2 つの座標系の間をどのように変換できますか?
カスタム UIView (つまり、左上から右下) に線を引く必要があります。ただし、私の知る限り、座標系は異なります。
これらの 2 つの座標系の間をどのように変換できますか?
As long as we are talking about UIView objects that are subview of some other UIView object - the quite normal case - each View is positioned in relation to its next super view. The top left corner of the superview is (0,0).
For most applications that simply works fine. In rather rare cases there may be a need to transform coordinates from one views's sub-view-coordinate-system to that of another view. UIView provides the methods
– convertPoint:toView:
– convertPoint:fromView:
– convertRect:toView:
– convertRect:fromView:
for that usage. They work quite fine. Before you make use of them you should re-think whether that is required and evaluate whether your current view hierarchy could do with a re-desin. :)
座標系が何であれ、それを描画してみませんか? 座標系は気にしないでください。