我想将“TheButton”设置为禁用,将“TheLastButton”设置为不隐藏。 TheButton将禁用,但TheLastButton只是保持隐藏状态。 这是代码:
-(IBAction)buttonPressed:(id)sender{
NSButton *TheButton = sender;
[TheButton setEnabled: NO];
[_spinner setHidden:NO];
[_spinner setIndeterminate:YES];
[_spinner setUsesThreadedAnimation:YES];
[_spinner startAnimation:nil];
NSLog(@"started");
//1
NSTask *task = [[NSTask alloc] init];
//2
task.launchPath = @"/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister";
[task setArguments:[NSArray arrayWithObjects: @"-kill", @"-seed", @"-r", @"-f", @"-v", @"-domain local", @"-domain user", @"-domain system", nil]];
NSLog(@"finished");
[_spinner setHidden:YES];
NSButton *TheLastButton = sender;
[TheLastButton setHidden:NO];