UIScrollView子视图未填满scrollview。迅速

时间:2018-04-20 17:04:00

标签: ios swift uiscrollview

添加到我的scrollView的子视图没有填满滚动视图,即使约束指定从边缘到边缘。

Views not going from left edge to right edge

hindy_ilan@windy-hangar-200805:~$ datalab create "${MLCC_INSTANCE}" --zone="us-central1-a" --no-connect
Creating the network datalab-network
Creating the firewall rule datalab-network-allow-ssh
Creating the disk -pd
ERROR: (gcloud.compute.disks.create) unrecognized arguments: -pd
Usage: gcloud compute disks create DISK_NAME [DISK_NAME ...] [optional flags]
  optional flags may be  --csek-key-file | --description | --guest-os-features |
                         --help | --image | --image-family | --image-project |
                         --labels | --licenses | --require-csek-key-create |
                         --size | --source-snapshot | --type | --zone

var containerScrollView: UIScrollView = { let scrollView = UIScrollView() scrollView.backgroundColor = .green return scrollView }() let galleryView: GalleryView = { let view = GalleryView() view.backgroundColor = .clear view.scrollRate = 4.5 view.layer.cornerRadius = 4 view.layer.masksToBounds = true return view }() override func viewDidLoad() { super.viewDidLoad() view.addSubview(containerScrollView) containerScrollView.anchor(top: view.safeAreaLayoutGuide.topAnchor, left: view.leftAnchor, bottom: view.bottomAnchor, right: view.rightAnchor, leftConstant: 10, rightConstant: 10) // Setup Views // Only added 1 view to example to make code more readable, it also does not extend from edge to edge containerScrollView.addSubview(galleryView) galleryView.anchor(top: headerView.bottomAnchor, left: containerScrollView.leftAnchor, right: containerScrollView.rightAnchor, topConstant: 18, heightConstant: view.frame.width / 1.5) } 函数是我实现的函数,它可以更容易地为视图添加约束,这个函数运行正常并且不会导致问题

我不确定问题出在哪里,所以任何帮助都表示赞赏。

由于

0 个答案:

没有答案