![](/img/trans.png)
[英]iOS Autolayout - Frame size not set in viewDidLayoutSubviews
[英]UITableViewAutomaticDimension is working but how do I get the frame Size the autolayout set it to?
我的問題聽起來很奇怪,但是我需要以某種方式提出這個問題。 所以我在節標題和行上都設置了UITableViewAutomaticDimension,它的工作方式就像一種魅力。 但是以某種方式,我正在使用約束來動態更改我的Section Header(當表格滾動時,整個框架和約束NOT Content。是否可以使用UITableViewAutomaticDimension來獲取設置為我的Section Header的大小或框架?
我不是在尋找建議,例如為什么不應該在運行時更改約束。 加載表格后,如果我能找到設置為標題的自動布局大小,請幫忙。
你可以看一下的bounds
視圖中tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int)
從UITableViewDelegate
,這將是自動計算尺寸的大小。 tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.