comboBoxSelectionDidChange 给了我以前选择的值 [英] comboBoxSelectionDidChange gives me previously selected value

查看:30
本文介绍了comboBoxSelectionDidChange 给了我以前选择的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将此通知用于 NSComboBox.唯一的问题是当我在下拉列表中选择不同的项目时,它总是在组合框中显示以前选择的值.如何获取当前选定的值.我需要根据值启用/禁用一些控件.

I am using this notification for NSComboBox. Only problem is when I select a different item in the dropdown it always show previously selected value in the combo box. How can I get the currently selected value. I need to make some controls enable/disable based on the value.

- (void)comboBoxSelectionDidChange:(NSNotification *)notification {
        NSComboBox *comboBox = (NSComboBox *)[notification object];

        NSLog(@"[comboBox stringValue] : %@", [salaryBy stringValue] );
}

推荐答案

I got the selected value using:

I got the selected value using:

NSString *strValue = [comboBox itemObjectValueAtIndex:[comboBox indexOfSelectedItem]];

这篇关于comboBoxSelectionDidChange 给了我以前选择的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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