NSPopUpButton类型为Pull Down,当我单击某些菜单项时,弹出窗口的标题未更改 [英] NSPopUpButton of type pull Down , when i click on some menu item ,title of popup is not getting changed

查看:182
本文介绍了NSPopUpButton类型为Pull Down,当我单击某些菜单项时,弹出窗口的标题未更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:

  1. 采用类型为Pull down的NSPopupButton的实例.

在弹出菜单中添加一些菜单项.

Add few menu items to the pop up.

运行代码.

在弹出窗口中选择任何菜单项

Select any menu item in the popup

  • 弹出按钮的标题未更改.
  • 我需要将所选项目显示为Popup的标题,与NSPopupButton的正常行为相同,但类型为下拉.
  • 还需要添加与标题相同的名称.
  • Title of popup button is not getting changed.
  • I need to show the selected item as title of Popup same as Normal behaviour of NSPopupButton but with the type pull down.
  • Also Need to add an item as same name as title.

有人可以帮助我实现这一目标吗?

Can anybody help me to achieve this?

推荐答案

来自

与弹出列表不同,显示下拉列表的弹出按钮的标题不是基于当前选定的项,因此除非您使用单元格的setTitle:方法进行更改,否则其将保持固定.

Unlike popup lists, the title of a popup button displaying a pulldown list is not based on the currently selected item and thus remains fixed unless you change using the cell’s setTitle: method.

如果希望将所选项目显示为标题,最简单的方法是使用弹出窗口而不是下拉菜单.或每次更改选择时呼叫setTitle:.

If you want the selected item to be shown as title, the easiest way is to use a popup instead of pulldown. Or call setTitle: every time you change the selection.

这篇关于NSPopUpButton类型为Pull Down,当我单击某些菜单项时,弹出窗口的标题未更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆