IBDesignable and UITableViewCell

五迷三道 提交于 2020-01-12 19:07:48

问题


I'm trying to leverage IBDesignable features of Swift in XCode 6 to create a subclass of UITableViewCell

I see in the WWDC demo, and on the web - that you can use a framework to create a subclass of a view (UIView) which can then be used in say, a custom UITableViewCell, which is not really what I want.

Can I do the same thing with a UITableViewCell directly? If I expose a UITableViewCell in my framework, then try to use it in Interface Builder, I don't have access to my custom view components at design time.

What's worse - I can't even get my custom view to show at run time via Outlets created on the StoryBoard.

Thanks in advance for any pointers...


回答1:


My understanding is that IBDesignable is intended to be used with subclasses of UIView that are embedded inside other views in your xib. Try creating a custom UIView subclass that is inspectable/designable, and add it as the cell’s contentView’s first subview in the xib, and do all your customization from there.



来源:https://stackoverflow.com/questions/25573434/ibdesignable-and-uitableviewcell

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