图片放大功能
2015-08-25 15:03
363 查看
在collectionView中铺了一个tableView, 在tableView的上面部分写一个headerView,在headerView上面铺了一个ImageView,把图片放在ImageView上; tableView向下滑动时,图片按比例放大,向上滑动时,原图比例向上滑动:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
DiErYeCollectionViewCell *cell = [[self.collectionView visibleCells] firstObject];
if (scrollView == cell.tabelView) {
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
DiErYeCollectionViewCell *cell = [[self.collectionView visibleCells] firstObject];
if (scrollView == cell.tabelView) {
if (scrollView.contentOffset.y <= 0) { CGFloat newy = 300 - scrollView.contentOffset.y; CGFloat newx = WIDTH * newy / 300; cell.ImageView.frame = CGRectMake(-(newx - WIDTH) / 2, scrollView.contentOffset.y, newx, newy); }else{ cell.ImageView.frame = CGRectMake(0, 0, WIDTH, 300); } }
}
相关文章推荐
- C++运行时类型识别——RTTI
- WeakReference 在android中的应用
- Android基础入门教程——2.3.11 Date & Time组件(上)
- storm-example笔记
- 【java】队列、优先队列、双端队列Deque、链表LinkedList、阻塞队列(Blocking queue)
- Android LruCacheWrapper使用指南
- C++中各种类型的成员变量的初始化方法
- C++异常机制
- 黑马程序员——C语言之字符串指针与二维字符串数组
- java内存分配和String类型的深度解析
- C语言切换壁纸和播放音乐
- 支付宝开发集成
- 让无线网卡同时工作在 AP 和 STA 模式
- HTML+CSS 制作HTML5标志图
- 修改远程桌面端口号
- IOS 学习 创建主TabBar
- 学习USB需要知道的几件事
- 算法竞赛入门经典第二章
- Hadoop 2.0集群配置详细教程
- Windows7建立共享WiFi设置(局域网配置)