If no Table View results, display “No Results” on screen

后端 未结 14 1651
挽巷
挽巷 2020-11-30 17:25

I have a tableview, where sometimes there might not be any results to list, so I would like to put something up that says \"no results\" if the

14条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 17:54

    If you don't use the tableview footer and do not want the tableview to fill up the screen with empty default table cells i would suggest that you set your tableview footer to an empty UIView. I do not know the correct syntax for doing this in obj-c or Swift, but in Xamarin.iOS i would do it like this:

    public class ViewController : UIViewController
    {
        UITableView _table;
    
        public ViewController (IntPtr handle) : base (handle)
        {
        }
    
        public override void ViewWillAppear(bool animated) {
            // Initialize table
    
            _table.TableFooterView = new UIView();
        }
    }
    

    Above code will result in a tableview without the empty cells

提交回复
热议问题