Subclass of UIView or UIViewController

I want to create a โ€œsectionโ€ that has an image and text below.

Should I subclass UIView or UIViewController? I think UIView, because it will not know which image or which text to display, it will simply be both. Also, if it is a UIView, which method should I add subviews (UIImageView and UILabel) as subviews? Or should I draw text and image without using UIImageView or UILabel in drawRect?

+3
source share
2 answers
  • Subclass UIView
  • Add routines (UIImageView and UILabel) to initWithFrame:
  • Marking up subzones in layoutSubviews
  • drawRect:,
+4

UIView, . UIViewController, , - .

0

Source: https://habr.com/ru/post/1768893/


All Articles