Search code examples
iosobjective-cuiviewuiimageview

Is UIImageView of type UIView


I am new to Objective-c. a loop is created to iterate through items or entries of UIView that are displayed in the storyboard. the storyboard contains a UIScrollView and the UIScrollView encompass 7UIViews and 2 UIImageView. the loop I have in the code, iterated through 9 entries. i expected the loop to iterate through 7 entries as there are UIViews and two UIImageViews.

My question is, is UIImageView is of type UIView?


Solution

  • yes, a UIImageView is of type UIView

    UIKIT_EXTERN API_AVAILABLE(ios(2.0)) @interface UIImageView : UIView 
    

    and UIView is of type

    UIKIT_EXTERN API_AVAILABLE(ios(2.0)) @interface UIView : UIResponder <NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem, UITraitEnvironment, UICoordinateSpace, UIFocusItem, UIFocusItemContainer, CALayerDelegate>
    

    and UIResponder is of type

    UIKIT_EXTERN API_AVAILABLE(ios(2.0)) @interface UIResponder : NSObject <UIResponderStandardEditActions>
    

    so UIImageView inherits everything from NSObject, UIResponder, and UIView and is of type NSObject, UIResponder, and UIView

    good luck