Placeholder image for a generic UIView in Interface Builder

This inspired from some of Apple's UIKit controls that come as part of Xcode Interface builder such as UIPickerView. When I drag a UIPickerView into my scene, you get a placeholder image that says "Cupertino, San Francisco, Montainview, Palo Alto" etc. Those elements are not editable its just a nice placeholder that way you dont have this big blue square that says UIPickerView.


I have a UIView Class called ProgressTrackerView and I have a placeholder image of a progress tracker UI... is there a way I can see that placeholder image in Interface Builder but when I run my app... the actual prgress tracker with real data appears instead? Eventually, if we ship this as library for others to use, it would nice to have something there.


I looked into IBDesignables, however, IBDesignables fail to render UIImageViews with images, so thats not a viable solution.

Replies

Might want to try 3-D view.


Run the app in the simulator, then in Xcode use the Debug menu, View Debugging->Capture View Hierarchy. Click/drag/rotate

I tested a case both in XCode 9.4 and 10.0 ß.


It works, even though it neded sometime to update IBDesignable after a first fail in 10.0 (I reopened XCode)

This is a OSX app.


Could you show the complete code for the class ? With its draw function.