缩放视图的三种方法:
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
[view setBackgroundColor:[UIColor redColor]];
[self.view addSubview:view];
view.transform = CGAffineTransformMakeScale(0.5, 0.5);
view.layer.affineTransform = CGAffineTransformMakeScale(0.5, 0.5);
view.layer.transform = CATransform3DMakeScale(0.5, 0.5, 0);
NSLog(@"%@",NSStringFromCGRect(view.bounds));
NSLog(@"%@",NSStringFromCGRect(view.frame));
输出是
2013-03-13 23:55:02.492 {{0, 0}, {1024, 768}} 2013-03-13 23:55:02.495 {{256, 192}, {512, 384}}
我不知道为什么在制作比例后边界没有改变,而只是框架改变了。