本文整理汇总了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)
{
//.........这里部分代码省略.........