ios - Add empty message to UITableView while preserving scrolling behavior -
ios - Add empty message to UITableView while preserving scrolling behavior -
i want display empty message user when uitableview
empty. there few attempts out there including using
backgroundview
: uilabel
stays centered if scroll table view, message position stays fixed. looks kind of weird current layout. addsubview
: used solution. because added view auto layout destroyed approach. here message goes scrolling needed it's not useable because of side effects. header/footer view: how center here correctly , height? a special cell: how have right height here? centering? i want utilize auto layout in case if possible. here requirements:
message (could image text) should centered in table view. if table view scrolled, message should have fixed position on table view. should scroll label label on scroll view, height of scroll view correlates screen height. pull refresh should possible.one illustration can seen in app "app store". if in flight mode , navigate tab "updates" can see behavior. on iphone seems separate cell. don't know on ipad. perhaps same. how can achieved?
there 2 approaches can take here:
approach 1 - show/hide (cleaner)you can conditionally hide or show tableview based on whether has content. if has no content, hide tableview , show whatever placeholder view want show. whenever info refreshes, phone call method 1 time again determine view show.
approach 2 - special sectionyou can create exclusively new section "no content" table view message, , in tableview:numberofsectionsintableview
homecoming 1 if there no content, conditionally showing special cell case.
ios uitableview autolayout
Comments
Post a Comment