简体   繁体   English

iOS AddSubview无法在uiscrollview中滚动

[英]ios addSubview not scrolling in uiscrollview

Im working in swift 2.0 in Xcode, Im facing an issue, I want to replace/add a subview in a UIView in storyboard. 我在Xcode的Swift 2.0中工作,我遇到问题,我想在情节提要的UIView中替换/添加一个子视图。

Here's my code: 这是我的代码:

    self.addChildViewController(vc)
    vc.view.frame = childView.frame
    self.container.addSubview(vc.view)
    vc.didMoveToParentViewController(self)

however I successfully adding the subview and I have UIScrollView in in which my childView UIView is palced .. but after placing the subview , Im unable to scroll the added view with UIScrollview but other content is scrolling fine. 但是,我成功添加了subview并在其中childView UIView UIScrollView出现了..但是放置subview ,我无法使用UIScrollview滚动添加的视图,但其他内容滚动良好。

How can I replace/add subview in my childView in order to work with UIScrollview 如何在childView中替换/添加子视图以便与UIScrollview

使用以下命令设置scrollview的内容大小

contentSize = CGSize(width: yourwidth, height: contentsizeheight)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM