5

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
4

0 に答える 0