¡@

Home 

2014/10/15 ¤U¤È 10:04:53

iphone Programming Glossary: canperformaction

How to get UIMenuController work for a custom view?

http://stackoverflow.com/questions/1146587/how-to-get-uimenucontroller-work-for-a-custom-view

copy id sender called when copy clicked in menu void menuItemClicked id sender called when Item clicked in menu BOOL canPerformAction SEL selector withSender id sender if selector @selector menuItemClicked selector @selector copy return YES return NO BOOL.. become first responder override method canBecomeFirstResponder cause default implementation returns NO as well as BOOL canPerformAction SEL selector withSender id sender which should return YES to any action that can be performed by firstResponder share improve..

Customize UIMenuController

http://stackoverflow.com/questions/1604716/customize-uimenucontroller

menu void onCustom1 UIMenuController sender void onCustom2 UIMenuController sender 3 you optionally need to implement canPerformAction in the responder chain for the view that will be first responder when you show the menu BOOL canPerformAction SEL action.. canPerformAction in the responder chain for the view that will be first responder when you show the menu BOOL canPerformAction SEL action withSender id sender if action @selector onCustom1 return YES logic here for context menu show hide if action.. NO logic here for context menu show hide if action @selector copy turn off copy if you like return NO return super canPerformAction action withSender sender 4 if the view you want to present the menu for doesn't already support showing a menu i.e. a UIWebView..

UITextView disabling text selection [duplicate]

http://stackoverflow.com/questions/1639485/uitextview-disabling-text-selection

disable the selecting of the text. I've tried canCancelContentTouches YES I've tried subclassing and overwriting BOOL canPerformAction SEL action withSender id sender But that gets called only After the selection BOOL touchesShouldCancelInContentView UIView..

Enable copy and paste on UITextField without making it editable

http://stackoverflow.com/questions/1920541/enable-copy-and-paste-on-uitextfield-without-making-it-editable

displays a UIMenuController after being tapped. CopyableLabel.m looks like this @implementation CopyableLabel BOOL canPerformAction SEL action withSender id sender if action @selector copy return YES else return super canPerformAction action withSender.. BOOL canPerformAction SEL action withSender id sender if action @selector copy return YES else return super canPerformAction action withSender sender BOOL canBecomeFirstResponder return YES BOOL becomeFirstResponder if super becomeFirstResponder..

UIMenuController not showing up

http://stackoverflow.com/questions/3112925/uimenucontroller-not-showing-up

UIMenuController Custom Items

http://stackoverflow.com/questions/3537795/uimenucontroller-custom-items

NSArray arrayWithObject item1 But I wanted that object to be the only one to appear so I added this code BOOL canPerformAction SEL action withSender id sender BOOL answer NO if action @selector item1 answer YES return answer The problem is it still..

iPhone/iPad context menu

http://stackoverflow.com/questions/3833184/iphone-ipad-context-menu

You need to use a UIMenuController . If you don't want Copy Paste Cut you'll include something like this in your canPerformAction method BOOL canPerformAction SEL action withSender id sender if action @selector someSelector return YES else return NO.. . If you don't want Copy Paste Cut you'll include something like this in your canPerformAction method BOOL canPerformAction SEL action withSender id sender if action @selector someSelector return YES else return NO Creating a new menu item looks..

UIWebView without Copy/Paste and selection rectangle when showing documents

http://stackoverflow.com/questions/5515522/uiwebview-without-copy-paste-and-selection-rectangle-when-showing-documents

contents that are showed by a UIWebView object. To achieve this I created a UIWebView subclass and overrode the BOOL canPerformAction SEL action withSender id sender method #pragma mark UIResponderStandardEditActions BOOL canPerformAction SEL action withSender.. the BOOL canPerformAction SEL action withSender id sender method #pragma mark UIResponderStandardEditActions BOOL canPerformAction SEL action withSender id sender if action @selector copy action @selector paste action @selector cut return _copyCutAndPasteEnabled.. if action @selector copy action @selector paste action @selector cut return _copyCutAndPasteEnabled return super canPerformAction action withSender sender Now the user no longer can make such operations however the UIWebView still shows the selection..

How to disable copy paste option from UITextField programmatically

http://stackoverflow.com/questions/6701019/how-to-disable-copy-paste-option-from-uitextfield-programmatically

This post has many nice solutions How disable Copy Cut Select Select All in UITextView My favourite is to override canPerformAction withSender BOOL canPerformAction SEL action withSender id sender if action @selector paste return NO return super canPerformAction.. How disable Copy Cut Select Select All in UITextView My favourite is to override canPerformAction withSender BOOL canPerformAction SEL action withSender id sender if action @selector paste return NO return super canPerformAction action withSender sender..