[英]The scroll to bottom auto not work when use the code in function viewDidLoad in swift
I am have the below code , when set this code in button it is work but i am need set the code in viewDidLoad but is not work,我有以下代码,当在按钮中设置此代码时它可以工作,但我需要在 viewDidLoad 中设置代码但不起作用,
let bottomOffset = CGPoint(x: 0, y: scrollView.contentSize.height - scrollView.bounds.size.height)
scrollView.setContentOffset(bottomOffset, animated: true)
please advise about this.请就此提出建议。 thank you....
谢谢你....
Try to Move your Code in viewWillLayoutSubview or viewDidLayoutSubview .尝试在 viewWillLayoutSubview 或 viewDidLayoutSubview 中移动您的代码。 if not work then move to viewDidAppear.
如果不起作用,则移至 viewDidAppear。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.