ios - Animate a view on key window while dragging another view with UILongPressGestureRecognizer -
i have added uilongpressgesturerecognizer
view, , after long press event, user can drag view.
i have added view on key window (need custom view on navigation , tab bar controllers, why need add on key window) using below code:
// add custom view on key window. uiwindow *currentwindow = [uiapplication sharedapplication].keywindow; [currentwindow addsubview:customview];
now, when dragging first view beyond (screensize/2)
point, want customview animate right side of view. tried following code present view:
// animate customview view. [uiview animatewithduration:0.50f animations:^{ customview.frame = cgrectmake(screen_width - customviewwidth, 0, customviewwidth, screen_height); } completion:nil];
but view not appear neither animates. tried use dispatch_async(dispatch_get_main_queue(),{});
still no success.
any appreciated.
you should use uiattachmentbehavior.
it specifies dynamic connection between 2 dynamic items, or between dynamic item , anchor point. when dynamic item moves, either tracking gesture or via other input, attached dynamic item moves—if possible given other dynamic parameters , boundaries. can configure attachment behavior using length, damping, , frequency properties.
Comments
Post a Comment