Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bboyjayz

macrumors member
Original poster
Mar 20, 2009
55
0
hi,
i've got a problem, i've searched on the forum but my problem isn't resolved... so, i've got my main vieWcontroller, which create another thread to move a ball on the screen, without stop all event...
my ball (an IBOutlet UIImageView) is on the class of the mainViewController, and its center is changed on the thread created... but it is not refesh on the screen... and when the program exite, i see just for 1 seconde, the ball on its new center... :s
i don't know how to do... can you help me ???
 

Jeremy1026

macrumors 68020
Nov 3, 2007
2,215
1,029
hi,
i've got a problem, i've searched on the forum but my problem isn't resolved... so, i've got my main vieWcontroller, which create another thread to move a ball on the screen, without stop all event...
my ball (an IBOutlet UIImageView) is on the class of the mainViewController, and its center is changed on the thread created... but it is not refesh on the screen... and when the program exite, i see just for 1 seconde, the ball on its new center... :s
i don't know how to do... can you help me ???

Run a timer on the background thread to update the location of the ball on the main thread.
 

bboyjayz

macrumors member
Original poster
Mar 20, 2009
55
0
hmm sorry but what do you meen by "Timer", i've never used that yet... :s

PS: nice name...same as me (sorry for my english...i'm french)
 

bboyjayz

macrumors member
Original poster
Mar 20, 2009
55
0
do you have an exemple of how to use NSTimer?
for the moment, my code is like that:
while(true){
NSLog(@"coucou");
CGPoint c = controller.ball.center;
c.y--;
[controller setBallCoordonnees:c];
[NSThread sleepForTimeInterval:time];
}

contoller is on my main thread, setBallCoordonnee just change center of my ball, how can i refresh the screen ;.. that is the question :(
 

bboyjayz

macrumors member
Original poster
Mar 20, 2009
55
0
thank you for your helps, i've resolved my problem, using NSTimer, with a tutorial doing exactly what i want my program do ... ^^
thank youuu
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.