Objective c 在elCapitan中更新NSPROGRESS指示器
更新NSProgressIndicator在el Capitan中不再起作用。以前习惯了。 你也注意到了吗?下面是我的代码示例。还有一个NSTextfield应该包含递增的值,该值也不会更新。您只能在循环结束时获得最终图像。我给苹果公司填了一份错误报告 AppDelegate.h文件Objective c 在elCapitan中更新NSPROGRESS指示器,objective-c,osx-elcapitan,Objective C,Osx Elcapitan,更新NSProgressIndicator在el Capitan中不再起作用。以前习惯了。 你也注意到了吗?下面是我的代码示例。还有一个NSTextfield应该包含递增的值,该值也不会更新。您只能在循环结束时获得最终图像。我给苹果公司填了一份错误报告 AppDelegate.h文件 #import <Cocoa/Cocoa.h> @interface AppDelegate : NSObject <NSApplicationDelegate>{ IBOutl
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>{
IBOutlet NSProgressIndicator * indicateurDeRecherche1;
IBOutlet NSProgressIndicator * indicateurDeRecherche2;
IBOutlet NSTextField * textValeur;
}
- (IBAction)demarre:(id)sender;
@end
#导入
@接口AppDelegate:NSObject{
IBS出口程序指示器*指示Urderecher1;
IB出口程序指示器*指示Urderecherche2;
IBOutlet NSTextField*textValeur;
}
-(IBAction)demarre:(id)发送方;
@结束
AppDelegate.m文件
#import "AppDelegate.h"
@interface AppDelegate ()
@property (weak) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
- (IBAction)demarre:(id)sender{
NSLog(@"Demarre");
[indicateurDeRecherche1 setMaxValue:100];
[indicateurDeRecherche1 startAnimation:self];
[indicateurDeRecherche2 setMaxValue:100];
[indicateurDeRecherche2 startAnimation:self];
[indicateurDeRecherche1 setDoubleValue:0.0];
[indicateurDeRecherche2 setDoubleValue:0.0];
for (int i = 0; i < 10000; i++) {
[indicateurDeRecherche1 setDoubleValue:(double)i/200.0];
[indicateurDeRecherche1 displayIfNeeded];
[indicateurDeRecherche2 setDoubleValue:(double)i/200.0];
[indicateurDeRecherche2 displayIfNeeded];
[indicateurDeRecherche1 needsDisplay];
//NSLog(@"increment %i",i);
NSString * valeurIncrement = [NSString stringWithFormat:@"%i",i/100];
[textValeur setStringValue:valeurIncrement];
}
[indicateurDeRecherche1 stopAnimation:self];
[indicateurDeRecherche2 stopAnimation:self];
NSLog(@"Demarre fin");
}
@end
#导入“AppDelegate.h”
@接口AppDelegate()
@属性(弱)窗口*窗口;
@结束
@实现AppDelegate
-(无效)ApplicationIDFinishLaunching:(NSNotification*)通知{
//在此处插入代码以初始化应用程序
}
-(无效)申请将终止:(NSNotification*)通知{
//在此处插入代码以删除应用程序
}
-(iAction)demarre:(id)发送方{
NSLog(@“Demarre”);
[指示Urdereche1设置最大值:100];
[指示Urderecherche1起始图像:self];
[指示Urdereche2设置最大值:100];
[指示Erdereche2起始图像:self];
[IndicatateUrderecheche1 setDoubleValue:0.0];
[IndicatateUrderecheche2 setDoubleValue:0.0];
对于(int i=0;i<10000;i++){
[IndicatateUrdereche1 setDoubleValue:(双精度)i/200.0];
[如有需要,指示Urdereche1显示];
[IndicatateUrdereche2 setDoubleValue:(双精度)i/200.0];
[如有需要,指示Urdereche2显示];
[指示需要显示的Urdereche1];
//NSLog(@“增量%i”,i);
NSString*valeurIncrement=[NSString stringWithFormat:@“%i”,i/100];
[textValeur设置字符串值:valeurIncrement];
}
[指示停止动画:self];
[指示停止动画:self];
NSLog(“Demarre fin”);
}
@结束