当前位置: 首页>>代码示例>>C#>>正文


C# UIImage.AttachImageRight方法代码示例

本文整理汇总了C#中UIKit.UIImage.AttachImageRight方法的典型用法代码示例。如果您正苦于以下问题:C# UIImage.AttachImageRight方法的具体用法?C# UIImage.AttachImageRight怎么用?C# UIImage.AttachImageRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIKit.UIImage的用法示例。


在下文中一共展示了UIImage.AttachImageRight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReloopForInterfaceChange

        private void ReloopForInterfaceChange()
        {
            if (this.updating)
            {
                return;
            }
            UIImage single = int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]) >= 7 ? this.TintedImage(this.AnimationImage) : this.AnimationImage;
            var imgs = this.AnimationImages;
            var masterImage = this.MasterImage;
            if (this.MasterImage == null || imgs == null || imgs.Count == 0 || imgs.First().Size.Width != this.Frame.Width)
            {
                var expectedWidth = this.Frame.Width + SingleElementWidth;
                bool completeReloop = this.MasterImage == null;

                if (completeReloop)
                {
                    masterImage = new UIImage(single.CGImage);
                    while (masterImage.Size.Width - SingleElementWidth < expectedWidth)
                    {
                        masterImage = masterImage.AttachImageRight(single);
                    }
                }
                else
                {
                    if (masterImage.Size.Width - SingleElementWidth < expectedWidth)
                    {
                        while (masterImage.Size.Width - SingleElementWidth < expectedWidth)
                        {
                            masterImage = masterImage.AttachImageRight(single);
                        }
                    }
                    else
                    {
                        while (masterImage.Size.Width - SingleElementWidth > expectedWidth + SingleElementWidth)
                        {
                            masterImage = masterImage.CropByX(SingleElementWidth);
                        }
                    }
                }

                this.MasterImage = masterImage;

                if (imgs == null)
                {
                    imgs = new List<UIImage>();
                }
                else
                {
                    imgs.Clear();
                }

                var size = new CGSize(this.Frame.Width, masterImage.Size.Height);
                var pixels = single.Size.Width * single.CurrentScale;
                var anchorX = -Math.Abs(masterImage.Size.Width - size.Width);
                for (int i = 0; i <= pixels; i++)
                {
                    UIGraphics.BeginImageContextWithOptions(size, false, single.CurrentScale);
                    CGContext context = UIGraphics.GetCurrentContext();
                    if (context != null)
                    {
                        context.TranslateCTM(0, masterImage.Size.Height);
                        context.ScaleCTM(1, -1);

                        context.DrawImage(new CGRect(anchorX + i, 0.0, masterImage.Size.Width, masterImage.Size.Height), masterImage.CGImage);

                        UIImage result = UIGraphics.GetImageFromCurrentImageContext();

                        imgs.Add(result);
                    }

                    UIGraphics.EndImageContext();
                }
            }

            this.AnimationImages = imgs;

            if (this.theImageView == null)
            {
                this.theImageView = new UIImageView();
            }
            if (this.host == null)
            {
                this.host = new UIView(this.Bounds);
                this.host.BackgroundColor = UIColor.Clear;

                if (int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]) >= 7)
                {
                    // this.host.Layer.CornerRadius = this.Frame.Size.Height / 2.0f;
                }
                else
                {
                    this.host.Layer.CornerRadius = this.theImageView.Frame.Size.Height / 2;
                }
                this.host.ClipsToBounds = true;
            }

            this.theImageView.Layer.MasksToBounds = true;

            if (this.host.Superview != this)
            {
//.........这里部分代码省略.........
开发者ID:evnik,项目名称:UIFramework,代码行数:101,代码来源:IndeterminateUIProgressView.cs


注:本文中的UIKit.UIImage.AttachImageRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。