2017-04-13 57 views

回答

0

NSButton具有適合其內容的intrinsicContentSize,以及750(NSLayoutPriorityDefaultHigh)的默認horizontal contentHuggingPriority,這意味着它將強烈嘗試匹配該內容寬度。

您可以decrease that hugging priority(例如[button setContentHuggingPriority:1.0 forOrientation:NSLayoutConstraintOrientationHorizontal]),以便它能夠更好地遠離該內容,並在此情況下填充觸摸欄中的額外空間。

+0

非常感謝您的幫助!它像一個魅力:) – SWLC