How to animate a UIview when the UIVIew is hidden in the sameView

I have a view in that i have dragged one more View and assigned it has

IBOutlet UIView *popupIpadView which contains tableview textfield and other button.

What my requirement is on loading popupIpadView will be hidden initially,when i click on a button this PopupIpadview will appear.But i want this view to appear in a animated Transition like left to right or vice versa.how can i do this???please suggest me.For exampel i am using below code nothing happens.

  • (IBAction)showPopover:(UIButton *)sender {

    popupiPhoneView.hidden = NO;

    popupiPhoneView.backgroundColor = [UIColor colorWithWhite:0 alpha:.5];

    [UIView beginAnimations:nil context:NULL];

    [UIView setAnimationCurve:UIViewAnimationCurveLinear];

    [UIView setAnimationDuration:3.0];

    [UIView commitAnimations];

}

Answers


Instead of using Hidden property, set the alpha value to 0 and the origin to the left side out of the visible screen, say -320 x and 0 y.

In your animation block, set alpha to one while passing appropriate transition style. Initially set your view to

yourview.alpha = 0;
yourview.x = -320;

Then set it to appropriate coordinates in transition code.

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES];

yourview.alpha = 1;
yourview.x = 320; // new coordinates
[UIView commitAnimations];

Need Your Help

ast.literal_eval not working (python string of list to list)

python string list eval abstract-syntax-tree

I am trying to convert the following string of a list back to a list.

converting dd/mm/yyyy into yyyy/mm/dd using php and sql

php mysql datetime date

i'm quite new with php. i think this is quite straight forward but i'm confused.