Latest 1.0.0
Homepage https://github.com/needbee/uiview-searchhierarchy
License MIT
Platforms ios 6.0, requires ARC
Authors

uiview-searchhierarchy

Searches a UIView’s ancestor hierarchy to see if it’s contained within a specific class

Demo

The demo/ folder contains a demo project showing UIView+SearchHierarchy in use. Open and run it.

Usage

Import "UIView+SearchHierarchy.h".

This category has two methods you can call on any UIView:

  • [_myview isDescendantOfViewOfKind:[UISomeClass class]] — returns true if any parent view of this view is UISomeClass
  • [_myview isDescendantOfViewOfKinds:arrayOfClasses] — returns true if any parent view of this view is any of the classes in the array

Compatibility

This class has been tested back to iOS 6.0.

Implementation

This class just navigates up the view hierarchy one at a time and calls isKindOfClass on each.

License

This code is released under the MIT License. See the LICENSE file for details.

Latest podspec

{
    "name": "UIView+SearchHierarchy",
    "version": "1.0.0",
    "summary": "Searches a UIView's ancestor hierarchy to see if it's contained within a specific class.",
    "homepage": "https://github.com/needbee/uiview-searchhierarchy",
    "license": "MIT",
    "authors": {
        "Josh Justice": "[email protected]"
    },
    "source": {
        "git": "https://github.com/needbee/uiview-searchhierarchy.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "6.0"
    },
    "requires_arc": true,
    "source_files": [
        "src",
        "src/**/*.{h,m}"
    ]
}

Pin It on Pinterest

Share This