title: Best way to draw line between fix CGPoint and moving UIView object's center point
body: <p>I have a UIView subclass object that animates and therefore changes its position over time as a subview in my UIViewController's view. Actually my moving UIView subclass is just an image of a ball and it's moving as if it was hanging down from my devices screens top border. But to be a real pendulum I'd like to also draw a line between my ball and the CGPoint it hangs down from on top of my screen.</p>
  
  <p>My idea was to just draw a line every time the UIView changes its position. But as the moving is done within an iOS API (I'm just calling something like <code>[myBallView swing]</code>) I can't do this at the same place the movement is happening. I'm actually not animating the view myself.</p>
  
  <p>The only solution I have in my mind to solve my issue is pretty bad: subclassing UIView, adding it as a superview to my moving UIView and adding a line every time <code>drawRect</code> is called. But I'm not even sure <code>drawRect</code> is going to be called there. Either way, there must be a better solution for this.</p>
  
  <p>Does anyone know a good solution to my problem?</p>