问题标签 [nsbutton]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1467 浏览

cocoa - 具有两个组合图像的 NSButton (Cocoa OSX)

我想制作一种类似于 OSX 上的操作按钮的弹出按钮。我需要让按钮有两个图像构成按钮的表示(按钮的图标和旁边的向下的显示三角形)。我在想也许我可以将第二个图像添加为按钮的子视图,但似乎应该有一种更简单的方法来做到这一点。有任何想法吗?

0 投票
3 回答
929 浏览

objective-c - NSButton 数组

我想知道我是否可以做类似的事情

事实证明,在界面生成器中看不到 aButton。

我的应用程序有很多按钮,我想看看是否有办法使用循环来迭代所有按钮的状态。

0 投票
5 回答
10204 浏览

cocoa - Cocoa:当光标在 NSButton 上时更改光标

当光标位于 NSButton 上方时,如何更改光标?

0 投票
1 回答
60 浏览

objective-c - 如何使用我的应用程序上的按钮来设置 WebView 显示的当前 URL?

如何使用我的应用程序上的按钮来设置 WebView 显示的当前 URL?

0 投票
2 回答
1757 浏览

cocoa - NSButton 蓝色高亮

我想制作开/关渐变NSButton,但使用蓝色突出显示,如NSTabView选择按钮。
是否有可能使这种简单的方法?
或者我应该手动绘制这个?
如果我应该手动绘制这个,最好的方法是什么?(CIFilter或只是NSGradient

谢谢。

0 投票
2 回答
1480 浏览

objective-c - 以编程方式使 Cocoa Button 看起来像被按下

我有一些关键事件,也对应于按钮。我必须设置/调用什么属性/方法才能让按钮看起来很沮丧(改变状态?)说半秒钟?

0 投票
2 回答
5155 浏览

cocoa - Key Value Observing 和 NSButton 状态

我正在尝试观察复选框状态并在复选框状态更改时在应用程序中进行适当的更改。在使用复选框管理窗口的窗口管理器中,我有以下观察者设置:

我还将 myCheckBox 连接到文件所有者(即窗口控制器)到窗口中的适当复选框。但是,当我运行我的应用程序observeValueForKeyPath:ofObject:change:context:方法时,它永远不会被调用。

我究竟做错了什么?

0 投票
1 回答
1969 浏览

cocoa - 如何使用延迟的 NSMenu 创建 NSButton?

在 Cocoa 中,我想创建一个带有延迟菜单的 nsbutton。即,当点击它应该调用动作方法并且当它保持在按下状态2秒时它应该显示一个nsmenu。

它类似于 Xcode 工具栏中的“构建活动目标”按钮。

问候,

达纳拉杰。

0 投票
1 回答
634 浏览

core-data - NSButton,绑定问题

我正在尝试使用核心数据的可可应用程序。该应用程序包含一个实体:UsefulUrl,其属性为:url。输入的 url 显示在表格视图中。

我可以通过可可绑定(NSArrayController)从表中插入、修改和删除输入的 url。

现在,

我想在浏览器中打开选定行的 url,单击一个按钮,使用可可绑定。

我想我可以通过按钮的绑定来做到这一点:Action Invocation - Argument/Target,但我无法让它工作。

谁能建议我确切的操作方法或一些有用的网址?

谢谢,

米拉杰

0 投票
4 回答
2591 浏览

cocoa - How to handle assertion failure on NSButton lockFocus when using modalWindow on quit?

a button's IBAction in windowA calls runModalForWindow:windowB.

windowB becomes key and modal.

windowB has a popUpWindowDatePicker which calls stopModal upon display, and then popUpWindowDatePicker becomes key, and windowB resigns key and is not modal. no window is modal at this point.

when popUpWindowDatePicker is dismissed, its didResignFirstResponder method sets a boolean to YES. windowB then becomes key, and windowB's windowController windowDidBecomeKeyNotification fires, checks the boolean value and if it is YES calls runModalForWindow:self.window.

now windowB is modal and key. windowA is still open, but not key.

windowB has Okay and Cancel buttons which call: [NSApp stopModalWithCode:returnCode] and then orderOut: and close on windowB.

if the popUpWindowDatePicker is used, and then any time after that windowB is closed with Okay or Cancel, an Assertion Failure is called involving the Okay or Cancel buttons:

if windowB is closed with Okay or Cancel and popUpWindowDatePicker has not been used, there is no assertion failure.

it seems that the sequence runModal-stopModal-runModal-stopModal on windowB is involved in the failure of lockFocus on the button pressed, but i can't find a way to trace down more than this to solve this problem.

can anyone offer any hints or thoughts?