【发布时间】:2016-10-05 02:49:32
【问题描述】:
图片左边一个是苹果的日期和时间,一个是我的应用程序。正如您所见,我的应用程序的文本看起来比 Apple 的要低。哪个看起来不漂亮。如何解决?
self.statusBarItem.image = nil
self.statusBarItem.button?.imagePosition = .NoImage
self.statusBarItem.button?.title = "Sun 5 Jun 13:35"
【问题讨论】:
-
我没有使用约束。您看到的代码是我使用的代码,除了顶部的'let statusBarItem = NSStatusBar.systemStatusBar().statusItemWithLength(NSVariableStatusItemLength)'
-
我能够与以下代码对齐:“button.frame = CGRectMake(0.0, 0.5, button.frame.width, button.frame.height)” 手动更正偏移量,但也许有人有更好的解释。
-
@Mark 你能把代码分享到 GitHub 或类似的地方,以便我看看吗?
-
或者为什么不嵌入导航控制器?
-
所有都不起作用,因为它需要在状态项按钮上完成。偏移量对我来说实际上是一个足够好的工作。很抱歉给大家添麻烦了。我正在尝试删除问题,但尚未成功。
标签: swift macos statusbar nsbutton nsstatusitem