Re: animating addSubview with iOS4
Re: animating addSubview with iOS4
- Subject: Re: animating addSubview with iOS4
- From: Robert Vojta <email@hidden>
- Date: Wed, 02 Mar 2011 11:34:16 +0100
That's because viewDidLoad doesn't mean it's going to be displayed now. It just informs you that view was loaded. You have to use viewWillAppear/viewWillDisappear or any other method where you know that view is visible = you'll see animations.
Sent from my iPhone
On 2.3.2011, at 10:44, Martin Linklater <email@hidden> wrote:
> Thanks Luke
>
> I did manage to find a solution. I was creating and calling the transition from within 'viewDidLoad'. If I move the call to 'transitionWithView' out of 'viewDidLoad' and into a different method the transition works fine. Animating properties work when called from 'viewDidLoad', but transitions hit their end state instantly.
>
> Not sure if this is how it's meant to work, but I've not found any documentation mentioning this subtlety.
>
> Thanks.
>
> On 2 Mar 2011, at 04:40, Luke Hiesterman wrote:
>
>> You can only animate properties documented as "animatable". Try adding your subview to its superview with an alpha of 0.0 and then animating the alpha to 1.0.
>>
>> Luke
>>
>> On Mar 1, 2011, at 8:32 AM, Martin Linklater <email@hidden> wrote:
>>
>>> Hi - I'm having trouble getting Core Animation to animate a UIButton appearing on my parent view. My old code did this:
>>>
>>> <create button>
>>> [self.view addSubview:newButton];
>>>
>>> The button appeared straight away and works fine. Now, I'm trying to animate the appearance of this button and I just can't seem to get it working. Whatever I try the button appears straight away, just like the line above. I've tried numerous snippets of sample code, none of them work. My current code looks like this:
>>>
>>> <create button>
>>> [UIView transitionWithView:self.view duration:1.0 options:UIViewAnimationOptionTransitionCurlUp animations:^{ [self.view addSubview:newButton]; } completion:nil];
>>>
>>> I'm obviously doing something wrong here, can anyone point me in the right direction ?
>>>
>>> Thanks - I'm new to CA, so please bare with me 8)._______________________________________________
>>>
>>> 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
>
> _______________________________________________
>
> 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
_______________________________________________
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