NXEmptyView for UITableView
What is this?
... a category that dynamically shows an empty view when there are no entries in your table view.
The empty view will be displayed whenever the table view has no cells in any section. Of course only if a view has been set via
Whenever the table view is reloaded or layouted the empty view gets updated.
The frame of the empty view is updated to the bounds of the table view, so make sure it layouts nicely for all the orientations and screen sizes (iPhone 5, yay) that you're targeting.
Bypassing the Empty View
There might be scenarios in which you don't want the empty view to appear. For example when the content of the list has not yet been loaded and you don't want to scream at the user that there's none just because it has not yet been loaded.
In that case you can let your table view datasource implement the
UITableViewNXEmptyViewDataSource protocol and return
-tableViewShouldBypassNXEmptyView:. Whenever this value changes do a
-[UITableView reloadData] to update the empty view.
Add this to your Podfile
In your table view do:
- Set the
nxEV_emptyViewproperty of the table view with the view you want to be displayed when the table is empty. You can use the Interface Builder to do so as well.
Contributions are highly welcomed!
- Fork the repo
- Add your contribution
- Add a test for it if necessary
- Send us a pull request describing your changes
- Receive virtual high fives!
Bonus points for feature branches
- Your name here?
This code is released under the 3-clause BSD License (aka new BSD License or modified BSD License). The full text is included in the LICENSE file in the root of the repository.