UIScrollView框架没有变化

时间:2014-03-21 10:49:17

标签: ios objective-c cocoa-touch views scrollview

我有一个UIScrollView,它通过设置contentOffSet来动画UIImageViews,并在点击手势时将其扩展为self.view.frame。升级到7.1后,我无法再设置框架。它仍然是相同的,但其contentView按预期调整大小。我错过了什么?

if (!isFullScreen) {




[UIView animateWithDuration:.7 animations:^{

    [ima setAlpha:1];
    [self.view bringSubviewToFront:_scrollView];

    [self.navigationController setNavigationBarHidden:YES animated:YES];
    [_scrollView setFrame:[[UIScreen mainScreen] bounds]];

    [_scrollView setBackgroundColor:[UIColor lightGrayColor]];
    for (UIImageView *im in _scrollView.subviews) {
        [im setFrame:CGRectMake(im.frame.origin.x+10, im.frame.origin.y, _scrollView.frame.size.width-20, _scrollView.frame.size.height)];
        [im setClipsToBounds:YES];
        [im setUserInteractionEnabled:NO];


    }];

1 个答案:

答案 0 :(得分:0)

找到它。对于任何有相同问题的人来说,问题是viewController被设置为Autolayout选项,这引发了另一个问题。为什么Autolayout优先于任何视图的实际动态变化?