1

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

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

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

如何停止拉伸?

4

1 回答 1

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

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

于 2013-05-28T17:10:53.757 回答