1 回答

TA貢獻1806條經驗 獲得超8個贊
有可能,但是前提是View的Y坐標正好是40,當你隱藏狀態欄的時候, Y坐標就變成0了,整個View就會上移。
一般來說,Tabview 子視圖的X和Y(0,0)坐標從 開始,而不是從 開始(0,40),因此下面的代碼可能不起作用。
UIView.Animate(0.2, () => {
var frame = this.View.Frame;
this.View.Frame = new CoreGraphics.CGRect(frame.X, frame.Y, frame.Width, frame.Height - 40);
this.View.InvalidateIntrinsicContentSize();
this.View.LayoutIfNeeded();
this.View.SetNeedsLayout();
});
不過代碼是沒有問題的,你只需確保子視圖的大小從(0,40)開始,就可以看到效果了。
=======================================更新============ =====================
如果您想要轉換視圖,請按如下方式編碼:
UIView.Animate(2, () =>
{
var frame = this.View.Frame;
this.View.Transform = new CoreGraphics.CGAffineTransform((System.nfloat)0.8, 0, 0, (System.nfloat)0.8, 0, 0);
//change contained parameter can modify the level of transform , and even can back to normal status
this.View.InvalidateIntrinsicContentSize();
this.View.LayoutIfNeeded();
this.View.SetNeedsLayout();
});
回到正常狀態,替換為:
this.View.Transform = new CoreGraphics.CGAffineTransform(1, 0, 0, 1, 0, 0);
- 1 回答
- 0 關注
- 130 瀏覽
添加回答
舉報