ios - Sliding uiview keeps animating -


I think I'll start with the code ...

  - (zero) MapView: (MKMapView *) was mapViewedSyncEnentationView: (MKAnationView *) See {DLog (@ "Annotation:% @", [[View annotation title]); Self. Selected annotations = [see annotation]; [Self. See Direction View Set: No]; [UIView Start Permissions: @ "SlideUp" Reference: NULL]; Self.directionsView.frame = CGRectOffset (self.directionsView.frame, 0, -self.directionsView.frame.size.height); [UIView commitAnimations]; } I have a map where users can tap on the business and a UIUUI can "see guides" slide down from below. The problem occurs when more than one business tape Are done. The scene keeps climbing up to 49 pixels. How am i doing this  

I have another way that defines what happens when a business is unselected and I tried to use the same animation method, with only reverse (set-up: yes) But no luck :)

This method is applied every time , Then re-inducing by copying itself from the U component of your copy:

  self.directionsView.frame = CGRectOffset (self.directionsView.frame, 0, -self.directionsView.frame.size .height);   

So if you tap several times without resetting the scene position, it will keep sliding in its original view (probably above the top of the screen, which I find always enjoyable When I do this by mistake).

The simplest solution is to define two CGRects, and specify either directly or individually based on self.directionView.frame whether you want to view footage- or off-screen. You can call these lines many times, and the effect will not be cumulative in your example.

  CGRT on screen = CGRactack (X, Y, L, W); // Fill true values ​​CGRect offScreen = CGRectMake (x, large_import_of_, l, w); // Again, use actual values ​​  

You can also set the frame to its normal "on-screen" value, and adjust the direction of the transit of the directionView, Which is also animatable. Again, you can apply more than one of these times and the effects are not cumulative.

  // self.directionsView.transform = CGAffineTransformIdentity on screen; // "Identity" which means that there is no change in the status of / off screen. See the screen. Transform = CZP Transformamac Conversions (0, see automatic direction. Boundsskies High.); // change 0 points is OK, and height is below   

Note the use of "border" in the code above. When you change the change, the frame is undefined, so if you try to set the frame (or any other calculation on the current frame), the scene may move unexpectedly, except when the result is identical There is anything.

(Disclaimer: code typed from memory - not tested in XCode.)

Comments