Search code examples
xamarin.ioscgrect

CgRectGetWidth monotouch


floorf(CGRectGetMinX(visibleBounds) / CGRectGetWidth(visibleBounds)); 

What is the monotouch version of the methods CGrectGetWidth and CGrectGetMinX?


Solution

  • Update Xamarin.iOS Unified API

    Xamarin.iOS introduced the Unified API which now contains CGRect and friends inside CoreGraphics namespace.


    CGRect is Mapped to System.Drawing.RectangleF (See Type Mappings)

    So if you have your own System.Drawing.RectangleF

    The code would look like

    RectangleF visibleBounds = new RectangleF(0, 0, 10, 10); // Or your own instance of visibleBounds           
    float minx = visibleBounds.GetMinX();
    float w = visibleBounds.Width;
    

    Hope that helps

    Alex