nsthread

objective-c/iphone: how to set that all methods of some object will run on a specific thread?

Hi guys, here is what i want: create an object that 'lives' in its own thread, all the methods should be executed in that thread. i.e: // i'm in the main thread MyClass *myObject = [ [MyClass alloc] init ]; // it creates its own thread [myObject method1]; // should execute the method1 in myObject's thread [myObject method2]...

UIProgressView progress doesn't updated

I have a UIProgressView added to self.view as subview. I have a UITableView with rows loaded. I need image in every row but I don't want the app to wait for all of them, so I decide to run NSThread with loading images process. When I try to update progress of the UIProgressView from inside my thread - it doesn't get updated. Do I need t...

StatusItem menu blocks main thread when it's opened. Workaround?

I've written an app for the Mac that is designed as a status bar item. However, when a user opens its menu from the status bar, the main run loop is blocked until it's closed. Since this app responds to messages on a socket, it's a problem that it can't do anything while the menu is open. I've tried setting the status item from a separa...

How to do calculations only for visible cells in iPhone?

Hi all, I have so many cells in table view say nearly 500. Each and every cells have their own images and string paragraphs. Actually i draw those images & strings with the help of UIView's drawRect method. So i need to calculate image and each string's position (including their width & height to measure the cell height and wrapping are...

How to wait for a thread to finish in Objective-C

I'm trying to use a method from a class I downloaded somewhere. The method executes in the background while program execution continues. I do not want to allow program execution to continue until this method finishes. How do I do that? ...

How should this code be changed to work correctly?

I downloaded some code from http://github.com/matej/MBProgressHUD to show a progress meter when doing something. This is the code that makes the progress meter pop up. [HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES]; This will show a progress meter while the method myTask is running. The strange ...

Image not appearing in detachNewThreadSelector

Hello, I am having trouble with my game and was wondering if anyone can help? I am loading an overlay image on the screen when a user clicks on an answer in my quiz game, the image is of either a tick or cross to indicate if the answer was correct. The image is being loaded in a new thread. The problem is that the image does not appe...

NSInvocationOperation Question

Hello all, I would like to know how to remove duplicate nsoperations, i.e is there a way to check the nsoperation queue and see if I am making a duplicate request? Basically, I am requesting images depending on the iphone screen rotation. When the view is loaded the shouldautorate is called twice. If(rotation==portrait){ request ...

problem in saving video with nsthread

Hi I am making a ipad application , in this i am having one table view and on selection of table did select cell method i am saving different videos to NSBundle (i.e. locally to my ipad ) Now when processing of saving one video is being going on and till the video is not saved, if i click on the other cell and wait for the video to...

NSThread - get bool value

Hello, I am trying to get the boolean value that's returned by -(BOOL)backupDropletUpdateAvailable through NSThread. To do this, I've tried the following: ` BOOL isAvailable = NO; [NSThread detachNewThreadSelector:@selector(backupDropletUpdateAvailable) toTarget:isAvailable withObject:nil]; if (isAvailable == YES) {//etc Which r...

NSTimer or NSThread in iOs 4 background mode

I have to keep a NSThread or NSTimer when my iPhone application goes into background mode. Is it possible ? I have enabled the background modes in info.plist and opened readstream and writestream as follows ...(I am using UDP) CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType,kCFStreamNetworkServiceTypeVoIP); CFWrite...

Objective C - NSthread & NSAutoreleasePool?

What is the best way to write a thread safe method? I have the following method, sometimes i want to call it asynchronously (call it through a thread) And sometimes i want to call it directly on the main thread. Is there a problem with keeping the pool (alloc, release) even if I am not calling the method on a separate thread? - (void)d...

NSThread detachNewThreadSelector???? uh?

Hi, I was looking through the Threading Programming which I have to say it's really good. Specially I was looking on How to configure Port-based input sources for running loops. And I see this piece of code // Detach the thread. Let the worker release the port. [NSThread detachNewThreadSelector:@selector(LaunchThreadWithPort:) ...

calling a method that changes nib properties using detachNewThreadSelector

I' m calling doSaveItems: like [NSThread detachNewThreadSelector:@selector(doSaveItems:) toTarget:self withObject:aObject]; doSaveItems: method has a code that references to one of my Outlets: [uiProgressLedIdle setHidden:YES]; of course I'm setting an autorelease pool inside this method. The problem is that [uiProgressLedIdle setH...