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 6666103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:47:36+00:00 2026-05-26T02:47:36+00:00

I am using the UIMenuController on a custom UIView subclass. This means it can

  • 0

I am using the UIMenuController on a custom UIView subclass. This means it can become first responder, and claims it canPerformAction on the “delete” action.

I would also like this view’s superview (also a custom UIView) to be able to use the menu controller, so on that superview, I have marked it as being able to be first responder, and implemented canPerformAction for different actions (“copy” and “cut” in this case).

Here’s the thing– when I make the menu visible from the (first) subview, it puts all three actions in the menu: delete, copy, and cut. In the debugger, I see canBecomeFirstResponder and canPerformAction being invoked on both views before the menu appears.

What’s going on here? Why isn’t the menu controller restricted to the view that’s become first responder? Or am I not diagnosing this correctly?

Thanks.

  • 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-05-26T02:47:36+00:00Added an answer on May 26, 2026 at 2:47 am

    What code are you using?

    In the documentation for canPerformAction:withSender:,

    This default implementation of this method returns YES if the responder class implements the requested action and calls the next responder if it does not. … Note that if your class returns NO for a command, another responder further up the responder chain may still return YES, enabling the command.

    It seems to be contradictory, saying the default implementation recurses up the responder chain, but then also that UIMenuController recurses up the responder chain if you return NO.

    The easiest fudge is probably to override -nextResponder to return nil, but that might have other side-effects (for one, actions with a “nil” target go up the responder chain by default!).

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

Sidebar

Related Questions

I've customized UIMenuController like this: UIMenuItem* note = [[[UIMenuItem alloc] initWithTitle:@Note action:@selector(noteItemTapped:)] autorelease]; UIMenuItem*
I'm attempting to disable paste in a textfield using the following code: -(BOOL)canPerformAction:(SEL)action withSender:(id)sender
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Using the Cocoa Framework, how can I add bullets and numbering to text?
Using jQuery, one can easily find out whether a particular element is visible using
Using the HTML5 File API I can get the Binary String representation of a
using file_get_contents , I open an Internet URL and get the contents of this
Using Java, how can I extract all the links from a given web page?

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.