【问题标题】:Can't lock the top of image in the top of the screen while scrolling the page滚动页面时无法锁定屏幕顶部的图像顶部
【发布时间】:2015-02-21 01:44:33
【问题描述】:

我用作封面照片的 uiimage,我想使用滚动视图来下拉和放大,但我希望图像的顶部保持在顶部:

这就是方法:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView;{

    CGFloat offset = scrollView.contentOffset.y;
    offset = offset + 54;


    if (offset < 0 && offset > -25) {
        _coverImageView.frame = CGRectMake(offset, 0,320 + (-offset) * 2, 150 + (-offset));
    }

    NSLog(@"%f", offset);
}

tnx

【问题讨论】:

    标签: ios objective-c uiwebview uiscrollview uiwebviewdelegate


    【解决方案1】:

    您可以在scrollview后面使用具有清晰背景的imageview,并在根据偏移量滚动时调整大小。

      OR
    

    这可能会有所帮助 https://www.cocoacontrols.com/controls/secret-viewer

    【讨论】:

      猜你喜欢
      • 2020-04-18
      • 2021-12-31
      • 1970-01-01
      • 1970-01-01
      • 2010-11-16
      • 2012-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多