Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 正在将加载gif添加到NSAlert_Objective C_Macos_Nsprogressindicator_Nsalert - Fatal编程技术网

Objective c 正在将加载gif添加到NSAlert

Objective c 正在将加载gif添加到NSAlert,objective-c,macos,nsprogressindicator,nsalert,Objective C,Macos,Nsprogressindicator,Nsalert,我想在我的NSAlert中添加一个加载gif,我已经尝试过了,但似乎不起作用: NSProgressIndicator * gif; gif.style = NSProgressIndicatorSpinningStyle; [gif startAnimation:self]; NSAlert *alert = [[NSAlert alloc] init]; [alert setInformativeText:@"Please check your internet connection an

我想在我的NSAlert中添加一个加载gif,我已经尝试过了,但似乎不起作用:

NSProgressIndicator * gif;
gif.style = NSProgressIndicatorSpinningStyle;
[gif startAnimation:self];

NSAlert *alert = [[NSAlert alloc] init];
[alert setInformativeText:@"Please check your internet connection and try again."];
[alert setMessageText:@"Connection Error"];
[alert setAlertStyle:NSWarningAlertStyle];
[alert setAccessoryView:gif];
[alert runModal];

知道我做错了什么吗?

进度指示器已声明但未初始化。
NSProgressIndicator*gif=[[NSProgressIndicator alloc]initWithFrame:NSMakeRect(0.0f,0.0f,20.0f,20.0f)]?指定的初始值设定项是
initWithFrame:
有什么问题吗。a) 它没有出现b)它没有动画更新您的问题