FIXED: This PR fixes a side effect of #2744 on table data views (#2767)

When a textField is used in a tableView, setValue forThemeAttribute
should refer to state CPThemeStateTableDataView instead of
CPThemeStateNormal as #2744 is now more accurate on states.
This commit is contained in:
Didier Korthoudt
2018-08-31 09:14:54 +02:00
committed by Martin Carlberg
parent dd68b37a2a
commit 8a3eb0d83b
2 changed files with 36 additions and 0 deletions
+17
View File
@@ -163,3 +163,20 @@ CPCheckBoxImageOffset = 4.0;
}
@end
#pragma mark -
@implementation CPCheckBox (TableDataView)
// We overide here _CPObject+Theme setValue:forThemeAttribute as CPCheckBox can be used as tableView data view
// So, when outside a table data view, setValue:forThemeAttribute should store the value with the CPThemeStateNormal (default behavior)
// When inside a table data view, it should store the value with the CPThemeStateTableDataView. If not, the value won't be used if the
// theme defined a value for this attribute for state CPThemeStateTableDataView
- (void)setValue:(id)aValue forThemeAttribute:(CPString)aName
{
[super setValue:aValue forThemeAttribute:aName];
[super setValue:aValue forThemeAttribute:aName inState:CPThemeStateTableDataView];
}
@end
+19
View File
@@ -2217,3 +2217,22 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
}
@end
#pragma mark -
@implementation CPTextField (TableDataView)
// We overide here _CPObject+Theme setValue:forThemeAttribute as CPTextField can be used as tableView data view
// So, when outside a table data view, setValue:forThemeAttribute should store the value with the CPThemeStateNormal (default behavior)
// When inside a table data view, it should store the value with the CPThemeStateTableDataView. If not, the value won't be used if the
// theme defined a value for this attribute for state CPThemeStateTableDataView
- (void)setValue:(id)aValue forThemeAttribute:(CPString)aName
{
[super setValue:aValue forThemeAttribute:aName];
[super setValue:aValue forThemeAttribute:aName inState:CPThemeStateTableDataView];
}
@end