A game loop gets your code to update the game world on your iPhone or iPad many times a second — fast enough to make it look like fluid motion to the player.
To do this, you need to update the position of all your views every time the screen is redrawn by iOS. To be notified of when this happens, you need to use a CADisplayLink class. CADisplayLink is an object that, when you create it, sends your class a message just before the screen is about to update. This gives you the opportunity to move your views around.
To set up a CADisplayLink.
-
Create a method that gets called when the screen updates; make the method look like this:
(void) update:(CADisplayLink*)displayLink { }
-
When your view is loaded, create and prepare a CADisplayLink object by adding this code to the viewDidLoad: method in your view controller’s .m file:
displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(update:)]; [displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
3 Comments
like this before. So wonderful to find another person with some unique thoughts on
this subject matter. Really.. many thanks for starting this up.
This website is something that is needed on the internet, someone with a little originality!
streetdirectory
and actual effort to create a very good article… but what can I say… I procrastinate a lot and never
seem to get nearly anything done.streetdirectory :: http://www.streetdirectory.com/businessfinder/company/9421/Paediatrician_Specialist :
:
Your favourite justification seemeԁ to be at the net the easіest factor to take note of.
I sаy to you, I certainly get annoyеԁ at the same time
as folks think аbout worries that they just do not knoω аbout.
You mаnageԁ to hit the nail uрon the toρ and also defined out the ωhole
thing without having sidе effeсt , people could take а signal.
Will probably bе back to get mοre.
Thankѕ
my homepagе :: http://bikeraсeсheats.
com/ ()
Be the first to comment!
Don't just read and walk away, Your Feedback Is Always Appreciated. I will always reply to your queries.
Regards:
Noble J Ozogbuda
Back To Home