Извините, я опять ничего не получил MonoTouch/C#, но я реализовал такое же поведение в ObjC, и он эмулирует скольжение отлично. В этом случае он используется для эмуляции поведения сползания при переходе на представление с помощью вкладки. Может быть, это полезно:
- (void)hitBack
{
// Get the views.
UIView * fromView = self.tabBarController.selectedViewController.view;
UIView * toView = ((UIViewController *)[self.tabBarController.viewControllers objectAtIndex:0]).view;
// Get the size of the view area.
CGRect viewSize = fromView.frame;
// Add the to view to the tab bar view.
[fromView.superview addSubview:toView];
// Position it off screen.
toView.frame = CGRectMake(-320 , viewSize.origin.y, 320, viewSize.size.height);
[UIView animateWithDuration:0.4 animations:
^{
// Animate the views on and off the screen. This will appear to slide.
fromView.frame =CGRectMake(320 , viewSize.origin.y, 320, viewSize.size.height);
toView.frame =CGRectMake(0, viewSize.origin.y, 320, viewSize.size.height);
}
completion:^(BOOL finished)
{
if (finished)
{
// Remove the old view from the tabbar view.
[fromView removeFromSuperview];
//change tab
self.tabBarController.selectedIndex = 0;
}
}];
}
В C#:
void HitBack()
{
// Get the views.
var fromView = tabBarController.SelectedViewController.View;
var toView = tabBarController.ViewControllers [0].View;
// Get the size of the view area.
var viewSize = fromView.Frame;
// Add the to view to the tab bar view.
fromView.Superview.AddSubview (toView);
// Position it off screen.
toView.Frame = new RectangleF (-320 , viewSize.Y, 320, viewSize.Height);
UIView.Animate (0.4,() => { animateWithDuration:0.4 animations:
// Animate the views on and off the screen. This will appear to slide.
fromView.Frame = new RectangleF (320 , viewSize.Y, 320, viewSize.Height);
toView.Frame =new RectangleF (0, viewSize.Y, 320, viewSize.Height);
}, (bool finished) => {
if (finished){
// Remove the old view from the tabbar view.
fromView.RemoveFromSuperview();
//change tab
tabBarController.SelectedIndex = 0;
});
}