iPhone Development -CGPoint & NSTimer help
<p>i want to jump balls in a specific field in the view,
the problem is that i don't know how to define the positions of this field area and movement.
also 
here is the code that i use to move the ball in the entire view (the ball object is a uiimageview on the view).
thanks.</p>

<p>-(void) onTimer {
    ball.center = CGPointMake(ball.center.x+pos.x,ball.center.y+pos.y);</p>

<pre><code>if(ball.center.x &gt; 320 || ball.center.x &lt; 0)
 pos.x = -pos.x;
if(ball.center.y &gt; 460 || ball.center.y &lt; 0)
 pos.y = -pos.y;
</code></pre>

<p>}</p>

<p>// Implement viewDidLoad to do additional setup after loading the view.
- (void)viewDidLoad {
    pos = CGPointMake(14.0,7.0);</p>

<pre><code>[NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
</code></pre>

<p>}</p>
