大佬教程收集整理的这篇文章主要介绍了ios – 基于ScrollView位置的UIImageView淡化,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
[UIView beginAnimations:@"fade out" context:nil]; [UIView setAnimationDuration:1.0]; // some how based on position?? imageView.alpha = 1.0; // here to? [UIView commitAnimations];
编辑:
设置委托:
self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; self.pageController.datasource = self;
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
然后,您应该检查scrollView.contentOffset.x值以确定滚动视图水平滚动的程度,并使用它来确定imageView的alpha,如下所示:
CGFloat newAlpha = scrollView.contentOffset.x / scrollView.frame.size.width; // This will need to be adapted depending on the content size of your scroll view -- do not just copy and paste this expecTing it to work :) imageView.alpha = newAlpha;
以上是大佬教程为你收集整理的ios – 基于ScrollView位置的UIImageView淡化全部内容,希望文章能够帮你解决ios – 基于ScrollView位置的UIImageView淡化所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。