0
我是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);
},
() =>
{
}
);
正常屏幕:
當點擊按鈕:
但它有一些問題,這個按鈕是走一些高度上邊..