问题标签 [uiswitch]

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 投票
3 回答
28546 浏览

iphone - 更改 UISwitch 上的文本

UISwitch 当前显示 ON 和 OFF。我可以将文本更改为“是”和“否”吗?

会很难吗?还是我只是改写我问用户的问题?

0 投票
2 回答
2795 浏览

iphone - 如何在不使用 InterfaceBuilder 的情况下将 UISwitch(切换开关)添加到 UIToolBar

如何在不使用 InterfaceBuilder 的情况下将 UISwitch(toggle switch) 添加到 UIToolBar ?它不是系统项目,所以我无法使用

如何以相同的方式添加拨动开关?
谢谢你。

0 投票
1 回答
1730 浏览

iphone - UITableView 标题选择

谁能解释我如何检测表视图标题视图中的选择,如 tableView:didSelectRowAtIndexPath: ?这对我来说非常有用。我已将标题定义为 UITableCellView,因此我可以将 UISwitch 作为附件视图附加,它工作得很好,但现在我无法检测到开关中所做的更改。有什么建议么?

0 投票
2 回答
2889 浏览

iphone - 添加uiswich作为导航项

我可以通过哪种方式以编程方式将 uiswitch 添加为导航项或 btw 在我的导航栏上?我要疯了 :D

0 投票
4 回答
35593 浏览

iphone - iPhone:将布尔值保存到核心数据中

我已将我的核心数据属性之一设置为布尔值。现在,我需要设置它,但 XCode 一直告诉我它可能无法响应 setUseGPS。

在核心数据中设置布尔值的方法是什么?我所有的其他属性都是这样设置的,而且效果很好。所以,不知道为什么布尔值不能以这种方式设置?

0 投票
3 回答
1172 浏览

iphone - Bottom part of UISwitch is cut off on the device but displays normal on the Simulator

The UISwitch on my device: Switch Image with the bottom pixels cut off http://gorgando.com/uiswitch.jpg

The UISwitch on the simulator: Good UISwitch http://gorgando.com/uiswitch-good.png

As you can see, the bottom pixels are cut off on the device, but not on the simulator. I have tried just about everything I can think of, but nothing has fixed the problem.

Some of the things I've tried:

  • Changing the UISwitch's frame's height
  • Changing the UICell's height
  • Changing the UICell's contentView's height
  • Adding the UISwitch to the UICell rather than the UICell's contentView

Here is the relevant code:
This is in the viewDidLoad of the uiTableViewController:

This is where the switchWithLeftText:andRight method comes from:

This is where I add the UISwitch to my tableviewcell:

Thanks so much!

[Update] I thought the tableviewcell's might be the problem, so I added these UISwitches to a regular UIView to see how they looked. I have the exact same problem where they look alright in the simulator and the bottom is chopped in the device. So bizarre!

0 投票
2 回答
353 浏览

iphone - 异步调用后读取 UISwitch 的状态

我有一个带有 UISwitch 的登录屏幕,用于让用户选择“记住我”,因此如果需要,我可以将他/她的凭据存储在钥匙链上。

只有当用户选择“记住我”并且服务器接受用户名/密码时才会发生这种情况。但是,当服务器回复时,我很难参考 UISwitch 的状态。令我惊讶的是,myUISwitch.on 的值是 (null)。

我必须将此信息存储在临时布尔值中吗?

0 投票
1 回答
3358 浏览

iphone - 添加自定义操作:@selector 到 TableViewCell 上的 UISwitch

我有 TableCellViewController 用于管理 UITableView 中的单元格。每个单元格都有一个标签 na UISwitch (dictTypeSwitch)。想要分配方法来切换事件,以便我可以保存按钮的状态。

到目前为止,我已经这样做了:

将 setState 函数分配给对象:

事件处理函数:

从发件人那里我得到 UISwitch 对象,我可以从中获取状态。

到目前为止一切正常。

但是如果我想保存 UISwitch 的状态,我必须得到这个单元格的 rowIndex。我怎样才能做到这一点?

谢谢

0 投票
1 回答
538 浏览

iphone - UISwitch 强制拖动以更改设置

UISwitch当您点击非活动侧时,有没有办法阻止切换状态?我想要一个强制执行故意“滑动”操作的控件,以防止用户意外单击它。我环顾四周,但没有找到任何删除即时切换的设置。

0 投票
2 回答
4627 浏览

iphone - 如果我在每个表格视图单元格中添加一个 UISwitch 控件,我如何知道它属于哪个单元格?

我有一个UITableView包含UISwitch控件的单元格。它类似于下面显示的 iPhone 时钟应用程序中的表格视图......

替代文字
(来源:epicself.com

在我的应用程序的cellForRowAtIndexPath方法中,我像这样创建并附加UISwitch控件......

我的问题是,当用户切换开关并switchToggled调用方法时,我怎么知道它属于哪个表格单元格?如果不知道它的上下文,我真的不能用它做很多事情。

非常感谢您的帮助!