本文整理汇总了C#中UIView.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# UIView.Dispose方法的具体用法?C# UIView.Dispose怎么用?C# UIView.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIView
的用法示例。
在下文中一共展示了UIView.Dispose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad();
View.BackgroundColor = UIColor.White;
View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
// Adjust taps/touches required to fit your needs.
UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer() {
NumberOfTapsRequired = 1,
NumberOfTouchesRequired = 1,
};
tapRecognizer.AddTarget((sender) => {
// The foreach is only necessary if you have more than one touch for your recognizer.
// For all else just roll with zero, `PointF location = tapRecognizer.LocationOfTouch(0, View);`
foreach (int locationIndex in Enumerable.Range(0, tapRecognizer.NumberOfTouches)) {
PointF location = tapRecognizer.LocationOfTouch(locationIndex, View);
UIView newTapView = new UIView(new RectangleF(PointF.Empty, ItemSize)) {
BackgroundColor = GetRandomColor(),
};
newTapView.Center = location;
View.Add(newTapView);
// Remove the view after it's been around a while.
Task.Delay(5000).ContinueWith(_ => InvokeOnMainThread(() => {
newTapView.RemoveFromSuperview();
newTapView.Dispose();
}));
}
});
View.AddGestureRecognizer(tapRecognizer);
}
示例2: Rotate
UIImage Rotate(UIImage self,float degrees)
{
return self;
// calculate the size of the rotated view's containing box for our drawing space
UIView rotatedViewBox = new UIView(new System.Drawing.RectangleF(0,0,self.Size.Width * self.CurrentScale,self.Size.Height*self.CurrentScale));
CGAffineTransform t = CGAffineTransform.MakeRotation(MathHelper.ToRadians(degrees));
rotatedViewBox.Transform = t;
var size = rotatedViewBox.Frame.Size;
Console.WriteLine(size);
rotatedViewBox.Dispose();
// Create the bitmap context
UIGraphics.BeginImageContext(size);
CGContext bitmap = UIGraphics.GetCurrentContext();
bitmap.TranslateCTM(size.Width/2,size.Height/2);
bitmap.RotateCTM(MathHelper.ToRadians(degrees));
// Now, draw the rotated/scaled image into the context
bitmap.ScaleCTM(1,-1);
bitmap.DrawImage(new System.Drawing.RectangleF(-self.Size.Width*self.CurrentScale /2,-self.Size.Height*self.CurrentScale/2,self.Size.Width*self.CurrentScale,self.Size.Height*self.CurrentScale),self.CGImage);
UIImage newImage = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
return newImage;
}
示例3: NewObjectDispose
public void NewObjectDispose()
{
var obj = new UIView();
obj.Dispose();
}