Ios UIScrollView与UIView(Swift)

Ios UIScrollView与UIView(Swift),ios,swift,uiview,uiscrollview,Ios,Swift,Uiview,Uiscrollview,我已经用UIView实现了一个UICrollView,我在viewDidLoad加载到UICrollView时添加了UIView,UICrollView设置为UIViewControllers视图。当我这样做时,带有setTranslatesAutoResizezingMacAskintoConstraintsFalse的UIView的框架如何设置为-101.0。这不会发生在以不同方式显示的另一个视图上,但仅发生在设计相同并使用navigationController中的pushViewCont

我已经用UIView实现了一个UICrollView,我在viewDidLoad加载到UICrollView时添加了UIView,UICrollView设置为UIViewControllers视图。当我这样做时,带有setTranslatesAutoResizezingMacAskintoConstraintsFalse的UIView的框架如何设置为-101.0。这不会发生在以不同方式显示的另一个视图上,但仅发生在设计相同并使用navigationController中的pushViewController显示的该视图上

约束是从NIB/XIB文件设置的,我不明白为什么会发生这种情况

另一件需要注意的事情是,当这种情况发生时,无论我在哪里尝试更改UIView的框架,它都没有影响

编辑: viewDidLoad的代码:

override func viewDidLoad(){

        // call the super implementation
        super.viewDidLoad();

        // load our scrollview from our nib file
        customScrollView = CustomScrollView.loadFromNib();
        // set the resizeing mask to fill screen
        customScrollView!.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

        // load our uiview from our nib file
        containerView = ContainerView.loadFromNib();
        // we handle the constraint changes
        containerView!.setTranslatesAutoresizingMaskIntoConstraints(false);
        customScrollView!.addSubview(containerView!);

        // intialize our refresh control
        refreshControl = UIRefreshControl();
        refreshControl!.tintColor = UIColor.whiteColor();
        refreshControl!.addTarget(self, action: "onRefresh", forControlEvents: UIControlEvents.ValueChanged);
        containerView!.addSubview(refreshControl!);

        // add the view to our controller here
        view = customScrollView!;



    }

答案最终是定制的tableview。如果其他人也有这个问题,我强烈建议放弃UIScrollView,因为这对苹果来说是一个彻底的失望。文档很差,而且已知存在技术问题。还有一些关于课堂上的一些问题的技术文档说明,对于任何试图在课堂上做一些事情的人,请务必阅读这些说明

你能分享你的viewDidLoad代码吗。我也会检查你的.h文件,看看你的第二个视图控制器类中是否有任何缺少的实现。我会在一秒钟内上传代码,但请记住,这是swiftI。我已经用视图加载更新了帖子。你可能应该在标题或第一行中包括它是Swift,我看到它已经是一个标记了。这是来自非工作类的代码还是来自非工作类的代码?是的,即使在不使用pushViewController时类似的实现也可以工作