1. Add a new visual class to your app.
  2. Select the header file for the class in the Xcode project navigator, and add the attribute IB_DESIGNABLE above the line beginning with @interface.
  3. In the Xcode project navigator, select a storyboard or xib file.
  4. Drag a View object (for an iOS app) or a Custom View object (for an OS X app) from the Object library to the Interface Builder canvas.
  5. Select the view object, and choose View > Utilities > Show Identity Inspector.
  6. Enter the name of the class for your custom view in the Class field of the Identity inspector (in the Custom Class area).
  7. Choose View > Assistant Editor > Show Assistant Editor, and use the assistant’s jump bar to navigate to the implementation file for your custom view.
  8. Write the code for your custom view.
  9. Choose View > Assistant Editor > Add Assistant Editor, and use the assistant editor’s jump bar to navigate to the header file for your custom view.
  10. Include the attribute IBInspectable with the declarations of properties that store values.
  11. With the custom view selected in Interface Builder, choose View > Utilities > Show Attributes Inspector.
  12. Change the values of the properties directly in the Attributes inspector.

参考链接: https://developer.apple.com/library/ios/recipes/xcode_help-IB_objects_media/Chapters/CreatingaLiveViewofaCustomObject.html