问题
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