2012-12-20 5 views
1

는 내가있는 navigationController에서 볼 수 있고, 사용자가 무엇을해야하는지에 대해 몇 가지를 말한다 '전체 (응용 프로그램) 화면'오버레이를 만들고 싶습니다. 나는 다른 애플 리케이션에 약간의 투명성으로 이것을 끝낸 것을 보았고 잘 작동합니다. 나는 아래에서 시도하고있다. 그러나 내용은 나의 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 
     ); 

    } 

당신과 같은 뷰 계층에서 더 높은 것을 최대로 _overlayView를 추가 할 수

답변

1

(뷰는 뷰에 텍스트 등을 배치 그리기() 메소드에 과부하 단지의 UIView입니다) NavigationViewController. NavigationViewController가 RootViewController로 설정된 경우 (실제로 상관없이)이 방법을 시도해 볼 수 있습니다.

((AppDelegate)UIApplication.SharedApplication.Delegate).Window.RootViewController.Add(_overlayView); 

당신은 또한이 같은 전면에 서브 뷰를 가져올 수 있지만, 이것은 _childView이 NavigationViewController이었다 않는 한 당신이 원하는 무엇을 정말하지 않은 (모든 것이 전면에, 해당 뷰의 전면입니다).

_childView.BringSubviewToFront(_overlayView); 
+1

감사합니다. – Glinkot

+0

나는이 몇 달 후에 한 지점을 추가 할 것입니다. 위의 '창'에 소문자 'w'가 있는지 확인하십시오. 참으로 자본 W를 가진 창이 있지만, 제 경우에는 예외를 던졌습니다. – Glinkot