質問編集履歴

1

ソースコードの追加

2022/12/20 15:13

投稿

masakichi41
masakichi41

スコア0

test CHANGED
File without changes
test CHANGED
@@ -19,6 +19,19 @@
19
19
  `NSToolbarItem.minSize and NSToolbarItem.maxSize methods are deprecated. Usage may result in clipping of items. It is recommended to let the system measure the item automatically using constraints.`
20
20
 
21
21
  - `windowWillResize`で`minSize`を動的に変更する
22
+ ```swift:WindowController.swift
23
+ import Cocoa
24
+
25
+ class WindowController: NSWindowController, NSWindowDelegate {
26
+ @IBOutlet weak var toolbarItem: NSToolbarItem!
27
+
28
+ func windowWillResize(_ sender: NSWindow, to frameSize: NSSize) -> NSSize {
29
+ toolbarItem.minSize.width = frameSize.width - 86
30
+ return frameSize
31
+ }
32
+ }
33
+
34
+ ```
22
35
  期待通り動作しますが下記の警告メッセージが出力されました。
23
36
  `'minSize' was deprecated in macOS 12.0: This property is no longer recommended. Instead, let the system automatically measure the size of the view using constraints.`
24
37