Muhammed Sadiq.HS
Muhammed Sadiq.HS

Reputation: 773

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.

enter image description here Is that possible without using scroll view?Pleae help

Upvotes: 0

Views: 738

Answers (2)

Muhammed Sadiq.HS
Muhammed Sadiq.HS

Reputation: 773

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

}

Upvotes: 0

jtbandes
jtbandes

Reputation: 118671

Yes, you can set the view's transform. In particular CGAffineTransformMakeScale will probably be useful to you.

Upvotes: 2

Related Questions