【问题标题】:Monotouch.Dialog stretching UIView in SectionMonotouch.Dialog 在部分中拉伸 UIView
【发布时间】:2013-05-27 20:14:59
【问题描述】:

我的 Monotouch.Dialog 顶部出现了一个图像,一个徽标,使用以下代码:

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

问题在于,当表单在 iPad 中显示时,徽标会拉伸。 Autosizingmask 似乎没有帮助。

如何停止拉伸?

【问题讨论】:

    标签: c# iphone xamarin.ios xamarin monotouch.dialog


    【解决方案1】:

    这是我的解决方案:

            //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);
    

    诀窍是将徽标的中心设置为包含视图的中心,然后使徽标以灵活的边距流动。

    【讨论】:

      猜你喜欢
      • 2012-03-12
      • 1970-01-01
      • 2014-04-15
      • 2011-09-19
      • 1970-01-01
      • 1970-01-01
      • 2011-08-01
      • 1970-01-01
      • 2012-02-04
      相关资源
      最近更新 更多