I have an irregular shaped custom button and I would like for it to animate with the curl up effect. The problem is that Xcode places my irregular shaped button in a rectangle. The button is a .png and the transparency is preserved. On the simulator when the button curls up, the whole rectangular area marked by a black background curls up with it. I was wondering how it would be possible to just have the button curve up. Is it even possible to do that? Thanks!
Asked
Active
Viewed 411 times
1
2 Answers
1
Unfortunately is not possible. It's an UIViewAnimation, as it says is applied to the whole UIView frame. You can make the background transparent but the shadows will be projected from the containing frame's bounds, resulting in a very ugly effect. I'm looking for some bespoke code which can replicate the effect, but so far I have found nothing interesting.

Andrea
- 638
- 9
- 20
0
you could make it a UIImageView with the image loaded and animate this instead of making a UIButton. But then you have to write the code to react to touch events on your own...

Gotschi
- 3,175
- 2
- 24
- 22
- (IBAction)btnClick:(id)sender{ [UIButton beginAnimations:nil context:nil]; [UIButton setAnimationDuration:2.0]; [UIButton setAnimationBeginsFromCurrentState:YES]; [UIButton setAnimationTransition:UIViewAnimationTransitionCurlUp forView:(UIView*)sender cache:YES]; ((UIView*)sender).hidden = YES; [UIButton commitAnimations]; }
– DanielRak Feb 07 '12 at 04:08