2012-11-05 55 views

回答

1

的攪和,下面的方法:

#import "NSObject+myCanPerformAction.h" 

@implementation NSObject (myCanPerformAction) 

- (BOOL)myCanPerformAction:(SEL)action withSender:(id)sender { 
    if (action == @selector(copy:)) { 
     return [self myCanPerformAction:action withSender:sender]; // not a recursion 
    } 
    if (action == @selector(paste:)) { 
     return [self myCanPerformAction:action withSender:sender]; // not a recursion 
    } 
    return NO; 
} 

@end 

混寫:

[[UIWebDocumentView class] jr_swizzleMethod:@selector(canPerformAction:withSender:) withMethod:@selector(myCanPerformAction:withSender:) error:nil]; 
+1

這真的適用於所有複製,粘貼等。但仍然彈出,它顯示「取代」行動。現在如何隱藏那一個。 – Sonu

相關問題