Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8190423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:38:52+00:00 2026-06-07T03:38:52+00:00

I am trying to display a UIMenuController in a Toolbar button. I have the

  • 0

I am trying to display a UIMenuController in a Toolbar button. I have the code below but I am unsure as to what should be in the “SetTargetRect” method.

What should I put in the SetTargetRect method to display the Menu?

Is there anything else that is missing from this code?

ToolbarItems = new UIBarButtonItem[] { 
new UIBarButtonItem ("Sort", UIBarButtonItemStyle.Bordered, (sender, e) => {
    var menu = UIMenuController.SharedMenuController;
    menu.MenuItems = new UIMenuItem[] {
        new UIMenuItem ("Current", new Selector ("SortRaceEntrants")),
        new UIMenuItem ("Movers", new Selector ("SortRaceEntrants")),
        new UIMenuItem ("Opening", new Selector ("SortRaceEntrants")),
        new UIMenuItem ("Number", new Selector ("SortRaceEntrants"))
    };
    //menu.SetTargetRect ();
    menu.SetMenuVisible (true, true);
}),
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:38:54+00:00Added an answer on June 7, 2026 at 3:38 am

    According to the API docs, the target rect defines the area that you want to display the menu relative to – iOS will either show the menu above or below the area defined by TargetRect.

    When you make this menu visible, UIMenuController positions it
    relative to a target rectangle on the screen; this rectangle usually
    defines a selection. The menu appears above the target rectangle or,
    if there is not enough space for it, below it. The menu’s pointer is
    placed at the center of the top or bottom of the target rectangle, as
    appropriate. Be sure to set the tracking rectangle before you make the
    menu visible. You are also responsible for detecting, tracking, and
    displaying selections.

    and

    This target rectangle (targetRect) is usually the bounding rectangle
    of a selection. UIMenuController positions the editing menu above this
    rectangle; if there is not enough space for the menu there, it
    positions it below the rectangle. The menu’s pointer is placed at the
    center of the top or bottom of the target rectangle as appropriate.
    Note that if you make the width or height of the target rectangle
    zero, UIMenuController treats the target area as a line or point for
    positioning (for example, an insertion caret or a single point).

    Once it is set, the target rectangle does not track the view; if the
    view moves (such as would happen in a scroll view), you must update
    the target rectangle accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of Person pocos, populated below. I'm trying display them alphabetically
trying to display data only after variables have been set. $(document).ready(function () { function
I am trying to display my popover menu whenever the user clicks on a
I am trying to display all possible values for a sub-property. Below I am
Im trying to display the image i have coming from an intent.putExtra on a
Im trying to display my dynamic wordpress menu in the header of phpbb. How
Im trying to display this listview, but I keep getting a: 07-17 21:14:22.233: ERROR/AndroidRuntime(349):
Im trying to display hyperlinks (formated as hyperlink) in a listview row but not
Im trying to display two list: one for categories and brand but only the
I trying to display image in picture box. The application have two part. First

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.