Note that there are some explanatory texts on larger screens.

plurals
  1. POUIView animation on button press - not visible on first try
    primarykey
    data
    text
    <p>I have a set of three UITableViews in a UIView positioned horizontally, two are visible on screen at any one time, the other is off screen. I'm trying to animate a position change where on a button press, the leftmost table slides offscreen to the left, then the other two slide over to fill the positions.</p> <p>The problem I have is that if I try to animate more than one of the tables at once, nothing happens on the first button press. But on the second press everything works ok. If I try to animate just one table, then it works on the first press. My button handler code is below:</p> <pre><code>- (IBAction)buttonPressed:(id)sender{ CGRect newUITableView1Frame = self.originalUITableView1Frame; newUITableView1Frame.origin.x = newUITableView1Frame.origin.x - newUITableView1Frame.size.width; if(!makeSubButtonPressed){ self.makeSubButtonPressed = YES; [self.makeSubButton setTitle:@"Choose Team Lineup" forState:UIControlStateNormal]; [UIView animateWithDuration:0.5 delay:0.1 options:UIViewAnimationOptionCurveEaseOut animations:^{ self.UITableView1.frame = newUITableView1Frame; self.UITableView2.frame = originalUITableView1Frame; self.UITableView3.frame = originalUITableView2Frame; } completion:^(BOOL finished){NSLog(@"Animation Finished");}]; } </code></pre> <p>In the ViewDidLoad method:</p> <pre><code>self.originalUITableView1Frame = self.UITableView1.frame; self.originalUITableView2Frame = self.UITableView2.frame; </code></pre> <p>On the first press, "Animation Finished" is always printed in the console so the code is executed. I've also tried separate animation blocks for each animation, but the result is the same.</p> <p>I can't figure out what's going wrong. Any suggestions?</p> <p>EDIT: I should probably add that I'm using Storyboards for this and all the UITableViews are added there.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload