2013-05-27 30 views
1

我有一个形象,一个标志,这在我的Monotouch.Dialog顶部显示使用此代码拉伸的UIView:Monotouch.Dialog第

 var logo = new UIImageView(logonLogoPNG) 
      { 
       AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | 
            UIViewAutoresizing.FlexibleLeftMargin | 
            UIViewAutoresizing.FlexibleBottomMargin | 
            UIViewAutoresizing.FlexibleRightMargin, 
      }; 
     var secLogo = new Section(logo); 

的问题是,当窗体显示在一台iPad徽标延伸。 Autosizingmask似乎没有帮助。

我该如何阻止拉伸?

回答

0

这里是我的解决方案:

 //Add a centered Logo in the top Section of the Monotouch.dialog 
     var logo = new UIImageView(image) 
         { AutoresizingMask = UIViewAutoresizing.FlexibleMargins}; 
     var logoView = new UIView(new RectangleF(0, 0, UIScreen.MainScreen.Bounds.Width,logo.Frame.Height)); 
     logo.Center = logoView.Center; 
     logoView.AddSubview(logo); 

诀窍是标志的中心设置为包含视图的中心,然后做出灵活的利润率标志流。