0

When my Today widget extension in iOS is in .compact mode, the footer slides up to replace the UITableview prototype cells. Unfortunately, the first cell in the UITableView is still visible behind the footer since it is using the default background for widgets. How can I completely hide the cells without reverting to using a background color on the footer?

enter image description here

Secondary question: As stated, the footer will animate up in .compact mode to hide the table cells and fill the minimum size of the Today widget. Is this the default behaviour for a UITableview?

fakataha
  • 785
  • 6
  • 31

1 Answers1

0

I had a similar issue, except in my case I wanted the footer to be hidden on compact display mode. I used the widgetActiveDisplayModeDidChange to do that, as shown below:

func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) {
    self.myFooterView.hidden = (activeDisplayMode == NCWidgetDisplayMode.compact) ? true : false
}  

In your case, where you want the footer to be shown and the table cells to be hidden, you can use that same event, and reload the table data whenever widget display mode is changed, each case with its appropriate number of cells.

Shai Givati
  • 1,106
  • 1
  • 10
  • 24
  • I'll see if this will work. Thanks for the response. *Side note: you can simplify that by removing the ternary operator: self.myFooterView.hidden = activeDisplayMode == NCWidgetDisplayMode.compact. – fakataha Dec 01 '16 at 22:31