UIScrollView实现缩放
2016-05-05 20:08
441 查看
#import "ViewController.h" @interface ViewController () <UIScrollViewDelegate> { UIImageView *imageView; } @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; UIScrollView *scrollview = [[UIScrollView alloc] initWithFrame:self.view.bounds]; //设置最大最小缩放比例 scrollview.minimumZoomScale = 0.5; scrollview.maximumZoomScale = 2; //设置代理 scrollview.delegate = self; imageView = [[UIImageView alloc] initWithFrame:self.view.bounds]; imageView.image = [UIImage imageNamed:@"0.JPG"]; imageView.userInteractionEnabled = YES; [scrollview addSubview:imageView]; [self.view addSubview:scrollview]; } //实现代理方法,返回缩放后的视图 -(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return imageView; } @end
相关文章推荐
- UIScrollView(滑动视图)
- -[UICachedDeviceRGBColor CGImage]: unrecognized selector sent to instance 0x130972b90
- UILabel 实现国际象棋棋盘界面
- APUE笔记:alarm和pause竞争
- UILabel 标签
- UILabel 实现计算器界面
- 导航栏上面添加UISearchBar pop回去的时候会把添加的导航栏带回去的问题
- Leetcode - Longest Increasing Subsequence
- SDUTOJ 2169 Sequence 山东省第二届省赛
- 问:GUI的蓝海在哪里?答:嵌入式!
- EntityFramework IEnumerable,IQueryable ,Include
- MiniUI 快速上手
- GCD介绍: 基本概念和Dispatch Queue
- 【动态规划】XMU 1583 Sequence
- warning C4800: “BOOL”: 将值强制为布尔值“true”或“false”(性能警告)
- 关于window.event.returnValue=false的用处
- Access restriction : The type BASE64Decoder is not accessible due to restriction
- @Responsebody与@RequestBody
- 还来一篇说下json_value 以及 json_query 的应用 (3)
- Moqui学习之数据与资源