草庐IT

heightAnchor

全部标签

ios - TableView/Screen 的 AutoLayout UITableViewCell 高度倍数

我有一个tableViewCell,其中包含一个imageSlider,它应该是屏幕高度的40%。自动布局有可能吗?将单元格添加到tableView后,已经为单元格计算了高度,因此为单元格高度添加的任何约束都将被忽略。我可以实现heightForRow并返回正确的值,但我想知道我是否可以单独使用AutoLayout来实现这一点?cell.imageSlider.heightAnchor.constraint(equalTo:tableView.heightAnchor,multiplier:0.4) 最佳答案 向图像slider添加

ios - 由于 heightAnchor,无法垂直滚动 collectionview

为CollectionView使用自定义UICollectionViewLayout。为了正确显示所有iPhone的CollectionView,我使用了heightAnchor。应用heightAnchor后,我无法垂直滚动。请帮助我。这是由于heightAnchor引起的collectionview垂直滚动问题。customizeCollectionView.translatesAutoresizingMaskIntoConstraints=falsecustomizeCollectionView.heightAnchor.constraint(equalToConstant:cu

Swift:以编程方式更改 HeightAnchor

我正在关注此视频教程:https://www.youtube.com/watch?v=4rNtIeC_dsQ当我在UISegmentControl中选择不同的选项时,我很难让容器View的高度发生变化视频大约在17:51左右我这样声明了var:varinputsContainerHeightAnchor:NSLayoutConstraint?对于约束,我现在有:inputContainerView.centerXAnchor.constraint(equalTo:view.centerXAnchor).isActive=trueinputContainerView.centerYAnc

ios - heightAnchor.constraint 不起作用(使用 Swift 的 Apple FoodTracker 教程)

我一直在做Apple的iOS教程;开始开发iOS应用程序。https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/ImplementingACustomControl.html#//apple_ref/doc/uid/TP40015214-CH19-SW1在教程中,我在水平堆栈View上添加了一个大小限制为44.0x44.0的按钮。但是,模拟器会显示一个更大的按钮。looksthesizeconstraintsdonotwork.我的代码如下。你能给出