- (void)viewDidLoad {
[super viewDidLoad];
// //UIWebView:加载网页视图
// [self createWebView];
//1.平移 缩放 旋转
//UIView上有一个ImageView
//UIView缩放的同时,要求ImageView同时缩放
//需要设置子视图的autoresizingMask属性
// UIViewAutoresizingNone = 0,
// UIViewAutoresizingFlexibleLeftMargin = 1 << 0,
// UIViewAutoresizingFlexibleWidth = 1 << 1,
// UIViewAutoresizingFlexibleRightMargin = 1 << 2,
// UIViewAutoresizingFlexibleTopMargin = 1 << 3,
// UIViewAutoresizingFlexibleHeight = 1 << 4,
// UIViewAutoresizingFlexibleBottomMargin = 1 << 5
//自动布局
//
self.imgView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin;
}
- (void)createWebView
{
//1.创建webView
UIWebView *webView = [[UIWebView alloc]initWithFrame:self.view.frame];
//2.创建URL 网址
//使用http
NSURL *url = [NSURL URLWithString:@"http://www.baidu.com"];
//3.创建请求,请求数据
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url];
//4.webView加载请求的数据
[webView loadRequest:request];
[self.view addSubview:webView];
}
//旋转
- (IBAction)rotate:(id)sender
{
self.imgView.transform = CGAffineTransformMakeRotation(M_PI_2);
}
//平移
- (IBAction)translationClick:(id)sender
{
// self.imgView.transform = CGAffineTransformMakeTranslation(100, 100);
//view1平一的同时,imgView也平移
self.view1.transform = CGAffineTransformMakeTranslation(100, 100);
}
//缩放
- (IBAction)zoomClick:(id)sender
{
//倍数
// self.imgView.transform = CGAffineTransformMakeScale(0.5, 0.5);
//view1平一的同时,imgView也平移
self.view1.transform = CGAffineTransformMakeScale(0.5, 0.5);
}
//平移 + 缩放
- (IBAction)translationAndZoomClick:(id)sender
{
//1.设置缩放
CGAffineTransform transform1 = CGAffineTransformMakeScale(0.5, 0.5);
//2.设置平移
CGAffineTransform transform2 = CGAffineTransformMakeTranslation(-100, -100);
self.imgView.transform = CGAffineTransformConcat(transform1, transform2);
}
25ImageView_Rotation_Translation_Scale
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 原文链接http://www.cnblogs.com/kenshincui/p/4186022.html 音频在i...