我总是像这样用NSProgressIndicator创建一个旋转器
let spinner = NSProgressIndicator()
spinner.style = .spinning它工作得很好,但是我最近发现NSProgressIndicator.Style.spinning被废弃了。我已经搜索过了,但是还没有找到在macOS上创建一个旋转器的推荐方法。有人能帮忙吗?
谢谢
发布于 2020-05-20 14:21:31
这看起来像是文档中的一个错误。在macOS 10.15中,不推荐NSProgressIndicatorBarStyle和NSProgressIndicatorSpinningStyle。不知何故,NSProgressIndicatorStyleBar和NSProgressIndicatorStyleSpinning、Swift中的.bar和.spinning在文档中也不推荐,但它们不在NSProgressIndicator.h中。
typedef NS_ENUM(NSUInteger, NSProgressIndicatorStyle) {
NSProgressIndicatorStyleBar = 0,
NSProgressIndicatorStyleSpinning = 1
};和
/* 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;https://stackoverflow.com/questions/61905147
复制相似问题