How to subclass a UIView class with xib?

I want to create a UIView. And use this view in all view controllers. How to subclass a UIView class using xib and use it in all view controllers? Thanks in advance.

+5
source share
2 answers
  • You need to create your subclass: File -> New -> File -> Cocoa Touch -> Objective C-class -> Subclass of Target Class Type(UIView in your case)
  • Then you create for it xib: File > New > User Interface > View(name your xib)
  • Now go and create your own xibon Interface Builder.
  • The last thing you need to do is change the look of the class in Identity Inspector. Your custom xib will be associated with your custom class.

Let me know if you need more information.

+7
source

UIView , , , . , , Interface Builder. UIView .

enter image description here

, , UIView, xib, .

+1

All Articles