本文整理汇总了C#中CGRect.IsNull方法的典型用法代码示例。如果您正苦于以下问题:C# CGRect.IsNull方法的具体用法?C# CGRect.IsNull怎么用?C# CGRect.IsNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGRect
的用法示例。
在下文中一共展示了CGRect.IsNull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FinishedLaunching
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
// Two disjoint rects
var r1 = new CGRect (50, 50, 10, 10);
var r2 = new CGRect (100, 100, 10, 10);
// This condradicts with Apple's doc – https://developer.apple.com/reference/coregraphics/cgrectnull
// The null rectangle. This is the rectangle returned when, for example, you intersect two disjoint rectangles.
// Note that the null rectangle is not the same as the zero rectangle.
// For example, the union of a rectangle with the null rectangle is the original rectangle (that is, the null rectangle contributes nothing).
var tmp = r1;
tmp.Intersect (r2); // this is mutable method
Console.WriteLine (tmp.IsNull ()); // Expected true, but result is false
tmp = CGRectIntersection (r1, r2);
Console.WriteLine (tmp.IsNull ()); // Expected true, actual true
// This should be CGRectNull
var rectNull = new CGRect (nfloat.PositiveInfinity, nfloat.PositiveInfinity, 0, 0);
Console.WriteLine (rectNull.IsNull ()); // Expected true, actual true
// CGRectEmpty and CGRectNull are different
var union1 = r1.UnionWith (CGRect.Empty); // new rect {0, 0, 60, 60}
Console.WriteLine (union1);
var union2 = r1.UnionWith (rectNull); // r1
Console.WriteLine (union2);
return true;
}