我需要禁用UISearchBar中显示的上下文菜单
目前我尝试了分段UISearchBar并覆盖canPerformAction:withSender:如下所示,但没有成功。这样做的最佳方法是什么?
标题文件:
#import <UIKit/UIKit.h>
@interface CustomSearchBar : UISearchBar
@end
实施
#import "CustomSearchBar.h"
@implementation CustomSearchBar
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
return NO;
}
@end