[ActionSheet] Allow Swift example to support dynamic type (#8946)
Perviously the ActionSheet swift example did not support dynamic type. This updates the example table to support dynamic type.
## Screenshots
| Before | After |
|---|---|
|||
Closes #8820
diff --git a/components/ActionSheet/BUILD b/components/ActionSheet/BUILD
index cf807ba..b6b075f 100644
--- a/components/ActionSheet/BUILD
+++ b/components/ActionSheet/BUILD
@@ -105,6 +105,7 @@
deps = [
":ActionSheet",
":Theming",
+ "//components/AppBar",
"//components/schemes/Color",
"//components/schemes/Container",
"//components/schemes/Typography",
diff --git a/components/ActionSheet/examples/ActionSheetSwiftExampleViewController.swift b/components/ActionSheet/examples/ActionSheetSwiftExampleViewController.swift
index 7576436..27dd6a8 100644
--- a/components/ActionSheet/examples/ActionSheetSwiftExampleViewController.swift
+++ b/components/ActionSheet/examples/ActionSheetSwiftExampleViewController.swift
@@ -14,6 +14,7 @@
import UIKit
+import MaterialComponents.MaterialAppBar
import MaterialComponents.MaterialColorScheme
import MaterialComponents.MaterialContainerScheme
import MaterialComponents.MaterialTypographyScheme
@@ -45,17 +46,17 @@
override func viewDidLoad() {
super.viewDidLoad()
+ view.backgroundColor = containerScheme.colorScheme.backgroundColor
+ if let appBarContainer = parent as? MDCAppBarContainerViewController {
+ appBarContainer.appBarViewController.headerView.trackingScrollView = tableView
+ }
tableView.delegate = self
tableView.dataSource = self
+ tableView.frame = view.bounds
+ tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+ tableView.rowHeight = UITableView.automaticDimension
+ tableView.estimatedRowHeight = 56
tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier)
- }
-
- override func viewDidLayoutSubviews() {
- super.viewDidLayoutSubviews()
-
- view.backgroundColor = containerScheme.colorScheme.backgroundColor
- tableView.frame = view.frame
- tableView.frame.origin.y = 0.0
view.addSubview(tableView)
}