Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Can';滚动页面时,不要将图像顶部锁定在屏幕顶部_Ios_Objective C_Uiwebview_Uiscrollview_Uiwebviewdelegate - Fatal编程技术网

Ios Can';滚动页面时,不要将图像顶部锁定在屏幕顶部

Ios Can';滚动页面时,不要将图像顶部锁定在屏幕顶部,ios,objective-c,uiwebview,uiscrollview,uiwebviewdelegate,Ios,Objective C,Uiwebview,Uiscrollview,Uiwebviewdelegate,我有一张用作封面照片的uiimage,我想使用滚动视图下拉和放大,但我希望图像顶部保持在顶部: 这就是方法: - (void)scrollViewDidScroll:(UIScrollView *)scrollView;{ CGFloat offset = scrollView.contentOffset.y; offset = offset + 54; if (offset < 0 && offset > -25) {

我有一张用作封面照片的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);
}
-(void)scrollViewDidScroll:(UIScrollView*)scrollView;{
CGFloat offset=scrollView.contentOffset.y;
偏移量=偏移量+54;
如果(偏移量<0&&offset>-25){
_coverImageView.frame=CGRectMake(偏移量0320+(-偏移量)*2150+(-偏移量));
}
NSLog(@“%f”,偏移量);
}

tnx

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

  OR
这可能会有帮助