[英]How to Move Button from Right to Left in Xamarin(iOS)
我是Xamarin和iOS的新手。 我正在使用Xamarin在Visual Studio中制作App。 我想將我的按鈕從右側移動到左側。 為此,我使用下面的代碼:
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);
},
() =>
{
}
);
正常畫面:
當點擊按鈕時:
但它有一些問題,“按鈕”的高度要高一些。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.