I'd like to reload my View
but after I reload it my ScrollView
not working, but everything else refresh correctly. Here is my code to refresh view:
extension UIViewController {
func reloadViewFromNib() {
let parent = view.superview
view.removeFromSuperview()
view = nil
parent?.addSubview(view) // This line causes the view to be reloaded
}
}
I tried to put these into my viewDidLoad
maybe I just need to refresh the SrollView
manually but it's still not working.
self.beSrcollView.bounces = true
self.beSrcollView.delegate = self
self.beSrcollView.updateConstraints()
self.beSrcollView.isScrollEnabled = true
self.beSrcollView.updateFocusIfNeeded()
self.beSrcollView.setNeedsFocusUpdate()
self.beSrcollView.needsUpdateConstraints()
Have you any idea how to fix this?
override func viewDidLayoutSubviews()
{
self.beSrcollView.contentSize = CGSize(width: self.view.frame.size.width, height: 1000) // height change according
}
尝试这个
scrollView.reloadInputViews()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.