2012-03-14 4 views
0

iPadでUISearchBarを使用してUISearchDisplayControllerを使用すると、UIPopoverControllerに表示されます。画像に示されているようにクリアボタンを無効にして、さらに修正したいと思います。それが不可能な場合、どうすればクリアボタンを削除できますか?iPad上のUIPopoverControllerでUISearchDisplayControllerの「クリアボタン」を削除またはオーバーライドしますか?

Clear button http://desmond.imageshack.us/Himg692/scaled.php?server=692&filename=537870177.png&res=medium

答えて

0

私は一度..私は、カスタムアクションを作成するカスタムボタンとクリアボタンを交換すること。これ

UISearchBar *searchBar = yourSearchController.searchBar; 
UITextField *searchtextfield = [searchBar.subviews objectAtIndex:1]; 
UIButton *cButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
cButton.frame = CGRectMake(0, 0, 20 , 20); 
cButton.backgroundColor = [UIColor clearColor]; 
[cButton setImage:[UIImage newImageFromResource:@"yourButtonImage"] forState:UIControlStateNormal];//your button image. 
cButton.contentMode = UIViewContentModeScaleToFill; 
[cButton addTarget:self action:@selector(customButtonPressed) forControlEvents:UIControlEventTouchUpInside];//This is the custom event 
[searchtextfield setRightView:cButton]; 
[searchtextfield setRightViewMode:UITextFieldViewModeAlways]; 

幸運をチェックしてくださいました。

+0

実際にはキャンセルボタンではなくクリアボタンを意味していました。 これは、検索フィールドの右側にある小さなボタンについて説明しています。 クリアボタンと言う質問を編集しました。しかし、時間をとっていただきありがとうございます。 –

+0

ええええええええええええええええええええええええええええええんかんかんかんこう: –

+0

明瞭にするために画像を更新しました; –

関連する問題