Zooming in/out a UIView by a button iPhone
Hi all I need to zoon in and out a UIView by a button/segmented controll as seen below.
Is that possible without using sc开发者_StackOverflow中文版roll view?Pleae helpYes, you can set the view's transform
. In particular CGAffineTransformMakeScale
will probably be useful to you.
The ABOVE code is actually right!! But Here I am Just elaborating it..as what i have used..
-(IBAction)zoomin:(id)sender{
self.view.transform = CGAffineTransformMakeScale(.5,.5);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.9];
//self.view.transform = CGAffineTransformMakeScale(1.5,1.5);
[UIView commitAnimations];
} -(IBAction)zoomout:(id)sender{
self.view.transform = CGAffineTransformMakeScale(1,1);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.9];
//self.view.transform = CGAffineTransformMakeScale(1.5,1.5);
[UIView commitAnimations];
}
精彩评论