Reputation: 461
If I were wanting to make a map on my app bigger on touch, how would I do that? Would I use core animation? Example, I want to change my map from 50px height to 70px height on touch.
Thanks :D
Upvotes: 0
Views: 169
Reputation: 1644
First you need to know when a user is touching the MKMapView and in the method that the user touched the map you do that:
[UIView animateWithDuration:0.5 animations:^{
CGRect rect = myMapView.frame;
rect.size = CGSizeMake(50, 70);//Set to Bigger Size
myMapView.frame = rect;
}];
And when the user leaves the touch from map:
[UIView animateWithDuration:0.5 animations:^{
CGRect rect = myMapView.frame;
rect.size = CGSizeMake(50, 50);//Set to Original Size
myMapView.frame = rect;
}];
Upvotes: 1
Reputation: 2575
If you want the resize animated then yes you can use core animation. However if you just want to resize, you can just redraw the map view by doing the following:
CGRect oldFrame = yourMapView.frame;
oldFrame.size.height = oldFrame.size.height + 20; //aka 50+20 = 70
yourMapView.frame = oldFrame;
Upvotes: 1