Latest 1.4.4
Homepage https://github.com/itsthejb/UICollectionViewEmptyState
License MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
Platforms ios 7.0, requires ARC
Dependencies Aspects, ObjcAssociatedObjectHelpers
Frameworks QuartzCore
Authors

Build Status
Build Status

UICollectionView+EmptyState

Want to display an arbitrary UIView on your UICollectionView when in an empty state, and in a loosely-coupled fashion? Look no further.

Usage

#import "UICollectionView+EmptyState.h" and simply set the property emptyState_view on your UICollectionView instance. We do the rest. Note that your view will be resized to overlay the UICollectionView so be sure to properly configure beforehand.

Properties

  • @property (nonatomic, strong) UIView *emptyState_view; set your overlay view.
  • @property (nonatomic, assign) BOOL emptyState_shouldRespectSectionHeader; when used with UICollectionViewFlowLayout, setting this property to YES causes the overlay to be laid-out beneath the first section’s header view. This would be useful if your first section’s header contains controls that affect the collection’s content in some way. We don’t want to block those. The demo application has a switch in its header view to demonstrate that the section header will be available for user interaction.
  • @property (nonatomic, assign) NSTimeInterval emptyState_showAnimationDuration;, @property (nonatomic, assign) NSTimeInterval emptyState_hideAnimationDuration; the overlay can be faded in and out using these properties. Set either to 0 for no animation.
  • UICollectionViewEmptyStateDelegate protocol can be used for further customisation of the view as it’s added and removed.
  • A convenience method setEmptyStateImageViewWithImage: creates a UIImageView with the provided image, sets it as emptyState_view, and returns it for any further customisation required.

Notes

  • The overlay does not rotate terribly well at this time.

What’s new

1.4.4

  • Added shouldNilViewIfNotRequired flag, to automatically nil the empty state view if it is not added as part of the next layout cycle.

1.4.2

  • Added new delegate method that allows modification of the proposed overlay frame.

1.3.1

  • Permit Autolayout, by removing call to -setTranslatesAutoresizingMaskIntoConstraints:.

1.3.0

  • Changed swizzling solution to Aspects, in order to only swizzle -layoutSubviews for UICollectionView instances with an empty state view set.
  • Improved some other property and layout logic, including in the demo.

1.2.1

  • Fixed an incorrect pointer bug.

1.2.0

  • Proper overhaul with recreated project. No more test suite demons.
  • will~ delegate methods are now called from within animation blocks.
  • Better sizing when respecting the collection’s first section header. Takes account of header sizing for the layout and delegate. Does not access the actual header view at all.
  • Demo is prettier and more functional.
  • Tidying up podspec dependencies.

1.1.0

  • Much-needed spring clean.
  • Properly respects the collection view’s contentInsets for better iOS 7 compatibility.
  • Accesses the collection view’s section 0 header view directly for more robust layout with emptyState_shouldRespectSectionHeader.
  • Scrolling of the collection view is now disabled when the overlay is visible.
  • Scrolls the collection back to the top when the overlay is presented.

1.0.9

  • Dependency updates.

1.0.8

  • Updated depedencies for changes in libextobjc.

1.0.7

  • Fixed missing QuartzCore import.

1.0.6

  • Checks the animation keys for the emptyState_view explicitly so should protect against multiple nested add/remove operations and generally smoother operation.

1.0.5

  • Added emptyState_showDelay and emptyState_hideDelay properties to add a delay to show/hide of the overlay.
  • Possibly fixed a retain cycle-related crash issue.
  • Test target currently broken and no time to fix… :(

1.0.3

  • Dependency updates.

1.0.2

  • Fixed dependency error.

1.0.1

  • Tidying of methods.
  • Existing empty views are always removed when a new view is set. Allows for more dynamic changing of empty state views.

1.0.0

  • Added UICollectionViewEmptyStateDelegate protocol.
  • Added setEmptyStateImageViewWithImage:.
  • 0.0.1 – Initial release

Have fun!


[email protected]

Latest podspec

{
    "name": "UICollectionViewEmptyState",
    "version": "1.4.4",
    "summary": "Set-and-forget overlays for empty UICollectionViews.",
    "license": {
        "type": "MIT",
        "text": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE"
    },
    "authors": {
        "Jonathan Crooke": "[email protected]"
    },
    "dependencies": {
        "Aspects": [
            "~> 1.4.1"
        ],
        "ObjcAssociatedObjectHelpers": [
            "~> 2.0.0"
        ]
    },
    "frameworks": "QuartzCore",
    "homepage": "https://github.com/itsthejb/UICollectionViewEmptyState",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/itsthejb/UICollectionViewEmptyState.git",
        "tag": "v1.4.4"
    },
    "source_files": "UICollectionViewEmptyState/*.{h,m}"
}

Pin It on Pinterest

Share This