小编Вла*_*тов的帖子

更新约束 swift layoutIfNeeded 不起作用

当请求完成并且我有来自服务器的图像时,我需要更新约束(我的 CollectionView 的高度),因此 View 的高度也会改变。

结果画面

在此处输入图片说明

我需要什么屏幕

在此处输入图片说明

我的代码:

            DispatchQueue.main.async {
                self.cvActivity.alpha = 0
                self.collectionView.reloadData()
                self.collectionView.heightAnchor.constraint(equalToConstant: self.cellWidth * 2).isActive = true

                self.collectionView.setNeedsUpdateConstraints()
                self.collectionView.setNeedsLayout()
                self.view.layoutIfNeeded()
            }
Run Code Online (Sandbox Code Playgroud)

layout constraints ios swift

4
推荐指数
1
解决办法
8861
查看次数

LaunchScreen.storyboard 中的活动视图指示器没有动画

我想在加载时在我的应用程序上使用 Activity View Indicator,所以我有 LaunchScreen.storyboard。我在我的 AVI 上使用“行为 - 动画”,但它不是动画。当我使用 Act.V.Indic 时。不在 LaunchScreen 中 - 它是动画。

xcode animation ios launch-screen

1
推荐指数
1
解决办法
1551
查看次数

标签 统计

ios ×2

animation ×1

constraints ×1

launch-screen ×1

layout ×1

swift ×1

xcode ×1