Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.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 如何轻轻淡入UIImage底部,并在向上滚动时淡入模糊_Ios_Objective C_Uicollectionview_Blur_Cagradientlayer - Fatal编程技术网

Ios 如何轻轻淡入UIImage底部,并在向上滚动时淡入模糊

Ios 如何轻轻淡入UIImage底部,并在向上滚动时淡入模糊,ios,objective-c,uicollectionview,blur,cagradientlayer,Ios,Objective C,Uicollectionview,Blur,Cagradientlayer,我一直在使用UICollectionView标题作为UICollectionReusableView,我试图实现1)轻微的底部褪色图像,2)当用户向上滚动图像时,图像会模糊 我基本上是在看苹果的音乐应用程序,这是一个艺术家的个人资料视图,在我看来,这是一个非常好看的应用程序 轻微褪色的底部 向上滚动模糊 我的出发点是可行的,但我想有一个更微妙的底部褪色,然后一旦我有了这个钉子,想想滚动模糊 应用CAGradientLayer的代码: UIImageView *imageView; image

我一直在使用
UICollectionView
标题作为
UICollectionReusableView
,我试图实现1)轻微的底部褪色图像,2)当用户向上滚动图像时,图像会模糊

我基本上是在看苹果的音乐应用程序,这是一个艺术家的个人资料视图,在我看来,这是一个非常好看的应用程序

  • 轻微褪色的底部
  • 向上滚动模糊
  • 我的出发点是可行的,但我想有一个更微妙的底部褪色,然后一旦我有了这个钉子,想想滚动模糊

    应用CAGradientLayer的代码:

    UIImageView *imageView;
    imageView = [[UIImageView alloc] initWithFrame:header.bounds];
    imageView.image = [UIImage imageWithData:self.guest.profilePic];
    [imageView setContentMode:UIViewContentModeScaleAspectFill];
    [imageView setClipsToBounds:YES];
    
    CAGradientLayer *gradient = [CAGradientLayer layer];
    gradient.frame = imageView.bounds;
    
    UIColor *transWhiteColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.25];
    UIColor *endColor = [UIColor whiteColor];
    
    gradient.colors = [NSArray arrayWithObjects:
                       (id)[transWhiteColor CGColor],
                       (id)[endColor CGColor],
                       nil];
    
    [imageView.layer insertSublayer:gradient atIndex:0];
    [header addSubview:imageView];
    
    如有任何见解,将不胜感激