Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IBDesignable and UITableViewCell

Tags:

swift

xcode6

ios8

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...

like image 631
Daniel D Avatar asked Aug 29 '14 17:08

Daniel D


1 Answers

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.

like image 196
Zev Eisenberg Avatar answered Oct 13 '22 20:10

Zev Eisenberg