UISegmentedControl取消选择(不选择任何段) [英] UISegmentedControl deselect (make none of the segments selected)

查看:199
本文介绍了UISegmentedControl取消选择(不选择任何段)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上标题包含我的问题。
我有一个UISegmentedControl,需要取消选择当前选中的选项卡。
我试过:

in fact the title contains my question. I have a UISegmentedControl, and need to deselect currently selected tab. I tried:

[menu setSelectedSegmentIndex:-1];

菜单是uisegmentedcontrol的UBOutlet,但这给了我一个例外。
任何人都有一些想法?
谢谢
peter

menu being the UBOutlet for uisegmentedcontrol but this gives me exception. anyone have some idea? thanks peter

推荐答案

我认为你已经打电话给 [ myArray length] 而不是代码中某处的 [myArray count] 。 NSArray使用count方法,而不是它包含的项目数的长度。

I would assume that you've called [myArray length] instead of the proper [myArray count] somewhere in your code. NSArray uses the count method, not length for the number of items it contains.

这篇关于UISegmentedControl取消选择(不选择任何段)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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