【问题标题】:UIScrollView frame not changingUIScrollView 框架没有改变
【发布时间】:2014-03-21 10:49:17
【问题描述】:

我有一个 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];


    }];

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-26
      • 1970-01-01
      • 1970-01-01
      • 2011-08-31
      • 1970-01-01
      相关资源
      最近更新 更多