Dark Theme - Improvement

Add a top view in pickers (country, language) to display the right background in case of vertical bounce.
This commit is contained in:
Giom Foret
2017-08-14 13:09:11 +02:00
parent 5ccb5acbc8
commit 2b15594f28
2 changed files with 34 additions and 2 deletions
@@ -24,6 +24,11 @@
Observe kRiotDesignValuesDidChangeThemeNotification to handle user interface theme change.
*/
id kRiotDesignValuesDidChangeThemeNotificationObserver;
/**
The fake top view displayed in case of vertical bounce.
*/
UIView *topview;
}
@end
@@ -48,6 +53,12 @@
// Note: UISearchDisplayController is deprecated in iOS 8.
// MXKCountryPickerViewController should use UISearchController to manage the presentation of a search bar and display search results.
self.searchDisplayController.searchResultsTableView.tableFooterView = [[UIView alloc] init];
// Add a top view which will be displayed in case of vertical bounce.
CGFloat height = self.tableView.frame.size.height;
topview = [[UIView alloc] initWithFrame:CGRectMake(0,-height,self.tableView.frame.size.width,height)];
topview.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.tableView addSubview:topview];
// Observe user interface theme change.
kRiotDesignValuesDidChangeThemeNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kRiotDesignValuesDidChangeThemeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
@@ -68,6 +79,7 @@
// Use the primary bg color for the table view in plain style.
self.tableView.backgroundColor = kRiotPrimaryBgColor;
topview.backgroundColor = kRiotPrimaryBgColor;
self.searchDisplayController.searchResultsTableView.backgroundColor = self.tableView.backgroundColor;
if (self.tableView.dataSource)
@@ -98,6 +110,9 @@
{
[super destroy];
[topview removeFromSuperview];
topview = nil;
if (kRiotDesignValuesDidChangeThemeNotificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kRiotDesignValuesDidChangeThemeNotificationObserver];