UISwitch in static UITableViewCell generates error

我是研究僧i 提交于 2019-12-08 19:46:17

问题


I would like to create a UIViewController with various options, each can be enabled/disabled with a UISwitch. I'm using Xcode 5 and iOS 7 deployment target. The UITableView contains static cells. The interface is created in a storyboard.

When I'm adding a UISwitch to a cell (to it's contentView) I get this error:

Exception while running ibtool: *** setObjectForKey: object cannot be nil (key: objectID)

Isn't it possible to add a UISwitch to a static UITableViewCell? When removing the UISwitch the error disappears.


回答1:


I have the exact problem today and I couldn't figure out what is causing my problem because I have added too many items on my view controller. Now I know it is the UISwitch.

But I have resolved the problem, nonetheless.

I disabled the "Accessibility" option and the build was successful.

But How come the "Accessibility" option becomes an issue of Object Id remains unclear.




回答2:


For static table cells one has use to a UITableViewController. Static cells are not supported by UITableView.

Another answering this point: https://stackoverflow.com/a/9428324/42756




回答3:


A bit late but to the game, but...

If you define a User Defined Runtime Attribute to an AutoLayout constraint that is a Placeholder (i.e. removed at build time), you get this error.



来源:https://stackoverflow.com/questions/19230523/uiswitch-in-static-uitableviewcell-generates-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!