开发者

Zooming in/out a UIView by a button iPhone

开发者 https://www.devze.com 2023-03-29 16:44 出处:网络
Hi all I need to zoon in and out a UIView by a button/segmented controllas seen below. Is that possible without using sc开发者_StackOverflow中文版roll view?Pleae helpYes, you can set the view\'s tra

Hi all I need to zoon in and out a UIView by a button/segmented controll as seen below.

Zooming in/out a UIView by a button iPhone

Is that possible without using sc开发者_StackOverflow中文版roll view?Pleae help


Yes, 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];

}

0

精彩评论

暂无评论...
验证码 换一张
取 消