Display message or alternate view if tableview source is empty
I am using MVVMCross' MvxStandardTableViewSource
, which is UITableViewSource
.
I have registered a custom cell to display items in source. This all works as expected.
var source = new MvxStandardTableViewSource(this.TableView, new NSString("MyItemCell"));
TableView.Source = source;
TableView.RowHeight = UITableView.AutomaticDimension;
TableView.EstimatedRowHeight = 52.0f;
TableView.RegisterClassForCellReuse(typeof(MyItemCell), new NSString("MyItemCell"));
The source for the TableViewSource is searchable, so it can sometimes be empty.
What's the recommended way to report no search results? Is it a regular UIView in a TableHeaderView or an optional CustomCell within one TableHeaderView
+3
source to share
1 answer
The problem I ran into was to see how I can add additional UIViews around the table.
In the end, I settled on the following approach.
- Change the controller to MvxViewController
- Create UITableView and bind it to MvxStandardTableViewSource
- Insert this and the UISearchBar just like any other views in the main Controller View
- Paste any other required UIView like shortcut for no search results as usual, not worry about TableHeaders
+2
source to share