I have an IBAction with some simple code inside:
-(IBAction)change:(id)sender {
[textfield setHidden:NO];
[self dolengthyaction];
}
'textfield' is an NSTextField in a nib file, and -'dolengthyaction' is a function that takes about a minute to finish executing.
My question is: Why isn't the textfield shown until AFTER "dolengthyaction" is done executing? I want it to be revealed before the dolengthyaction starts taking place. Is this an inherent problem or is there something wrong with my code? (or in another part of my code?)
I'm still not very good at programming so I apologize if I worded something badly and formatted something wrong.
EDIT: There isn't much else other than this IBAction and -dolengthyaction...
-(void)doLengthyAction {
sleep(10);
}
-(IBAction)change:(id)sender {
[textfield setHidden:NO];
[self doLengthyAction];
[textfield setHidden:YES];
}
All I really want to do is display the label when the action is running and hide it when it's done.
Basically what this means is that it's not displaying at all right now.
In reality, in -doLengthyAction it's not sleep(10) but rather a NSFileManager operation that copies about 50 Mb of material. The code was rather long, but if you want me to post it I can. I tested it with sleep() but it doesn't work either.