How do I reference a subview in a custom UIView class?

Discussion in 'iOS Programming' started by moonman239, Nov 7, 2013.

  1. moonman239 macrumors 68000

    Mar 27, 2009
    I have a subclassed UIView in a view controller. This view has a referencing outlet to a view controller. Within this view are subviews.

    subviews appears to be a nonexistent property of UIView. How do I access a subview's properties within the subclassed view?
  2. TheWatchfulOne, Nov 7, 2013
    Last edited: Nov 7, 2013

    TheWatchfulOne macrumors 6502


    Jun 19, 2009
    I recommend checking out the UIView Class Reference.

    To answer you question more directly, subviews is a read-only property on UIView of type NSArray. Any UIView object you add to a view is added to this array. You can iterate over this array and find more information about each subview using introspection. :cool:

Share This Page