如何在Xamarin中将按钮从右向左移动(iOS)
问题描述:
我是Xamarin和iOS的新手。我使用Xamarin在Visual Studio中制作应用程序。我想将我的按钮从右侧移动到左侧。因为我使用下面的代码:如何在Xamarin中将按钮从右向左移动(iOS)
fabButton.SetImage(UIImage.FromFile("Plus Math-24"), UIControlState.Normal);
pt = fabButton.Center;
UIView.Animate(2, 0, UIViewAnimationOptions.CurveEaseInOut,
() => {
fabButton.Center = new CGPoint(UIScreen.MainScreen.Bounds.Left - fabButton.Frame.Width/15, fabButton.Center.Y);},
() => {
fabButton.Center = pt;}
);
我的按钮正在移动,但它回到我的以前的位置。任何帮助被赞赏。
这是我的图片:
更新:
当我尝试不同的代码更好地工作
更改代码:
UIView.Animate(2, 0, UIViewAnimationOptions.CurveEaseInOut,
() =>
{
fabButton.Center = new CGPoint(50,611);
},
() =>
{
}
);
正常屏幕:
当点击按钮:
但它有一些问题,这个按钮是走一些高度上边..