首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何正确地在macOS Catalina上添加旋转器,因为Style.spinning是不推荐的?

如何正确地在macOS Catalina上添加旋转器,因为Style.spinning是不推荐的?
EN

Stack Overflow用户
提问于 2020-05-20 04:30:20
回答 1查看 607关注 0票数 2

我总是像这样用NSProgressIndicator创建一个旋转器

代码语言:javascript
复制
let spinner = NSProgressIndicator()
spinner.style = .spinning

它工作得很好,但是我最近发现NSProgressIndicator.Style.spinning被废弃了。我已经搜索过了,但是还没有找到在macOS上创建一个旋转器的推荐方法。有人能帮忙吗?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-20 14:21:31

这看起来像是文档中的一个错误。在macOS 10.15中,不推荐NSProgressIndicatorBarStyleNSProgressIndicatorSpinningStyle。不知何故,NSProgressIndicatorStyleBarNSProgressIndicatorStyleSpinning、Swift中的.bar.spinning在文档中也不推荐,但它们不在NSProgressIndicator.h中。

代码语言:javascript
复制
typedef NS_ENUM(NSUInteger, NSProgressIndicatorStyle) {
    NSProgressIndicatorStyleBar = 0,
    NSProgressIndicatorStyleSpinning = 1
};

代码语言:javascript
复制
/* Please instead use the more modern versions of these constants.
 */
static const NSProgressIndicatorStyle NSProgressIndicatorBarStyle API_DEPRECATED_WITH_REPLACEMENT("NSProgressIndicatorStyleBar", macos(10.2,10.14)) = NSProgressIndicatorStyleBar;
static const NSProgressIndicatorStyle NSProgressIndicatorSpinningStyle API_DEPRECATED_WITH_REPLACEMENT("NSProgressIndicatorStyleSpinning", macos(10.2,10.14)) = NSProgressIndicatorStyleSpinning;
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61905147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档