Ios Can';滚动页面时,不要将图像顶部锁定在屏幕顶部
我有一张用作封面照片的uiimage,我想使用滚动视图下拉和放大,但我希望图像顶部保持在顶部: 这就是方法: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) {
- (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
这可能会有帮助