thndrkiss
thndrkiss

Reputation: 4595

UIView removeFromSuperview

The removeFromSuperview method actually pulls off the image very quickly, is there a way to remove it in a animated fashion. thanks

Upvotes: 2

Views: 4524

Answers (3)

pschang
pschang

Reputation: 2618

1) insert your new subview (index of 0 so it's hidden) onto the view stack.

    [window insertSubview:myNewView atIndex:0];

2) Then animation the view out (straight from the docs) is:

[UIView animateWithDuration:0.2
       animations:^{ view.alpha = 0.0; }
       completion:^(BOOL finished){ [view removeFromSuperview]; }]

Upvotes: 0

Vladimir
Vladimir

Reputation: 170829

If you're targeting iOS4 (code snippet from UIView docs):

[UIView animateWithDuration:0.2
                 animations:^{ table.alpha = 0.0; }
                 completion:^(BOOL finished){ [table removeFromSuperview]; }];

Upvotes: 7

Related Questions