1
我有一個導航控制器內的視圖,並希望創建一個'完整(應用程序)屏幕'覆蓋,說什麼用戶應該做的事情。我已經在其他應用程序上看到了一些透明度,並且效果很好。我正在嘗試下面,但內容結束了我的navcontroller標題下。調查討論將矩形轉換爲「窗口級」位置等,但仍然在下面。IOS:創建全屏'覆蓋'UIView(Monotouch)
下面我的微弱嘗試的任何替代品?或者一個樣本的鏈接也會很好。
謝謝!
HelpOverlayUIView _overlayView;
public void PresentHelpOverlay()
{
RectangleF windowFullFrame = new RectangleF(0,0,UIScreen.MainScreen.Bounds.Width,UIScreen.MainScreen.Bounds.Height);
// Conversion?
//[aView convertPoint:localPosition toView:nil];
RectangleF overlayFrame = View.ConvertRectFromView(windowFullFrame ,null);
// Clear old one if it exists.
if (_overlayView != null) _overlayView = null;
// Instantiate popup view and add to (in this case the 2nd tier view). This is in an abstract class, if in a concrete one it'd normally just be View.Add
_overlayView = new HelpOverlayUIView(this, overlayFrame);
// tried th, didn't change it.
// this.WantsFullScreenLayout = true;
// _childView.BringSubviewToFront(_overlayView);
_overlayView.Alpha = 0;
_childView.Add (_overlayView);
// Setup event to close without doing anything.
_overlayView.CloseView += (sender, e) => {
Console.WriteLine ("close called");
// animate modal popup's departure
UIView.Animate (
0.5f,
() => {
// Anim Code
_overlayView.Alpha = 0;
},
null
);
};
// animate modal popup's arrival
UIView.Animate (
0.5f,
() => {
// Anim Code
_overlayView.Alpha = 1;
},
null
);
}
(該視圖僅僅是一個過載到Draw()方法的UIView是放置文本等輸入到視圖)
謝謝,我會給它一個去! – Glinkot
我在這個很多個月之後再添加一點。確保上面的'窗口'是小寫'w'。確實有一個W大寫的窗口,但在我的情況下,它拋出了一個異常。 – Glinkot