From 934c440da87e3b59fa24cec809bc2b1493bb6aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Fri, 20 Aug 2021 15:10:16 +0200 Subject: [PATCH] fix(ios): expose "sectionHeaderTopPadding" for layout backwards compatibility (#13021) --- apidoc/Titanium/UI/ListView.yml | 8 ++++++++ apidoc/Titanium/UI/TableView.yml | 8 ++++++++ iphone/Classes/TiUIListView.m | 11 +++++++++++ iphone/Classes/TiUITableView.m | 11 +++++++++++ 4 files changed, 38 insertions(+) diff --git a/apidoc/Titanium/UI/ListView.yml b/apidoc/Titanium/UI/ListView.yml index 9f499659aa2..353a71ffad3 100644 --- a/apidoc/Titanium/UI/ListView.yml +++ b/apidoc/Titanium/UI/ListView.yml @@ -953,6 +953,14 @@ properties: type: Number permission: read-only + - name: sectionHeaderTopPadding + summary: Padding above each section header. + description: If not set or set to `-1`, it defaults to an automatic spacing determined by the system. + type: Number + since: 10.1.0 + platforms: [iphone, ipad, macos] + osver: { ios: { min: "15.0" } } + - name: showVerticalScrollIndicator summary: Determines whether this list view displays a vertical scroll indicator. description: Set to `false` to hide the vertical scroll indicator. diff --git a/apidoc/Titanium/UI/TableView.yml b/apidoc/Titanium/UI/TableView.yml index d8580978386..f164e32d820 100644 --- a/apidoc/Titanium/UI/TableView.yml +++ b/apidoc/Titanium/UI/TableView.yml @@ -1459,6 +1459,14 @@ properties: since: { android: 3.1.0, iphone: 3.0.0, ipad: 3.0.0 } platforms: [android, iphone, ipad, macos] + - name: sectionHeaderTopPadding + summary: Padding above each section header. + description: If not set or set to `-1`, it defaults to an automatic spacing determined by the system. + type: Number + since: 10.1.0 + platforms: [iphone, ipad, macos] + osver: { ios: { min: "15.0" } } + - name: separatorColor summary: Separator line color between rows, as a color name or hex triplet. description: | diff --git a/iphone/Classes/TiUIListView.m b/iphone/Classes/TiUIListView.m index e3989f349fb..f893e7a4255 100644 --- a/iphone/Classes/TiUIListView.m +++ b/iphone/Classes/TiUIListView.m @@ -876,6 +876,17 @@ - (void)setDisableBounce_:(id)value [[self tableView] setBounces:![TiUtils boolValue:value def:NO]]; } +#if IS_SDK_IOS_15 +- (void)setSectionHeaderTopPadding_:(id)value +{ + if (![TiUtils isIOSVersionOrGreater:@"15.0"]) { + return; + } + + self.tableView.sectionHeaderTopPadding = [TiUtils floatValue:value def:UITableViewAutomaticDimension]; +} +#endif + - (void)setAllowsMultipleSelectionDuringEditing_:(id)value { ENSURE_TYPE(value, NSNumber); diff --git a/iphone/Classes/TiUITableView.m b/iphone/Classes/TiUITableView.m index c1489124f46..556c4a557f3 100644 --- a/iphone/Classes/TiUITableView.m +++ b/iphone/Classes/TiUITableView.m @@ -1821,6 +1821,17 @@ - (void)setSearch_:(id)search } } +#if IS_SDK_IOS_15 +- (void)setSectionHeaderTopPadding_:(id)value +{ + if (![TiUtils isIOSVersionOrGreater:@"15.0"]) { + return; + } + + self.tableView.sectionHeaderTopPadding = [TiUtils floatValue:value def:UITableViewAutomaticDimension]; +} +#endif + - (void)initSearhController { if (searchController == nil) {