Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-12-2010, 11:33 AM   #5 (permalink)
bluelobster
Registered Member
 
Join Date: Mar 2010
Posts: 20
Default

Quote:
Originally Posted by georgeburns View Post
I'm not seeing any code for the threading.
Oh here you go...

Code:
- (void) spawnThread
{
  [NSThread detachNewThreadSelector:@selector(loadLevel) toTarget:self withObject:nil];
}

// level load
- (void) loadLevel
{
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

  // do some stuff
  
  // update shared variable
  percentDone += x;

  // do more stuff

  // update percentDone
  percentDone += x;

  [pool release];
}

// render
- (void) render
{
  // figure out the bar length
  barLength = barLength * percentDone;
  // render the bar
  [bar render];

  // render rest of the scene
}
bluelobster is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,860
Threads: 89,223
Posts: 380,683
Top Poster: BrianSlick (7,129)
Welcome to our newest member, randybourassa
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:27 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.