Skip to content

getMenuButtonBoundingClientRect ​

Get Menu Button Layout Information ​

getMenuButtonBoundingClientRect is a synchronous delegate method that provides the game with the position and size of the top-right menu, or capsule, button. Use the top-left corner of the game view as the origin.


Method Declaration ​

objectivec
- (nonnull SUDOPMenuButtonBoundingClientRect *)getMenuButtonBoundingClientRect;

Parameters ​

This method takes no parameters.


Return Value ​

This delegate method is optional. If implemented, it must return a nonnull SUDOPMenuButtonBoundingClientRect object. If no menu button bounds are available, return a rectangle with all six fields set to zero.

PropertyTypeDescription
widthNSIntegerWidth of the menu button.
heightNSIntegerHeight of the menu button.
topNSIntegerThe y-coordinate of the button’s top edge.
rightNSIntegerThe x-coordinate of the button’s right edge.
bottomNSIntegerThe y-coordinate of the button’s bottom edge.
leftNSIntegerThe x-coordinate of the button’s left edge.

Supply coordinates and dimensions in iOS logical points. The SDK converts them to the pixel values used by the game before returning the result.

After layout, convert the button bounds to the game view’s coordinate space using [buttonView convertRect:buttonView.bounds toView:gameView]. Fill the six properties from this rectangle in points.


Example ​

objectivec
- (SUDOPMenuButtonBoundingClientRect *)getMenuButtonBoundingClientRect {
    SUDOPMenuButtonBoundingClientRect *rect =
        [[SUDOPMenuButtonBoundingClientRect alloc] init];
    rect.width = 87;
    rect.height = 32;
    rect.top = 48;
    rect.right = 407;
    rect.bottom = 80;
    rect.left = 320;
    return rect;
}

Notes ​

  • right and bottom are the x-coordinate of the right edge and the y-coordinate of the bottom edge, respectively.
  • Keep right = left + width and bottom = top + height.
  • Return the latest layout on the next callback after screen rotation or a menu button position change.