1

There's three methods to scale a view:

    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));

the output is

2013-03-13 23:55:02.492  {{0, 0}, {1024, 768}}
2013-03-13 23:55:02.495  {{256, 192}, {512, 384}}

I don't know why the bounds didn't change after making scale, but only the frame changed.

NOrder
  • 2,483
  • 5
  • 26
  • 44

0 Answers0