15
feb

Hi all!
By chance i founded this tricks that permit to show a “Dictionary definition” for the selected word in a UITextField on a hidden menu.

Menu contains these actions:

  • cut
  • copy
  • select
  • select all
  • paste
  • suggest
  • definition
  • indent left
  • indent right
  • It’s a cool tricks, that show an hidden menu with a lot of options, that i never see before!

    Watch this:


    iOS Hidden Menu features
    iOS Hidden Menu features
    iOS Hidden Menu features

    And this is the dictionary definition for pizza on simulator:


    iOS Hidden Menu features

    How?

    Subclass UITextField and override:

    1
    2
    3
    - (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
      return [super canPerformAction:action withSender:sender];
    }

    Instead, if you want to block one or more actions from menu, add sel_isEqual:

    1
    2
    3
    4
    5
    6
    7
    - (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
      if ( sel_isEqual(action, @selector(paste:)) ) return NO;
      if ( sel_isEqual(action, @selector(copy:)) ) return NO;
      // [...] etc etc

      return [super canPerformAction:action withSender:sender];
    }

    that’s all!

    enjoy.

    Ref: albertopasca.it



    FacebookTwitterDeliciousLinkedInGoogle BookmarksNetlogGoogle GmailMySpaceGoogle ReaderShare

    , , , , ,

    Add reply

    You must be logged in to post a comment.

    Switch to our mobile site