本文整理汇总了C#中CGSize.Add方法的典型用法代码示例。如果您正苦于以下问题:C# CGSize.Add方法的具体用法?C# CGSize.Add怎么用?C# CGSize.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGSize
的用法示例。
在下文中一共展示了CGSize.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromCanvasSize
public static CanvasContainerView FromCanvasSize (CGSize canvasSize)
{
var screenBounds = UIScreen.MainScreen.Bounds;
var minDimension = NMath.Min (screenBounds.Width, screenBounds.Height);
var baseInset = 44f;
var size = canvasSize.Add (baseInset * 2);
size.Width = NMath.Max (minDimension, size.Width);
size.Height = NMath.Max (minDimension, size.Height);
var frame = new CGRect (CGPoint.Empty, size);
var canvasOrigin = new CGPoint ((frame.Width - canvasSize.Width) / 2, (frame.Height - canvasSize.Height) / 2);
var canvasFrame = new CGRect (canvasOrigin, canvasSize);
var canvasView = new UIView (canvasFrame);
canvasView.BackgroundColor = UIColor.White;
canvasView.Layer.ShadowOffset = new CGSize (0, 3);
canvasView.Layer.ShadowRadius = 4;
canvasView.Layer.ShadowColor = UIColor.DarkGray.CGColor;
canvasView.Layer.ShadowOpacity = 1f;
return new CanvasContainerView (frame, canvasView);
}