Re: UIView animation
Re: UIView animation
- Subject: Re: UIView animation
- From: Christian Ziegler <email@hidden>
- Date: Fri, 03 Sep 2010 08:25:56 +0200
Hi!
Thanks Wyatt and Ricky for your answers.
The views have to visible at the same time. I thought of making an image out of this view as well but I didn't know how. I googled a little and this is what I found:
UIGraphicsBeginImageContext(myView.bounds.size);
[myView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Cheers
Chris
On Sep 3, 2010, at 12:18 AM, Wyatt Webb wrote:
>
> On Sep 2, 2010, at 3:11 PM, Christian Ziegler wrote:
>
>> Hi all,
>>
>> I could use your help because I'm running out of ideas!
>>
>> Here's the situation. I got this custom view on screen which I want to remove from the screen by moving it outside the left border of the screen. However at the same time, I want to move it back in from the right side but at a different y-Coordinate. So for instance it moves out at y=44 and at the same time it moves back in from the other side at y=0.
>>
>> I tried several approaches and the most promising (I reckon) is to create a copy of the view. This is not so easy though because UIView does not implement NSCopying. My custom view also has subviews and well the animation apparently gets a little confused if you animate two different (equal but different object) views which share the same subviews.
>>
>> Has anybody the slightest idea how I could achieve this? Every tip is welcome :)!
>
> Does the same view need to visible in two places at once? Or are you completely removing it before it starts to reappear?
>
> If the same view needs to show up at both edges at the same time, then you'll have to make some kind of copy. If the contents won't change during the animation, you could just rasterize your view hierarchy and use that image to act as a placeholder for one of the locations during the animation.
>
> If the view will only be in one place at one time, you could do this as a two-stage animation.
>
> Set up the animation to cause the view to leave the screen and register yourself as the delegate to get the completion callback.
> Upon callback, move the view to the other side of the screen (still off screen) and set up an animation to move it back into view.
>
> Make sense?
>
> Wyatt
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden