Add support for dark mode on iOS 13
Fix layout issues on iOS 13 Closes #2
This commit is contained in:
@@ -52,9 +52,14 @@
|
|||||||
UIView *topSeparatorView = [self valueForKey:@"_topSeparatorView"];
|
UIView *topSeparatorView = [self valueForKey:@"_topSeparatorView"];
|
||||||
topSeparatorView.hidden = YES;
|
topSeparatorView.hidden = YES;
|
||||||
|
|
||||||
|
if (@available(iOS 13, *)) {
|
||||||
|
self.contentView.backgroundColor = [UIColor systemBackgroundColor];
|
||||||
|
self.backgroundColor = [UIColor systemBackgroundColor];
|
||||||
|
} else {
|
||||||
self.contentView.backgroundColor = [UIColor whiteColor];
|
self.contentView.backgroundColor = [UIColor whiteColor];
|
||||||
self.backgroundColor = [UIColor whiteColor];
|
self.backgroundColor = [UIColor whiteColor];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-(void)dealloc {
|
-(void)dealloc {
|
||||||
self.imageWidthConstraint = nil;
|
self.imageWidthConstraint = nil;
|
||||||
|
|||||||
@@ -48,7 +48,11 @@ extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void
|
|||||||
self.customAppActions = customAppActions;
|
self.customAppActions = customAppActions;
|
||||||
|
|
||||||
self.fakeNavBar = [[[UIView alloc] init] autorelease];
|
self.fakeNavBar = [[[UIView alloc] init] autorelease];
|
||||||
|
if (@available(iOS 13, *)) {
|
||||||
|
self.fakeNavBar.backgroundColor = [UIColor systemBackgroundColor];
|
||||||
|
} else {
|
||||||
self.fakeNavBar.backgroundColor = [UIColor whiteColor];
|
self.fakeNavBar.backgroundColor = [UIColor whiteColor];
|
||||||
|
}
|
||||||
|
|
||||||
[self.view addSubview:self.fakeNavBar];
|
[self.view addSubview:self.fakeNavBar];
|
||||||
|
|
||||||
@@ -84,7 +88,11 @@ extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void
|
|||||||
|
|
||||||
self.tableView = [[[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped] autorelease];
|
self.tableView = [[[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped] autorelease];
|
||||||
self.tableView.translatesAutoresizingMaskIntoConstraints = NO;
|
self.tableView.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
|
if (@available(iOS 13, *)) {
|
||||||
|
self.tableView.backgroundColor = [UIColor systemBackgroundColor];
|
||||||
|
} else {
|
||||||
self.tableView.backgroundColor = [UIColor whiteColor];
|
self.tableView.backgroundColor = [UIColor whiteColor];
|
||||||
|
}
|
||||||
self.tableView.preservesSuperviewLayoutMargins = YES;
|
self.tableView.preservesSuperviewLayoutMargins = YES;
|
||||||
|
|
||||||
[self.view addSubview:self.tableView];
|
[self.view addSubview:self.tableView];
|
||||||
@@ -117,7 +125,14 @@ extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CGFloat fakeNavBarHeight = statusBarHeight == 0.0 ? 32.0 : statusBarHeight + 44.0;
|
CGFloat fakeNavBarHeight;
|
||||||
|
|
||||||
|
if (@available(iOS 13, *)) {
|
||||||
|
fakeNavBarHeight = 56.0;
|
||||||
|
statusBarHeight = 0.0;
|
||||||
|
} else {
|
||||||
|
fakeNavBarHeight = statusBarHeight == 0.0 ? 32.0 : statusBarHeight + 44.0;
|
||||||
|
}
|
||||||
|
|
||||||
self.fakeNavBar.frame = CGRectMake(
|
self.fakeNavBar.frame = CGRectMake(
|
||||||
0.0,
|
0.0,
|
||||||
@@ -301,8 +316,13 @@ extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void
|
|||||||
cell.textLabel.font = [UIFont systemFontOfSize:cell.textLabel.font.pointSize];
|
cell.textLabel.font = [UIFont systemFontOfSize:cell.textLabel.font.pointSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (@available(iOS 13, *)) {
|
||||||
|
cell.contentView.backgroundColor = [UIColor systemBackgroundColor];
|
||||||
|
cell.backgroundColor = [UIColor systemBackgroundColor];
|
||||||
|
} else {
|
||||||
cell.contentView.backgroundColor = [UIColor whiteColor];
|
cell.contentView.backgroundColor = [UIColor whiteColor];
|
||||||
cell.backgroundColor = [UIColor whiteColor];
|
cell.backgroundColor = [UIColor whiteColor];
|
||||||
|
}
|
||||||
|
|
||||||
cell.accessoryType = indexPath == self.selectedActionIndexPath ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
|
cell.accessoryType = indexPath == self.selectedActionIndexPath ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
|
||||||
|
|
||||||
@@ -320,8 +340,13 @@ extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void
|
|||||||
cell.textLabel.text = @"In Every App";
|
cell.textLabel.text = @"In Every App";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (@available(iOS 13, *)) {
|
||||||
|
cell.contentView.backgroundColor = [UIColor systemBackgroundColor];
|
||||||
|
cell.backgroundColor = [UIColor systemBackgroundColor];
|
||||||
|
} else {
|
||||||
cell.contentView.backgroundColor = [UIColor whiteColor];
|
cell.contentView.backgroundColor = [UIColor whiteColor];
|
||||||
cell.backgroundColor = [UIColor whiteColor];
|
cell.backgroundColor = [UIColor whiteColor];
|
||||||
|
}
|
||||||
|
|
||||||
cell.accessoryType = indexPath == self.selectedLimitationIndexPath ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
|
cell.accessoryType = indexPath == self.selectedLimitationIndexPath ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user